Skip to content

Commit 1d8d0f0

Browse files
committed
custom details message on instance state change in notification center
1 parent 4c2b0be commit 1d8d0f0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

client/src/app/model/event.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)