Browse Source

UI: Fixed default column visibility for timeseries table

pull/10012/head
Artem Dzhereleiko 3 years ago
parent
commit
eb93411b7d
  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) { if (this.sources.length) {
this.prepareDisplayedColumn(); this.sources.forEach((source, index) => {
this.sources[this.sourceIndex].displayedColumns = this.prepareDisplayedColumn(index);
this.displayedColumns[this.sourceIndex].filter(value => value.display).map(value => value.def); source.displayedColumns = this.displayedColumns[index].filter(value => value.display).map(value => value.def);
});
} }
this.updateActiveEntityInfo(); this.updateActiveEntityInfo();
} }
@ -438,8 +439,6 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
const source = this.sources[this.sourceIndex]; const source = this.sources[this.sourceIndex];
this.prepareDisplayedColumn();
const providers: StaticProvider[] = [ const providers: StaticProvider[] = [
{ {
provide: DISPLAY_COLUMNS_PANEL_DATA, provide: DISPLAY_COLUMNS_PANEL_DATA,
@ -472,11 +471,11 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
} }
} }
private prepareDisplayedColumn() { private prepareDisplayedColumn(index: number) {
if (!this.displayedColumns[this.sourceIndex]) { if (!this.displayedColumns[index]) {
this.displayedColumns[this.sourceIndex] = this.sources[this.sourceIndex].displayedColumns.map(value => { this.displayedColumns[index] = this.sources[index].displayedColumns.map(value => {
let title = ''; 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') { if (value === '0') {
title = 'Timestamp'; title = 'Timestamp';
} else if (value === 'actions') { } else if (value === 'actions') {

Loading…
Cancel
Save