1 import { IndividualConfig } from 'ngx-toastr';
3 import { Icons } from '../enum/icons.enum';
4 import { NotificationType } from '../enum/notification-type.enum';
6 export class CdNotificationConfig {
7 applicationClass: string;
8 isFinishedTask = false;
12 Prometheus: 'prometheus-icon'
16 public type: NotificationType = NotificationType.info,
17 public title?: string,
18 public message?: string, // Use this for additional information only
19 public options?: any | IndividualConfig,
20 public application: string = 'Ceph'
22 this.applicationClass = this.classes[this.application];
26 export class CdNotification extends CdNotificationConfig {
33 private textClasses = ['text-danger', 'text-info', 'text-success'];
34 private iconClasses = [Icons.warning, Icons.info, Icons.check];
35 private borderClasses = ['border-danger', 'border-info', 'border-success'];
37 constructor(private config: CdNotificationConfig = new CdNotificationConfig()) {
38 super(config.type, config.title, config.message, config.options, config.application);
40 /* string representation of the Date object so it can be directly compared
41 with the timestamps parsed from localStorage */
42 this.timestamp = new Date().toJSON();
43 this.iconClass = this.iconClasses[this.type];
44 this.textClass = this.textClasses[this.type];
45 this.borderClass = this.borderClasses[this.type];
46 this.isFinishedTask = config.isFinishedTask;