Skip to content

Commit 8b5fe5f

Browse files
committed
fixed data format of info center to match the actually created element
1 parent 11af349 commit 8b5fe5f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

client/src/app/dashboard/info-center/info-center-datasource.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { map } from 'rxjs/operators';
44
import { Observable, of as observableOf, merge } from 'rxjs';
55

66
export interface InfoCenterItem {
7+
instanceId: number;
78
type: string;
89
notifName: string;
910
dateTime: string;
@@ -78,8 +79,8 @@ export class InfoCenterDataSource extends DataSource<InfoCenterItem> {
7879
}
7980
});
8081
}
81-
public add(element: any) {
82-
return this.data.push(element);
82+
public add(element: InfoCenterItem) {
83+
this.data.push(element);
8384
}
8485
}
8586

client/src/app/dashboard/info-center/info-center.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class InfoCenterComponent implements OnInit {
2525
ngOnInit() {
2626
this.dataSource = new InfoCenterDataSource(this.paginator, this.sort);
2727

28-
this.socketService.subscribeForEvent<Instance>(EventTypeEnum.InstanceAddedEvent).subscribe((newInstance: Instance) => {
28+
this.socketService.subscribeForEvent<Instance>(EventTypeEnum.InstanceAddedEvent).subscribe((newInstance: Instance) => {
2929
const newEntry = this.transformEventToNotificaton(newInstance, 'new Instance added', 'add_circle');
3030
this.applyUpdate(newEntry);
3131
});
@@ -35,13 +35,13 @@ export class InfoCenterComponent implements OnInit {
3535
this.applyUpdate(newEntry);
3636
});
3737

38-
this.socketService.subscribeForEvent<Instance>(EventTypeEnum.LinkStateChangedEvent).subscribe((changeInstance: Instance) => {
38+
this.socketService.subscribeForEvent<Instance>(EventTypeEnum.StateChangedEvent).subscribe((changeInstance: Instance) => {
3939
const newEntry = this.transformEventToNotificaton(changeInstance, 'Instance changed', 'link');
4040
this.applyUpdate(newEntry);
4141
});
4242
}
4343

44-
private transformEventToNotificaton(instance: Instance, notifName: string, type: string) {
44+
private transformEventToNotificaton(instance: Instance, notifName: string, type: string): InfoCenterItem {
4545
const datePipe = new DatePipe('en-US');
4646
const actualDate = datePipe.transform(Date.now(), 'dd/MM/yyyy hh:mm:ss:SSS');
4747
return {instanceId: instance.id, type: type,

0 commit comments

Comments
 (0)