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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
13 additions and
10 deletions
-
ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts
-
ui-ngx/src/app/modules/home/components/widget/widget.component.ts
-
ui-ngx/src/app/shared/models/widget.models.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 { |
|
|
|
|
|
|
|
@ -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() { |
|
|
|
|
|
|
|
@ -173,7 +173,7 @@ export interface WidgetTypeParameters { |
|
|
|
hasAdditionalLatestDataKeys?: boolean; |
|
|
|
warnOnPageDataOverflow?: boolean; |
|
|
|
ignoreDataUpdateOnIntervalTick?: boolean; |
|
|
|
|
|
|
|
processNoDataByWidget?: boolean; |
|
|
|
} |
|
|
|
|
|
|
|
export interface WidgetControllerDescriptor { |
|
|
|
|