diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-10 16:29:10 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-10 16:36:12 +0100 |
commit | fb2f6b918beb0a994ad304bfd678ef0c5c562210 (patch) | |
tree | 21c64ee76658b2e68559891ba317cb893afd2d44 /webapp/src/app/services/alert.service.ts | |
parent | c51d5034d527578da70bdd41b9ce13f28455c598 (diff) |
Moved Dashboad webapp on Angular 5 !
Webapp loading time decreased from 2.7s to 1.5sec !
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'webapp/src/app/services/alert.service.ts')
-rw-r--r-- | webapp/src/app/services/alert.service.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/webapp/src/app/services/alert.service.ts b/webapp/src/app/services/alert.service.ts index 2978e84..aee5827 100644 --- a/webapp/src/app/services/alert.service.ts +++ b/webapp/src/app/services/alert.service.ts @@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; -export type AlertType = "danger" | "warning" | "info" | "success"; +export type AlertType = 'danger' | 'warning' | 'info' | 'success'; export interface IAlert { type: AlertType; @@ -22,7 +22,7 @@ export class AlertService { private _alerts: IAlert[]; private alertsSubject = <Subject<IAlert[]>>new Subject(); private uid = 0; - private defaultDissmissTmo = 5; // in seconds + private defaultDismissTmo = 5; // in seconds constructor(private sanitizer: DomSanitizer) { this.alerts = this.alertsSubject.asObservable(); @@ -32,20 +32,20 @@ export class AlertService { public error(msg: string, dismissTime?: number) { this.add({ - type: "danger", msg: msg, dismissible: true, dismissTimeout: dismissTime + type: 'danger', msg: msg, dismissible: true, dismissTimeout: dismissTime }); } public warning(msg: string, dismissible?: boolean) { - this.add({ type: "warning", msg: msg, dismissible: true, dismissTimeout: (dismissible ? this.defaultDissmissTmo : 0) }); + this.add({ type: 'warning', msg: msg, dismissible: true, dismissTimeout: (dismissible ? this.defaultDismissTmo : 0) }); } public info(msg: string) { - this.add({ type: "info", msg: msg, dismissible: true, dismissTimeout: this.defaultDissmissTmo }); + this.add({ type: 'info', msg: msg, dismissible: true, dismissTimeout: this.defaultDismissTmo }); } public add(al: IAlert) { - let msg = String(al.msg).replace("\n", "<br>"); + const msg = String(al.msg).replace('\n', '<br>'); this._alerts.push({ show: true, type: al.type, @@ -59,7 +59,7 @@ export class AlertService { } public del(al: IAlert) { - let idx = this._alerts.findIndex((a) => a.id === al.id); + const idx = this._alerts.findIndex((a) => a.id === al.id); if (idx > -1) { this._alerts.splice(idx, 1); } |