Browse Source

Merge pull request #4844 from vvlladd28/bug/widget-select/widget-filter-type/not-update

UI: Fixed work 'widget filter type' after migrating dashboard - change detection OnPush
pull/4851/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
8a2cf167a6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts
  2. 6
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts

3
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() {

6
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<WidgetsBundle> = new EventEmitter<WidgetsBundle>();
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;
}),

Loading…
Cancel
Save