UI: Fixed didn't save widget type filter in widgets selector
This commit is contained in:
parent
593f95a7af
commit
74e20e2c68
@ -90,7 +90,6 @@ import {
|
|||||||
} from '@home/components/alias/entity-aliases-dialog.component';
|
} from '@home/components/alias/entity-aliases-dialog.component';
|
||||||
import { EntityAliases } from '@app/shared/models/alias.models';
|
import { EntityAliases } from '@app/shared/models/alias.models';
|
||||||
import { EditWidgetComponent } from '@home/components/dashboard-page/edit-widget.component';
|
import { EditWidgetComponent } from '@home/components/dashboard-page/edit-widget.component';
|
||||||
import { WidgetsBundle } from '@shared/models/widgets-bundle.model';
|
|
||||||
import {
|
import {
|
||||||
AddWidgetDialogComponent,
|
AddWidgetDialogComponent,
|
||||||
AddWidgetDialogData
|
AddWidgetDialogData
|
||||||
@ -118,8 +117,7 @@ import { ComponentPortal } from '@angular/cdk/portal';
|
|||||||
import {
|
import {
|
||||||
DISPLAY_WIDGET_TYPES_PANEL_DATA,
|
DISPLAY_WIDGET_TYPES_PANEL_DATA,
|
||||||
DisplayWidgetTypesPanelComponent,
|
DisplayWidgetTypesPanelComponent,
|
||||||
DisplayWidgetTypesPanelData,
|
DisplayWidgetTypesPanelData
|
||||||
WidgetTypes
|
|
||||||
} from '@home/components/dashboard-page/widget-types-panel.component';
|
} from '@home/components/dashboard-page/widget-types-panel.component';
|
||||||
import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component';
|
import { DashboardWidgetSelectComponent } from '@home/components/dashboard-page/dashboard-widget-select.component';
|
||||||
|
|
||||||
@ -1183,13 +1181,16 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
|||||||
overlayRef.dispose();
|
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[] = [
|
const providers: StaticProvider[] = [
|
||||||
{
|
{
|
||||||
provide: DISPLAY_WIDGET_TYPES_PANEL_DATA,
|
provide: DISPLAY_WIDGET_TYPES_PANEL_DATA,
|
||||||
useValue: {
|
useValue: {
|
||||||
types: Array.from(this.dashboardWidgetSelectComponent.widgetTypes.values()).map(type => {
|
types: widgetTypesList,
|
||||||
return {type, display: true};
|
|
||||||
}),
|
|
||||||
typesUpdated: (newTypes) => {
|
typesUpdated: (newTypes) => {
|
||||||
this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type);
|
this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,6 +77,10 @@ export class DashboardWidgetSelectComponent implements OnInit {
|
|||||||
this.filterWidgetTypes$.next(widgetTypes);
|
this.filterWidgetTypes$.next(widgetTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get filterWidgetTypes(): Array<widgetType> {
|
||||||
|
return this.filterWidgetTypes$.value;
|
||||||
|
}
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
widgetSelected: EventEmitter<WidgetInfo> = new EventEmitter<WidgetInfo>();
|
widgetSelected: EventEmitter<WidgetInfo> = new EventEmitter<WidgetInfo>();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user