Browse Source

update toar alert warning

features/handle-toastr-message
Trung Nguyen 1 year ago
parent
commit
97a936f015
4 changed files with 14 additions and 3 deletions
  1. +2
    -1
      angular.json
  2. +1
    -0
      package.json
  3. +3
    -1
      src/app/app.module.ts
  4. +8
    -1
      src/app/modules/overview/overall-ground/overall-ground.component.ts

+ 2
- 1
angular.json View File

@@ -32,7 +32,8 @@
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss",
"node_modules/leaflet/dist/leaflet.css"
"node_modules/leaflet/dist/leaflet.css",
"node_modules/ngx-toastr/toastr.css"
],
"scripts": [],
"allowedCommonJsDependencies": [

+ 1
- 0
package.json View File

@@ -24,6 +24,7 @@
"@asymmetrik/ngx-leaflet": "^16.0.1",
"@asymmetrik/ngx-leaflet-markercluster": "^16.0.0",
"leaflet": "^1.9.4",
"ngx-toastr": "^17.0.2",
"rtsp-relay": "^1.8.0",
"rxjs": "~7.8.0",
"rxjs-websockets": "^9.0.0",

+ 3
- 1
src/app/app.module.ts View File

@@ -7,6 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {SharedModule} from "./shared/shared.module";
import {HttpClientModule} from "@angular/common/http";
import {AppInitService} from "./shared/services/app-init.service";
import { ToastrModule } from 'ngx-toastr';

export function appInitializerFactory(appInitializerService: AppInitService): () => Promise<any> {
return () => appInitializerService.initializeApp();
@@ -22,7 +23,8 @@ export function appInitializerFactory(appInitializerService: AppInitService): ()
AppRoutingModule,
BrowserAnimationsModule,
SharedModule,
HttpClientModule
HttpClientModule,
ToastrModule.forRoot(), // ToastrModule added
],
providers: [


+ 8
- 1
src/app/modules/overview/overall-ground/overall-ground.component.ts View File

@@ -1,6 +1,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import {SocketService} from "../../../shared/services/socket.service";
import {Subscription} from "rxjs";
import {ToastrService} from "ngx-toastr";

@Component({
selector: 'app-overall-ground',
@@ -24,7 +25,10 @@ export class OverallGroundComponent implements OnInit, OnDestroy {
private intervalId: any;


constructor(private socketService$: SocketService) {
constructor(
private socketService$: SocketService,
private toastr: ToastrService
) {
}

ngOnInit() {
@@ -88,6 +92,9 @@ 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});
}
}
}


Loading…
Cancel
Save