Refactoring

This commit is contained in:
Kalutka Zhenya 2021-04-28 11:30:10 +03:00
parent 501df2504c
commit 23ece9c247
2 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@
</mat-toolbar>
<mat-tab-group [ngClass]="{'tb-headless': sources.length === 1}" fxFlex
[(selectedIndex)]="sourceIndex" (selectedIndexChange)="onSourceIndexChanged()">
<mat-tab *ngFor="let source of sources; trackBy: trackBySourcesIndex; let index = index;" label="{{getTabLabel(source, this.useDeviceLabel)}}">
<mat-tab *ngFor="let source of sources; trackBy: trackBySourcesIndex; let index = index;" label="{{getTabLabel(source)}}">
<ng-template [ngIf]="isActiveTab(index)">
<div fxFlex class="table-container">
<table mat-table [dataSource]="source.timeseriesDatasource" [trackBy]="trackByRowTimestamp"

View File

@ -129,7 +129,7 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
private defaultSortOrder = '-0';
private hideEmptyLines = false;
public showTimestamp = true;
public useDeviceLabel = false;
private useDeviceLabel = false;
private dateFormatFilter: string;
private rowStylesInfo: RowStyleInfo;
@ -234,9 +234,9 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
this.updateDatasources();
}
public getTabLabel(source, useDeviceLabel){
if(useDeviceLabel){
return source.datasource.entityLabel ? source.datasource.entityLabel : source.datasource.entityName;
public getTabLabel(source){
if(this.useDeviceLabel){
return source.datasource.entityLabel || source.datasource.entityName;
} else {
return source.datasource.entityName;
}