UI: Improvement alarm widget and fixed timeseries
This commit is contained in:
parent
f73b05a82a
commit
47d5aee3dc
@ -29,7 +29,7 @@ import { PageComponent } from '@shared/components/page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState } from '@core/core.state';
|
||||
import { WidgetAction, WidgetContext } from '@home/models/widget-component.models';
|
||||
import { DataKey, Datasource, WidgetActionDescriptor, WidgetConfig } from '@shared/models/widget.models';
|
||||
import { DataKey, WidgetActionDescriptor, WidgetConfig } from '@shared/models/widget.models';
|
||||
import { IWidgetSubscription } from '@core/api/widget-api.models';
|
||||
import { UtilsService } from '@core/services/utils.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@ -394,7 +394,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
|
||||
this.displayedColumns.push(...this.columns.map(column => column.def));
|
||||
}
|
||||
if (this.settings.defaultSortOrder && this.settings.defaultSortOrder.length) {
|
||||
this.defaultSortOrder = this.settings.defaultSortOrder;
|
||||
this.defaultSortOrder = this.utils.customTranslation(this.settings.defaultSortOrder, this.settings.defaultSortOrder);
|
||||
}
|
||||
this.pageLink.sortOrder = entityDataSortOrderFromString(this.defaultSortOrder, this.columns);
|
||||
let sortColumn: EntityColumn;
|
||||
@ -959,7 +959,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> {
|
||||
}
|
||||
}
|
||||
}
|
||||
alarm[dataKey.name] = value;
|
||||
alarm[dataKey.label] = value;
|
||||
});
|
||||
return alarm;
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ export function getAlarmValue(alarm: AlarmDataInfo, key: EntityColumn) {
|
||||
if (alarmField) {
|
||||
return getDescendantProp(alarm, alarmField.value);
|
||||
} else {
|
||||
return getDescendantProp(alarm, key.name);
|
||||
return getDescendantProp(alarm, key.label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -524,16 +524,22 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
|
||||
});
|
||||
}
|
||||
|
||||
const rows: TimeseriesRow[] = [];
|
||||
|
||||
for (const value of Object.values(rowsMap)) {
|
||||
if (this.hideEmptyLines && isDefinedAndNotNull(value[1])) {
|
||||
rows.push(value);
|
||||
} else {
|
||||
rows.push(value);
|
||||
let rows: TimeseriesRow[] = [];
|
||||
if (this.hideEmptyLines) {
|
||||
for (const t of Object.keys(rowsMap)) {
|
||||
let hideLine = true;
|
||||
for (let c = 0; (c < data.length) && hideLine; c++) {
|
||||
if (rowsMap[t][c + 1]) {
|
||||
hideLine = false;
|
||||
}
|
||||
}
|
||||
if (!hideLine) {
|
||||
rows.push(rowsMap[t]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rows = Object.values(rowsMap);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user