UI: Handle premature entity and alarm data updates from websocket.
This commit is contained in:
parent
a1c4d29e48
commit
0b825e8dc3
@ -62,6 +62,7 @@ export class AlarmDataSubscription {
|
||||
private alarmDataCommand: AlarmDataCmd;
|
||||
|
||||
private pageData: PageData<AlarmData>;
|
||||
private prematureUpdates: Array<Array<AlarmData>>;
|
||||
private alarmIdToDataIndex: {[id: string]: number};
|
||||
|
||||
private subsTw: SubscriptionTimewindow;
|
||||
@ -136,8 +137,21 @@ export class AlarmDataSubscription {
|
||||
this.subscriber.alarmData$.subscribe((alarmDataUpdate) => {
|
||||
if (alarmDataUpdate.data) {
|
||||
this.onPageData(alarmDataUpdate.data, alarmDataUpdate.allowedEntities, alarmDataUpdate.totalEntities);
|
||||
if (this.prematureUpdates) {
|
||||
for (const update of this.prematureUpdates) {
|
||||
this.onDataUpdate(update);
|
||||
}
|
||||
this.prematureUpdates = null;
|
||||
}
|
||||
} else if (alarmDataUpdate.update) {
|
||||
this.onDataUpdate(alarmDataUpdate.update);
|
||||
if (!this.pageData) {
|
||||
if (!this.prematureUpdates) {
|
||||
this.prematureUpdates = [];
|
||||
}
|
||||
this.prematureUpdates.push(alarmDataUpdate.update);
|
||||
} else {
|
||||
this.onDataUpdate(alarmDataUpdate.update);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -120,6 +120,7 @@ export class EntityDataSubscription {
|
||||
|
||||
private entityDataResolveSubject: Subject<EntityDataLoadResult>;
|
||||
private pageData: PageData<EntityData>;
|
||||
private prematureUpdates: Array<Array<EntityData>>;
|
||||
private data: Array<Array<DataSetHolder>>;
|
||||
private subsTw: SubscriptionTimewindow;
|
||||
private latestTsOffset: number;
|
||||
@ -348,8 +349,21 @@ export class EntityDataSubscription {
|
||||
(entityDataUpdate) => {
|
||||
if (entityDataUpdate.data) {
|
||||
this.onPageData(entityDataUpdate.data);
|
||||
if (this.prematureUpdates) {
|
||||
for (const update of this.prematureUpdates) {
|
||||
this.onDataUpdate(update);
|
||||
}
|
||||
this.prematureUpdates = null;
|
||||
}
|
||||
} else if (entityDataUpdate.update) {
|
||||
this.onDataUpdate(entityDataUpdate.update);
|
||||
if (!this.pageData) {
|
||||
if (!this.prematureUpdates) {
|
||||
this.prematureUpdates = [];
|
||||
}
|
||||
this.prematureUpdates.push(entityDataUpdate.update);
|
||||
} else {
|
||||
this.onDataUpdate(entityDataUpdate.update);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user