Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Add automatic closing for the success notification #937

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
14b9d1e
Channel overview component - frontend
StefanNedelcu Jun 2, 2022
6dc992c
Merge branch 'add-support-for-redis-revisions' into feature/channel-o…
StefanNedelcu Jun 8, 2022
0600390
Switch to the current api endpoint
StefanNedelcu Jun 8, 2022
6517996
Merge branch 'main' into feature/channel-overview-page
StefanNedelcu Jun 8, 2022
b8d998c
Merge pull request #38 from equilobe/feature/channel-overview-page
StefanNedelcu Jun 10, 2022
d5ac1db
Fixed right panel scroll off screen
gogeterobert Jun 10, 2022
345bd68
Now ignores itself when checking for unique name
gogeterobert Jun 10, 2022
9fead57
Merge pull request #39 from equilobe/bugfix-839/right-panel-scroll-of…
gogeterobert Jun 10, 2022
ee3ba67
Merge pull request #40 from equilobe/bugfix-849/update-channel-not-wo…
gogeterobert Jun 10, 2022
36b6c50
Merge branch 'deislabs:main' into main
gogeterobert Jun 10, 2022
e540470
Merge pull request #36 from equilobe/feature/get-status-from-nomad
gogeterobert Jun 14, 2022
64ba606
Merge branch 'deislabs:main' into main
gogeterobert Jun 14, 2022
725ae9f
Merge branch 'deislabs:main' into main
gogeterobert Jun 15, 2022
89569f5
Merge branch 'deislabs:main' into main
gogeterobert Jun 16, 2022
e18676b
Merge branch 'deislabs:main' into main
gogeterobert Jun 16, 2022
3ef9b0d
Merge branch 'deislabs:main' into main
gogeterobert Jun 18, 2022
4d4606b
Merge branch 'deislabs:main' into main
gogeterobert Jun 21, 2022
8ae94b9
automatic closing for the success notification
alexandradumitru22 Jun 22, 2022
8819fda
Improve styling and remove hardcoded values
alexandradumitru22 Jun 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Web/ClientApp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { OverviewComponent } from './components/channel/overview/overview.compon
import { NgxJdenticonModule, JDENTICON_CONFIG } from 'ngx-jdenticon';
import { AppConfigService } from './_services/app-config.service';
import { WarningComponent } from './components/helpers/warning/warning.component';
import { SuccessComponent } from './components/helpers/success/success.component';

export function apiConfigFactory(): Configuration {
const params: ConfigurationParameters = {
Expand All @@ -52,6 +53,7 @@ export function apiConfigFactory(): Configuration {
LogsComponent,
OverviewComponent,
WarningComponent,
SuccessComponent,
],
imports: [
BrowserModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<article *ngIf="submitted" class="message is-success">
<div class="message-header">
<p>Success</p>
</div>
<div class="message-body">
Environment Variables Saved
</div>
</article>
<app-success></app-success>
<app-warning [error]="error"></app-warning>
<div *ngIf="!loading" class="box columns is-multiline has-background-light">
<ng-template [ngIf]="envvars.length <= 0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Component, Input, OnChanges, ViewChild } from '@angular/core';
import { faBackward, faTrash, faSave } from '@fortawesome/free-solid-svg-icons';
import { ChannelService, EnvironmentVariableService } from 'src/app/core/api/v1';
import { SuccessComponent } from '../../helpers/success/success.component';

@Component({
selector: 'app-environment-variable-list',
Expand All @@ -9,13 +10,13 @@ import { ChannelService, EnvironmentVariableService } from 'src/app/core/api/v1'
})
export class ListComponent implements OnChanges {
@Input() channelId = '';
@ViewChild(SuccessComponent) success: SuccessComponent = new SuccessComponent;

envvars: any = [];
originalEnvVars: any = [];

error: any = null;
loading: boolean = false;
submitted = false;
faBackward = faBackward;
faTrash = faTrash;
faSave = faSave;
Expand All @@ -24,6 +25,7 @@ export class ListComponent implements OnChanges {

ngOnChanges(): void {
this.refreshData();
this.success.hide();
}

addNewVariable() {
Expand Down Expand Up @@ -71,13 +73,12 @@ export class ListComponent implements OnChanges {
}).subscribe({
next: () => {
this.refreshData();
this.submitted = true;
this.success.show();
this.error = null;
},
error: (err) => {
console.log(err.error.errors);
this.error = err;
this.submitted = false;
}
});
}
Expand Down Expand Up @@ -121,7 +122,6 @@ export class ListComponent implements OnChanges {
error: (err) => {
console.log(err.error.errors);
this.error = err;
this.submitted = false;
this.loading = false;
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.success-margins {
margin-left: -0.75rem;
margin-right: -0.75rem;
margin-top: -0.75rem;
margin-bottom: 1rem;
}

.is-x-small {
height: 0.25rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<article *ngIf="visible" class="message is-success success-margins">
<div class="message-header">
<p>Success</p>
</div>
<div class="message-body">
Environment Variables Saved
</div>
<progress *ngIf="counter" class="progress is-x-small is-success" [attr.value]="counter" [attr.max]="intervalResetTime"></progress>
</article>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SuccessComponent } from './success.component';

describe('SuccessComponent', () => {
let component: SuccessComponent;
let fixture: ComponentFixture<SuccessComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SuccessComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(SuccessComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {
Component,
Injectable,
} from '@angular/core';

@Injectable({
providedIn: 'root',
})
@Component({
selector: 'app-success',
templateUrl: './success.component.html',
styleUrls: ['./success.component.css']
})
export class SuccessComponent {
visible: boolean = false;
counter: number = 0;
interval: any = null;
intervalResetTime: number = 3000;
incrementInterval: number = 10;

constructor() {}

show(): void {
clearInterval(this.interval);
this.visible = true;
this.startTimer();
}

hide(): void {
clearInterval(this.interval);
this.visible = false;
this.counter = 0;
}

startTimer(): void {
this.counter = 0;

this.interval = setInterval(() => {
if (this.counter === this.intervalResetTime) {
clearInterval(this.interval);
this.visible = false;
this.counter = 0;
} else {
this.counter += this.incrementInterval ;
}
}, this.incrementInterval);
}
}