#11 display warning

Open
trungnd wants to merge 1 commits from features/handle-toastr-message into master
  1. +14
    -3
      src/app/modules/overview/overall-ground/overall-ground.component.ts

+ 14
- 3
src/app/modules/overview/overall-ground/overall-ground.component.ts View File

@@ -23,7 +23,7 @@ export class OverallGroundComponent implements OnInit, OnDestroy {
private statusSubscription?: Subscription;
private messageSubscription?: Subscription;
private intervalId: any;
isShowingToastr: boolean = false;

constructor(
private socketService$: SocketService,
@@ -92,10 +92,21 @@ export class OverallGroundComponent implements OnInit, OnDestroy {

this.Sstate1 = this.state1 === 'ON';// alarm 12h
this.Sstate2 = this.state2 === 'ON';// alarm 1h
if (message.ready === '0'){
this.toastr.warning('System not ready', 'Warning', {timeOut: 5000});
this.handleMessage(message);
}
}

handleMessage(message: any) {
if (message.ready === '0' && !this.isShowingToastr) {
this.showToastr();
}
}

showToastr() {
this.toastr.warning('System not ready', 'Warning', { timeOut: 5000 });
this.isShowingToastr = true;
setTimeout(() => {
this.isShowingToastr = false;
}, 5000);
}
}

Loading…
Cancel
Save