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

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

+ 1
- 0
package.json View File

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

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

import {SharedModule} from "./shared/shared.module"; import {SharedModule} from "./shared/shared.module";
import {HttpClientModule} from "@angular/common/http"; import {HttpClientModule} from "@angular/common/http";
import {AppInitService} from "./shared/services/app-init.service"; import {AppInitService} from "./shared/services/app-init.service";
import { ToastrModule } from 'ngx-toastr';


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



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

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


@Component({ @Component({
selector: 'app-overall-ground', selector: 'app-overall-ground',
private intervalId: any; private intervalId: any;




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


ngOnInit() { ngOnInit() {


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



Loading…
Cancel
Save