Merge pull request #5245 from vvlladd28/bug/timeseries-table/updated-data-fullscreen

[3.3.2] UI: Fixed not updating data in Timeseries table in full screen mode
This commit is contained in:
Andrew Shvayka 2021-09-15 17:51:20 +03:00 committed by GitHub
commit bba989e8ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,6 @@ import {
Component, Component,
ElementRef, ElementRef,
Input, Input,
NgZone,
OnInit, OnInit,
QueryList, QueryList,
ViewChild, ViewChild,
@ -59,7 +58,8 @@ import {
getCellStyleInfo, getCellStyleInfo,
getRowStyleInfo, getRowStyleInfo,
RowStyleInfo, RowStyleInfo,
TableWidgetDataKeySettings, TableWidgetSettings TableWidgetDataKeySettings,
TableWidgetSettings
} from '@home/components/widget/lib/table-widget.models'; } from '@home/components/widget/lib/table-widget.models';
import { Overlay } from '@angular/cdk/overlay'; import { Overlay } from '@angular/cdk/overlay';
import { SubscriptionEntityInfo } from '@core/api/widget-api.models'; import { SubscriptionEntityInfo } from '@core/api/widget-api.models';
@ -151,7 +151,6 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
private elementRef: ElementRef, private elementRef: ElementRef,
private ngZone: NgZone,
private overlay: Overlay, private overlay: Overlay,
private viewContainerRef: ViewContainerRef, private viewContainerRef: ViewContainerRef,
private utils: UtilsService, private utils: UtilsService,
@ -199,6 +198,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
public onDataUpdated() { public onDataUpdated() {
this.updateCurrentSourceData(); this.updateCurrentSourceData();
this.clearCache(); this.clearCache();
this.ctx.detectChanges();
} }
private initialize() { private initialize() {
@ -291,7 +291,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
if (this.actionCellDescriptors.length) { if (this.actionCellDescriptors.length) {
source.displayedColumns.push('actions'); source.displayedColumns.push('actions');
} }
const tsDatasource = new TimeseriesDatasource(source, this.hideEmptyLines, this.dateFormatFilter, this.datePipe, this.ngZone); const tsDatasource = new TimeseriesDatasource(source, this.hideEmptyLines, this.dateFormatFilter, this.datePipe);
tsDatasource.dataUpdated(this.data); tsDatasource.dataUpdated(this.data);
this.sources.push(source); this.sources.push(source);
} }
@ -574,8 +574,7 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
private source: TimeseriesTableSource, private source: TimeseriesTableSource,
private hideEmptyLines: boolean, private hideEmptyLines: boolean,
private dateFormatFilter: string, private dateFormatFilter: string,
private datePipe: DatePipe, private datePipe: DatePipe
private ngZone: NgZone
) { ) {
this.source.timeseriesDatasource = this; this.source.timeseriesDatasource = this;
} }
@ -598,10 +597,8 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
catchError(() => of(emptyPageData<TimeseriesRow>())), catchError(() => of(emptyPageData<TimeseriesRow>())),
).subscribe( ).subscribe(
(pageData) => { (pageData) => {
this.ngZone.run(() => {
this.rowsSubject.next(pageData.data); this.rowsSubject.next(pageData.data);
this.pageDataSubject.next(pageData); this.pageDataSubject.next(pageData);
});
} }
); );
} }