Commit 72d7c0bb299e7c3af5b14273c7632d4760de7e58
1 parent
ac675ef1
Improve optional datasources handling
Showing
3 changed files
with
6 additions
and
1 deletions
@@ -235,6 +235,7 @@ export interface WidgetSubscriptionOptions { | @@ -235,6 +235,7 @@ export interface WidgetSubscriptionOptions { | ||
235 | stateData?: boolean; | 235 | stateData?: boolean; |
236 | alarmSource?: Datasource; | 236 | alarmSource?: Datasource; |
237 | datasources?: Array<Datasource>; | 237 | datasources?: Array<Datasource>; |
238 | + datasourcesOptional?: boolean; | ||
238 | hasDataPageLink?: boolean; | 239 | hasDataPageLink?: boolean; |
239 | singleEntity?: boolean; | 240 | singleEntity?: boolean; |
240 | warnOnPageDataOverflow?: boolean; | 241 | warnOnPageDataOverflow?: boolean; |
@@ -106,6 +106,7 @@ export class WidgetSubscription implements IWidgetSubscription { | @@ -106,6 +106,7 @@ export class WidgetSubscription implements IWidgetSubscription { | ||
106 | caulculateLegendData: boolean; | 106 | caulculateLegendData: boolean; |
107 | displayLegend: boolean; | 107 | displayLegend: boolean; |
108 | stateData: boolean; | 108 | stateData: boolean; |
109 | + datasourcesOptional: boolean; | ||
109 | decimals: number; | 110 | decimals: number; |
110 | units: string; | 111 | units: string; |
111 | comparisonEnabled: boolean; | 112 | comparisonEnabled: boolean; |
@@ -181,6 +182,7 @@ export class WidgetSubscription implements IWidgetSubscription { | @@ -181,6 +182,7 @@ export class WidgetSubscription implements IWidgetSubscription { | ||
181 | this.callbacks.dataLoading = this.callbacks.dataLoading || (() => {}); | 182 | this.callbacks.dataLoading = this.callbacks.dataLoading || (() => {}); |
182 | this.callbacks.timeWindowUpdated = this.callbacks.timeWindowUpdated || (() => {}); | 183 | this.callbacks.timeWindowUpdated = this.callbacks.timeWindowUpdated || (() => {}); |
183 | this.alarmSource = options.alarmSource; | 184 | this.alarmSource = options.alarmSource; |
185 | + this.datasourcesOptional = options.datasourcesOptional; | ||
184 | this.alarmDataListener = null; | 186 | this.alarmDataListener = null; |
185 | this.alarms = emptyPageData(); | 187 | this.alarms = emptyPageData(); |
186 | this.originalTimewindow = null; | 188 | this.originalTimewindow = null; |
@@ -212,6 +214,7 @@ export class WidgetSubscription implements IWidgetSubscription { | @@ -212,6 +214,7 @@ export class WidgetSubscription implements IWidgetSubscription { | ||
212 | this.callbacks.timeWindowUpdated = this.callbacks.timeWindowUpdated || (() => {}); | 214 | this.callbacks.timeWindowUpdated = this.callbacks.timeWindowUpdated || (() => {}); |
213 | 215 | ||
214 | this.configuredDatasources = this.ctx.utils.validateDatasources(options.datasources); | 216 | this.configuredDatasources = this.ctx.utils.validateDatasources(options.datasources); |
217 | + this.datasourcesOptional = options.datasourcesOptional; | ||
215 | this.entityDataListeners = []; | 218 | this.entityDataListeners = []; |
216 | this.hasDataPageLink = options.hasDataPageLink; | 219 | this.hasDataPageLink = options.hasDataPageLink; |
217 | this.singleEntity = options.singleEntity; | 220 | this.singleEntity = options.singleEntity; |
@@ -448,7 +451,7 @@ export class WidgetSubscription implements IWidgetSubscription { | @@ -448,7 +451,7 @@ export class WidgetSubscription implements IWidgetSubscription { | ||
448 | } | 451 | } |
449 | }); | 452 | }); |
450 | this.configureLoadedData(); | 453 | this.configureLoadedData(); |
451 | - this.hasResolvedData = this.datasources.length > 0; | 454 | + this.hasResolvedData = this.datasources.length > 0 || this.datasourcesOptional; |
452 | this.updateDataTimewindow(); | 455 | this.updateDataTimewindow(); |
453 | this.notifyDataLoaded(); | 456 | this.notifyDataLoaded(); |
454 | this.onDataUpdated(true); | 457 | this.onDataUpdated(true); |
@@ -936,6 +936,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI | @@ -936,6 +936,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI | ||
936 | options = { | 936 | options = { |
937 | type: this.widget.type, | 937 | type: this.widget.type, |
938 | stateData: this.typeParameters.stateData, | 938 | stateData: this.typeParameters.stateData, |
939 | + datasourcesOptional: this.typeParameters.datasourcesOptional, | ||
939 | hasDataPageLink: this.typeParameters.hasDataPageLink, | 940 | hasDataPageLink: this.typeParameters.hasDataPageLink, |
940 | singleEntity: this.typeParameters.singleEntity, | 941 | singleEntity: this.typeParameters.singleEntity, |
941 | warnOnPageDataOverflow: this.typeParameters.warnOnPageDataOverflow, | 942 | warnOnPageDataOverflow: this.typeParameters.warnOnPageDataOverflow, |