1 import { ToastOptions } from 'ng2-toastr';
2 import { NotificationType } from '../enum/notification-type.enum';
4 export class CdNotificationConfig {
5 applicationClass: string;
9 Prometheus: 'prometheus-icon'
13 public type: NotificationType = NotificationType.info,
14 public title?: string,
15 public message?: string, // Use this for additional information only
16 public options?: any | ToastOptions,
17 public application: string = 'Ceph'
19 this.applicationClass = this.classes[this.application];
23 export class CdNotification extends CdNotificationConfig {
28 private textClasses = ['text-danger', 'text-info', 'text-success'];
29 private iconClasses = ['fa-exclamation-triangle', 'fa-info', 'fa-check'];
31 constructor(private config: CdNotificationConfig = new CdNotificationConfig()) {
32 super(config.type, config.title, config.message, config.options, config.application);
34 /* string representation of the Date object so it can be directly compared
35 with the timestamps parsed from localStorage */
36 this.timestamp = new Date().toJSON();
37 this.iconClass = this.iconClasses[this.type];
38 this.textClass = this.textClasses[this.type];