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