src/app/shared/models/cd-notification.ts
Properties |
|
constructor(config: CdNotificationConfig)
|
||||||
Defined in src/app/shared/models/cd-notification.ts:29
|
||||||
Parameters :
|
iconClass |
Type : string
|
Defined in src/app/shared/models/cd-notification.ts:26
|
Private iconClasses |
Type : []
|
Default value : ['fa-exclamation-triangle', 'fa-info', 'fa-check']
|
Defined in src/app/shared/models/cd-notification.ts:29
|
textClass |
Type : string
|
Defined in src/app/shared/models/cd-notification.ts:25
|
Private textClasses |
Type : []
|
Default value : ['text-danger', 'text-info', 'text-success']
|
Defined in src/app/shared/models/cd-notification.ts:28
|
timestamp |
Type : string
|
Defined in src/app/shared/models/cd-notification.ts:24
|
Public application |
Type : string
|
Default value : 'Ceph'
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:17
|
applicationClass |
Type : string
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:5
|
Private classes |
Type : object
|
Default value : {
Ceph: 'ceph-icon',
Prometheus: 'prometheus-icon'
}
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:7
|
Public Optional message |
Type : string
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:15
|
Public Optional options |
Type : any | ToastOptions
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:16
|
Public Optional title |
Type : string
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:14
|
Public type |
Type : NotificationType
|
Default value : NotificationType.info
|
Inherited from
CdNotificationConfig
|
Defined in
CdNotificationConfig:13
|
import { ToastOptions } from 'ng2-toastr';
import { NotificationType } from '../enum/notification-type.enum';
export class CdNotificationConfig {
applicationClass: string;
private classes = {
Ceph: 'ceph-icon',
Prometheus: 'prometheus-icon'
};
constructor(
public type: NotificationType = NotificationType.info,
public title?: string,
public message?: string, // Use this for additional information only
public options?: any | ToastOptions,
public application: string = 'Ceph'
) {
this.applicationClass = this.classes[this.application];
}
}
export class CdNotification extends CdNotificationConfig {
timestamp: string;
textClass: string;
iconClass: string;
private textClasses = ['text-danger', 'text-info', 'text-success'];
private iconClasses = ['fa-exclamation-triangle', 'fa-info', 'fa-check'];
constructor(private config: CdNotificationConfig = new CdNotificationConfig()) {
super(config.type, config.title, config.message, config.options, config.application);
delete this.config;
/* string representation of the Date object so it can be directly compared
with the timestamps parsed from localStorage */
this.timestamp = new Date().toJSON();
this.iconClass = this.iconClasses[this.type];
this.textClass = this.textClasses[this.type];
}
}