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 {
4040
4141 private transformEventToNotificaton ( instance : Instance , prevInstance : Instance , action : Actions ) : InfoCenterItem {
4242 // TODO: calculate difference between new and previous instance and update details text accordingly
43+ const details = this . getChange ( instance , prevInstance , action ) ;
44+
4345 const datePipe = new DatePipe ( 'en-US' ) ;
4446 const actualDate = datePipe . transform ( Date . now ( ) , 'dd/MM/yyyy hh:mm:ss:SSS' ) ;
4547 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 ;
4758 }
4859}
You can’t perform that action at this time.
0 commit comments