Commit bbc4dd7dd8056ac92c12d5d5be3df83699f5ec55
Committed by
Vladyslav Prykhodko
1 parent
934020d1
UI: Fixed work 'widget filter type' after migrating dashboard - change detection OnPush
Showing
2 changed files
with
6 additions
and
3 deletions
@@ -1298,6 +1298,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -1298,6 +1298,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
1298 | types: widgetTypesList, | 1298 | types: widgetTypesList, |
1299 | typesUpdated: (newTypes) => { | 1299 | typesUpdated: (newTypes) => { |
1300 | this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type); | 1300 | this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type); |
1301 | + this.cd.markForCheck(); | ||
1301 | } | 1302 | } |
1302 | } as DisplayWidgetTypesPanelData | 1303 | } as DisplayWidgetTypesPanelData |
1303 | }, | 1304 | }, |
@@ -1308,7 +1309,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | @@ -1308,7 +1309,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC | ||
1308 | ]; | 1309 | ]; |
1309 | const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); | 1310 | const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); |
1310 | overlayRef.attach(new ComponentPortal(DisplayWidgetTypesPanelComponent, this.viewContainerRef, injector)); | 1311 | overlayRef.attach(new ComponentPortal(DisplayWidgetTypesPanelComponent, this.viewContainerRef, injector)); |
1311 | - this.cd.detectChanges(); | 1312 | + this.cd.markForCheck(); |
1312 | } | 1313 | } |
1313 | 1314 | ||
1314 | onCloseSearchBundle() { | 1315 | onCloseSearchBundle() { |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | /// limitations under the License. | 14 | /// limitations under the License. |
15 | /// | 15 | /// |
16 | 16 | ||
17 | -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | 17 | +import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; |
18 | import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; | 18 | import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; |
19 | import { IAliasController } from '@core/api/widget-api.models'; | 19 | import { IAliasController } from '@core/api/widget-api.models'; |
20 | import { NULL_UUID } from '@shared/models/id/has-uuid'; | 20 | import { NULL_UUID } from '@shared/models/id/has-uuid'; |
@@ -88,7 +88,8 @@ export class DashboardWidgetSelectComponent implements OnInit { | @@ -88,7 +88,8 @@ export class DashboardWidgetSelectComponent implements OnInit { | ||
88 | widgetsBundleSelected: EventEmitter<WidgetsBundle> = new EventEmitter<WidgetsBundle>(); | 88 | widgetsBundleSelected: EventEmitter<WidgetsBundle> = new EventEmitter<WidgetsBundle>(); |
89 | 89 | ||
90 | constructor(private widgetsService: WidgetService, | 90 | constructor(private widgetsService: WidgetService, |
91 | - private sanitizer: DomSanitizer) { | 91 | + private sanitizer: DomSanitizer, |
92 | + private cd: ChangeDetectorRef) { | ||
92 | this.widgetsBundles$ = this.search$.asObservable().pipe( | 93 | this.widgetsBundles$ = this.search$.asObservable().pipe( |
93 | distinctUntilChanged(), | 94 | distinctUntilChanged(), |
94 | switchMap(search => this.fetchWidgetBundle(search)) | 95 | switchMap(search => this.fetchWidgetBundle(search)) |
@@ -128,6 +129,7 @@ export class DashboardWidgetSelectComponent implements OnInit { | @@ -128,6 +129,7 @@ export class DashboardWidgetSelectComponent implements OnInit { | ||
128 | ); | 129 | ); |
129 | setTimeout(() => { | 130 | setTimeout(() => { |
130 | this.widgetTypes = widgetTypes; | 131 | this.widgetTypes = widgetTypes; |
132 | + this.cd.markForCheck(); | ||
131 | }); | 133 | }); |
132 | return widgetInfos; | 134 | return widgetInfos; |
133 | }), | 135 | }), |