From bbc4dd7dd8056ac92c12d5d5be3df83699f5ec55 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 1 Jul 2021 17:41:41 +0300 Subject: [PATCH] UI: Fixed work 'widget filter type' after migrating dashboard - change detection OnPush --- .../components/dashboard-page/dashboard-page.component.ts | 3 ++- .../dashboard-page/dashboard-widget-select.component.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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 5f3478bccc..e77b6a461e 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 @@ -1298,6 +1298,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC types: widgetTypesList, typesUpdated: (newTypes) => { this.filterWidgetTypes = newTypes.filter(type => type.display).map(type => type.type); + this.cd.markForCheck(); } } as DisplayWidgetTypesPanelData }, @@ -1308,7 +1309,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC ]; const injector = Injector.create({parent: this.viewContainerRef.injector, providers}); overlayRef.attach(new ComponentPortal(DisplayWidgetTypesPanelComponent, this.viewContainerRef, injector)); - this.cd.detectChanges(); + this.cd.markForCheck(); } onCloseSearchBundle() { 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 645d955deb..bcc239eab0 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 @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { WidgetsBundle } from '@shared/models/widgets-bundle.model'; import { IAliasController } from '@core/api/widget-api.models'; import { NULL_UUID } from '@shared/models/id/has-uuid'; @@ -88,7 +88,8 @@ export class DashboardWidgetSelectComponent implements OnInit { widgetsBundleSelected: EventEmitter = new EventEmitter(); constructor(private widgetsService: WidgetService, - private sanitizer: DomSanitizer) { + private sanitizer: DomSanitizer, + private cd: ChangeDetectorRef) { this.widgetsBundles$ = this.search$.asObservable().pipe( distinctUntilChanged(), switchMap(search => this.fetchWidgetBundle(search)) @@ -128,6 +129,7 @@ export class DashboardWidgetSelectComponent implements OnInit { ); setTimeout(() => { this.widgetTypes = widgetTypes; + this.cd.markForCheck(); }); return widgetInfos; }),