Commit 74e20e2c68a636ef55bf3a1d05290818adbdc887
1 parent
593f95a7
UI: Fixed didn't save widget type filter in widgets selector
Showing
2 changed files
with
11 additions
and
6 deletions
@@ -90,7 +90,6 @@ import { | @@ -90,7 +90,6 @@ import { | ||
90 | } from '@home/components/alias/entity-aliases-dialog.component'; | 90 | } from '@home/components/alias/entity-aliases-dialog.component'; |
91 | import { EntityAliases } from '@app/shared/models/alias.models'; | 91 | import { EntityAliases } from '@app/shared/models/alias.models'; |
92 | import { EditWidgetComponent } from '@home/components/dashboard-page/edit-widget.component'; | 92 | import { EditWidgetComponent } from '@home/components/dashboard-page/edit-widget.component'; |
93 | -import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; | ||
94 | import { | 93 | import { |
95 | AddWidgetDialogComponent, | 94 | AddWidgetDialogComponent, |
96 | AddWidgetDialogData | 95 | AddWidgetDialogData |
@@ -118,8 +117,7 @@ import { ComponentPortal } from '@angular/cdk/portal'; | @@ -118,8 +117,7 @@ import { ComponentPortal } from '@angular/cdk/portal'; | ||
118 | import { | 117 | import { |
119 | DISPLAY_WIDGET_TYPES_PANEL_DATA, | 118 | DISPLAY_WIDGET_TYPES_PANEL_DATA, |
120 | DisplayWidgetTypesPanelComponent, | 119 | DisplayWidgetTypesPanelComponent, |
121 | - DisplayWidgetTypesPanelData, | ||
122 | - WidgetTypes | 120 | + DisplayWidgetTypesPanelData |
123 | } from '@home/components/dashboard-page/widget-types-panel.component'; | 121 | } from '@home/components/dashboard-page/widget-types-panel.component'; |
124 | import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component'; | 122 | import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component'; |
125 | 123 | ||
@@ -1183,13 +1181,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -1183,13 +1181,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
1183 | overlayRef.dispose(); | 1181 | overlayRef.dispose(); |
1184 | }); | 1182 | }); |
1185 | 1183 | ||
1184 | + const filterWidgetTypes = this.dashboardWidgetSelectComponent.filterWidgetTypes; | ||
1185 | + const widgetTypesList = Array.from(this.dashboardWidgetSelectComponent.widgetTypes.values()).map(type => { | ||
1186 | + return {type, display: filterWidgetTypes === null ? true : filterWidgetTypes.includes(type)}; | ||
1187 | + }); | ||
1188 | + | ||
1186 | const providers: StaticProvider[] = [ | 1189 | const providers: StaticProvider[] = [ |
1187 | { | 1190 | { |
1188 | provide: DISPLAY_WIDGET_TYPES_PANEL_DATA, | 1191 | provide: DISPLAY_WIDGET_TYPES_PANEL_DATA, |
1189 | useValue: { | 1192 | useValue: { |
1190 | - types: Array.from(this.dashboardWidgetSelectComponent.widgetTypes.values()).map(type => { | ||
1191 | - return {type, display: true}; | ||
1192 | - }), | 1193 | + types: widgetTypesList, |
1193 | typesUpdated: (newTypes) => { | 1194 | typesUpdated: (newTypes) => { |
1194 | this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type); | 1195 | this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type); |
1195 | } | 1196 | } |
@@ -77,6 +77,10 @@ export class DashboardWidgetSelectComponent implements OnInit { | @@ -77,6 +77,10 @@ export class DashboardWidgetSelectComponent implements OnInit { | ||
77 | this.filterWidgetTypes$.next(widgetTypes); | 77 | this.filterWidgetTypes$.next(widgetTypes); |
78 | } | 78 | } |
79 | 79 | ||
80 | + get filterWidgetTypes(): Array<widgetType> { | ||
81 | + return this.filterWidgetTypes$.value; | ||
82 | + } | ||
83 | + | ||
80 | @Output() | 84 | @Output() |
81 | widgetSelected: EventEmitter<WidgetInfo> = new EventEmitter<WidgetInfo>(); | 85 | widgetSelected: EventEmitter<WidgetInfo> = new EventEmitter<WidgetInfo>(); |
82 | 86 |