File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,20 @@ export class EventService {
40
40
41
41
private transformEventToNotificaton ( instance : Instance , prevInstance : Instance , action : Actions ) : InfoCenterItem {
42
42
// TODO: calculate difference between new and previous instance and update details text accordingly
43
+ const details = this . getChange ( instance , prevInstance , action ) ;
44
+
43
45
const datePipe = new DatePipe ( 'en-US' ) ;
44
46
const actualDate = datePipe . transform ( Date . now ( ) , 'dd/MM/yyyy hh:mm:ss:SSS' ) ;
45
47
return { instanceId : instance . id , type : ACTION_NOTIF_MAP [ action ] . type ,
46
- notifName : ACTION_NOTIF_MAP [ action ] . description , dateTime : actualDate , details : instance . name } ;
48
+ notifName : ACTION_NOTIF_MAP [ action ] . description , dateTime : actualDate , details : details } ;
49
+ }
50
+
51
+ private getChange ( instance : Instance , prevInstance : Instance , action : Actions ) : string {
52
+ if ( prevInstance && action === Actions . CHANGE ) {
53
+ if ( instance . instanceState !== prevInstance . instanceState ) {
54
+ return 'Instance state changed from ' + prevInstance . instanceState + ' to ' + instance . instanceState ;
55
+ }
56
+ }
57
+ return instance . name ;
47
58
}
48
59
}
You can’t perform that action at this time.
0 commit comments