]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-notification.ts
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / models / cd-notification.ts
1 import { ToastOptions } from 'ng2-toastr';
2 import { NotificationType } from '../enum/notification-type.enum';
3
4 export class CdNotificationConfig {
5 applicationClass: string;
6
7 private classes = {
8 Ceph: 'ceph-icon',
9 Prometheus: 'prometheus-icon'
10 };
11
12 constructor(
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'
18 ) {
19 this.applicationClass = this.classes[this.application];
20 }
21 }
22
23 export class CdNotification extends CdNotificationConfig {
24 timestamp: string;
25 textClass: string;
26 iconClass: string;
27
28 private textClasses = ['text-danger', 'text-info', 'text-success'];
29 private iconClasses = ['fa-exclamation-triangle', 'fa-info', 'fa-check'];
30
31 constructor(private config: CdNotificationConfig = new CdNotificationConfig()) {
32 super(config.type, config.title, config.message, config.options, config.application);
33 delete this.config;
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];
39 }
40 }