Browse Source

UI: Improvement alarm widget and fixed timeseries

pull/3606/head
Vladyslav_Prykhodko 6 years ago
parent
commit
47d5aee3dc
  1. 6
      ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts
  2. 2
      ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts
  3. 22
      ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts

6
ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts

@ -29,7 +29,7 @@ import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
import { WidgetAction, WidgetContext } from '@home/models/widget-component.models'; 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 { IWidgetSubscription } from '@core/api/widget-api.models';
import { UtilsService } from '@core/services/utils.service'; import { UtilsService } from '@core/services/utils.service';
import { TranslateService } from '@ngx-translate/core'; 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)); this.displayedColumns.push(...this.columns.map(column => column.def));
} }
if (this.settings.defaultSortOrder && this.settings.defaultSortOrder.length) { 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); this.pageLink.sortOrder = entityDataSortOrderFromString(this.defaultSortOrder, this.columns);
let sortColumn: EntityColumn; let sortColumn: EntityColumn;
@ -959,7 +959,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> {
} }
} }
} }
alarm[dataKey.name] = value; alarm[dataKey.label] = value;
}); });
return alarm; return alarm;
} }

2
ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts

@ -189,7 +189,7 @@ export function getAlarmValue(alarm: AlarmDataInfo, key: EntityColumn) {
if (alarmField) { if (alarmField) {
return getDescendantProp(alarm, alarmField.value); return getDescendantProp(alarm, alarmField.value);
} else { } else {
return getDescendantProp(alarm, key.name); return getDescendantProp(alarm, key.label);
} }
} }

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

@ -524,16 +524,22 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
}); });
} }
const rows: TimeseriesRow[] = []; let rows: TimeseriesRow[] = [];
if (this.hideEmptyLines) {
for (const value of Object.values(rowsMap)) { for (const t of Object.keys(rowsMap)) {
if (this.hideEmptyLines && isDefinedAndNotNull(value[1])) { let hideLine = true;
rows.push(value); for (let c = 0; (c < data.length) && hideLine; c++) {
} else { if (rowsMap[t][c + 1]) {
rows.push(value); hideLine = false;
}
}
if (!hideLine) {
rows.push(rowsMap[t]);
}
} }
} else {
rows = Object.values(rowsMap);
} }
return rows; return rows;
} }

Loading…
Cancel
Save