diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 7e760e3337..f8770b9adc 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -90,7 +90,6 @@ import { } from '@home/components/alias/entity-aliases-dialog.component'; import { EntityAliases } from '@app/shared/models/alias.models'; import { EditWidgetComponent } from '@home/components/dashboard-page/edit-widget.component'; -import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; import { AddWidgetDialogComponent, AddWidgetDialogData @@ -118,8 +117,7 @@ import { ComponentPortal } from '@angular/cdk/portal'; import { DISPLAY_WIDGET_TYPES_PANEL_DATA, DisplayWidgetTypesPanelComponent, - DisplayWidgetTypesPanelData, - WidgetTypes + DisplayWidgetTypesPanelData } from '@home/components/dashboard-page/widget-types-panel.component'; import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component'; import {AliasEntityType, EntityType} from "@shared/models/entity-type.models"; @@ -1189,13 +1187,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC overlayRef.dispose(); }); + const filterWidgetTypes = this.dashboardWidgetSelectComponent.filterWidgetTypes; + const widgetTypesList = Array.from(this.dashboardWidgetSelectComponent.widgetTypes.values()).map(type => { + return {type, display: filterWidgetTypes === null ? true : filterWidgetTypes.includes(type)}; + }); + const providers: StaticProvider[] = [ { provide: DISPLAY_WIDGET_TYPES_PANEL_DATA, useValue: { - types: Array.from(this.dashboardWidgetSelectComponent.widgetTypes.values()).map(type => { - return {type, display: true}; - }), + types: widgetTypesList, typesUpdated: (newTypes) => { this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type); } diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts index c51cc9c37f..645d955deb 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts @@ -77,6 +77,10 @@ export class DashboardWidgetSelectComponent implements OnInit { this.filterWidgetTypes$.next(widgetTypes); } + get filterWidgetTypes(): Array { + return this.filterWidgetTypes$.value; + } + @Output() widgetSelected: EventEmitter = new EventEmitter();