Browse Source

Merge pull request #6917 from devaskim/2_process_no_data_by_widget

[3.4.2] UI: Let custom widget to process no-data case
pull/7236/head
Igor Kulikov 4 years ago
committed by GitHub
parent
commit
39d5fa947f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts
  2. 18
      ui-ngx/src/app/modules/home/components/widget/widget.component.ts
  3. 2
      ui-ngx/src/app/shared/models/widget.models.ts

3
ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts

@ -540,6 +540,9 @@ export class WidgetComponentService {
if (isUndefined(result.typeParameters.stateData)) {
result.typeParameters.stateData = false;
}
if (isUndefined(result.typeParameters.processNoDataByWidget)) {
result.typeParameters.processNoDataByWidget = false;
}
if (isFunction(widgetTypeInstance.actionSources)) {
result.actionSources = widgetTypeInstance.actionSources();
} else {

18
ui-ngx/src/app/modules/home/components/widget/widget.component.ts

@ -400,17 +400,17 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI
}
private displayWidgetInstance(): boolean {
if (this.widget.type !== widgetType.static) {
for (const id of Object.keys(this.widgetContext.subscriptions)) {
const subscription = this.widgetContext.subscriptions[id];
if (subscription.isDataResolved()) {
return true;
}
}
return false;
} else {
if (this.widget.type === widgetType.static || this.typeParameters?.processNoDataByWidget) {
return true;
}
for (const id of Object.keys(this.widgetContext.subscriptions)) {
const subscription = this.widgetContext.subscriptions[id];
if (subscription.isDataResolved()) {
return true;
}
}
return false;
}
private onDestroy() {

2
ui-ngx/src/app/shared/models/widget.models.ts

@ -173,7 +173,7 @@ export interface WidgetTypeParameters {
hasAdditionalLatestDataKeys?: boolean;
warnOnPageDataOverflow?: boolean;
ignoreDataUpdateOnIntervalTick?: boolean;
processNoDataByWidget?: boolean;
}
export interface WidgetControllerDescriptor {

Loading…
Cancel
Save