|
|
@ -112,6 +112,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
init$: Observable<IWidgetSubscription>; |
|
|
init$: Observable<IWidgetSubscription>; |
|
|
|
|
|
|
|
|
cafs: {[cafId: string]: CancelAnimationFrame} = {}; |
|
|
cafs: {[cafId: string]: CancelAnimationFrame} = {}; |
|
|
|
|
|
hasResolvedData = false; |
|
|
|
|
|
|
|
|
targetDeviceAliasId: string; |
|
|
targetDeviceAliasId: string; |
|
|
targetDeviceId: string; |
|
|
targetDeviceId: string; |
|
|
@ -249,6 +250,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
} else { |
|
|
} else { |
|
|
this.rpcEnabled = this.ctx.utils.widgetEditMode ? true : false; |
|
|
this.rpcEnabled = this.ctx.utils.widgetEditMode ? true : false; |
|
|
} |
|
|
} |
|
|
|
|
|
this.hasResolvedData = this.rpcEnabled; |
|
|
this.callbacks.rpcStateChanged(this); |
|
|
this.callbacks.rpcStateChanged(this); |
|
|
initRpcSubject.next(); |
|
|
initRpcSubject.next(); |
|
|
initRpcSubject.complete(); |
|
|
initRpcSubject.complete(); |
|
|
@ -275,6 +277,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
} else { |
|
|
} else { |
|
|
this.rpcEnabled = this.ctx.utils.widgetEditMode ? true : false; |
|
|
this.rpcEnabled = this.ctx.utils.widgetEditMode ? true : false; |
|
|
} |
|
|
} |
|
|
|
|
|
this.hasResolvedData = true; |
|
|
this.callbacks.rpcStateChanged(this); |
|
|
this.callbacks.rpcStateChanged(this); |
|
|
initRpcSubject.next(); |
|
|
initRpcSubject.next(); |
|
|
initRpcSubject.complete(); |
|
|
initRpcSubject.complete(); |
|
|
@ -286,6 +289,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
const initAlarmSubscriptionSubject = new ReplaySubject(1); |
|
|
const initAlarmSubscriptionSubject = new ReplaySubject(1); |
|
|
this.loadStDiff().subscribe(() => { |
|
|
this.loadStDiff().subscribe(() => { |
|
|
if (!this.ctx.aliasController) { |
|
|
if (!this.ctx.aliasController) { |
|
|
|
|
|
this.hasResolvedData = true; |
|
|
this.configureAlarmsData(); |
|
|
this.configureAlarmsData(); |
|
|
initAlarmSubscriptionSubject.next(); |
|
|
initAlarmSubscriptionSubject.next(); |
|
|
initAlarmSubscriptionSubject.complete(); |
|
|
initAlarmSubscriptionSubject.complete(); |
|
|
@ -293,6 +297,9 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
this.ctx.aliasController.resolveAlarmSource(this.alarmSource).subscribe( |
|
|
this.ctx.aliasController.resolveAlarmSource(this.alarmSource).subscribe( |
|
|
(alarmSource) => { |
|
|
(alarmSource) => { |
|
|
this.alarmSource = alarmSource; |
|
|
this.alarmSource = alarmSource; |
|
|
|
|
|
if (alarmSource) { |
|
|
|
|
|
this.hasResolvedData = true; |
|
|
|
|
|
} |
|
|
this.configureAlarmsData(); |
|
|
this.configureAlarmsData(); |
|
|
initAlarmSubscriptionSubject.next(); |
|
|
initAlarmSubscriptionSubject.next(); |
|
|
initAlarmSubscriptionSubject.complete(); |
|
|
initAlarmSubscriptionSubject.complete(); |
|
|
@ -313,6 +320,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
const initDataSubscriptionSubject = new ReplaySubject(1); |
|
|
const initDataSubscriptionSubject = new ReplaySubject(1); |
|
|
this.loadStDiff().subscribe(() => { |
|
|
this.loadStDiff().subscribe(() => { |
|
|
if (!this.ctx.aliasController) { |
|
|
if (!this.ctx.aliasController) { |
|
|
|
|
|
this.hasResolvedData = true; |
|
|
this.configureData(); |
|
|
this.configureData(); |
|
|
initDataSubscriptionSubject.next(); |
|
|
initDataSubscriptionSubject.next(); |
|
|
initDataSubscriptionSubject.complete(); |
|
|
initDataSubscriptionSubject.complete(); |
|
|
@ -320,6 +328,9 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
this.ctx.aliasController.resolveDatasources(this.datasources).subscribe( |
|
|
this.ctx.aliasController.resolveDatasources(this.datasources).subscribe( |
|
|
(datasources) => { |
|
|
(datasources) => { |
|
|
this.datasources = datasources; |
|
|
this.datasources = datasources; |
|
|
|
|
|
if (datasources && datasources.length) { |
|
|
|
|
|
this.hasResolvedData = true; |
|
|
|
|
|
} |
|
|
this.configureData(); |
|
|
this.configureData(); |
|
|
initDataSubscriptionSubject.next(); |
|
|
initDataSubscriptionSubject.next(); |
|
|
initDataSubscriptionSubject.complete(); |
|
|
initDataSubscriptionSubject.complete(); |
|
|
@ -804,6 +815,10 @@ export class WidgetSubscription implements IWidgetSubscription { |
|
|
return subscriptionsChanged; |
|
|
return subscriptionsChanged; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
isDataResolved(): boolean { |
|
|
|
|
|
return this.hasResolvedData; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
destroy(): void { |
|
|
destroy(): void { |
|
|
this.unsubscribe(); |
|
|
this.unsubscribe(); |
|
|
for (const cafId of Object.keys(this.cafs)) { |
|
|
for (const cafId of Object.keys(this.cafs)) { |
|
|
|