Browse Source

Merge pull request #10012 from ArtemDzhereleiko/AD/bug-fix/time-table/default-column-to-display

Fixed default column visibility for timeseries table widget
pull/10060/head
Igor Kulikov 3 years ago
committed by GitHub
parent
commit
c6d98aa0dc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 17
      ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts

17
ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts

@ -407,9 +407,10 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
}
}
if (this.sources.length) {
this.prepareDisplayedColumn();
this.sources[this.sourceIndex].displayedColumns =
this.displayedColumns[this.sourceIndex].filter(value => value.display).map(value => value.def);
this.sources.forEach((source, index) => {
this.prepareDisplayedColumn(index);
source.displayedColumns = this.displayedColumns[index].filter(value => value.display).map(value => value.def);
});
}
this.updateActiveEntityInfo();
}
@ -438,8 +439,6 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
const source = this.sources[this.sourceIndex];
this.prepareDisplayedColumn();
const providers: StaticProvider[] = [
{
provide: DISPLAY_COLUMNS_PANEL_DATA,
@ -472,11 +471,11 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
}
}
private prepareDisplayedColumn() {
if (!this.displayedColumns[this.sourceIndex]) {
this.displayedColumns[this.sourceIndex] = this.sources[this.sourceIndex].displayedColumns.map(value => {
private prepareDisplayedColumn(index: number) {
if (!this.displayedColumns[index]) {
this.displayedColumns[index] = this.sources[index].displayedColumns.map(value => {
let title = '';
const header = this.sources[this.sourceIndex].header.find(column => column.index.toString() === value);
const header = this.sources[index].header.find(column => column.index.toString() === value);
if (value === '0') {
title = 'Timestamp';
} else if (value === 'actions') {

Loading…
Cancel
Save