Commit 47d5aee3dc4a3d88b54e06f814443e34ff4afd05

Authored by Vladyslav_Prykhodko
1 parent f73b05a8

UI: Improvement alarm widget and fixed timeseries

@@ -29,7 +29,7 @@ import { PageComponent } from '@shared/components/page.component'; @@ -29,7 +29,7 @@ import { PageComponent } from '@shared/components/page.component';
29 import { Store } from '@ngrx/store'; 29 import { Store } from '@ngrx/store';
30 import { AppState } from '@core/core.state'; 30 import { AppState } from '@core/core.state';
31 import { WidgetAction, WidgetContext } from '@home/models/widget-component.models'; 31 import { WidgetAction, WidgetContext } from '@home/models/widget-component.models';
32 -import { DataKey, Datasource, WidgetActionDescriptor, WidgetConfig } from '@shared/models/widget.models'; 32 +import { DataKey, WidgetActionDescriptor, WidgetConfig } from '@shared/models/widget.models';
33 import { IWidgetSubscription } from '@core/api/widget-api.models'; 33 import { IWidgetSubscription } from '@core/api/widget-api.models';
34 import { UtilsService } from '@core/services/utils.service'; 34 import { UtilsService } from '@core/services/utils.service';
35 import { TranslateService } from '@ngx-translate/core'; 35 import { TranslateService } from '@ngx-translate/core';
@@ -394,7 +394,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, @@ -394,7 +394,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
394 this.displayedColumns.push(...this.columns.map(column => column.def)); 394 this.displayedColumns.push(...this.columns.map(column => column.def));
395 } 395 }
396 if (this.settings.defaultSortOrder && this.settings.defaultSortOrder.length) { 396 if (this.settings.defaultSortOrder && this.settings.defaultSortOrder.length) {
397 - this.defaultSortOrder = this.settings.defaultSortOrder; 397 + this.defaultSortOrder = this.utils.customTranslation(this.settings.defaultSortOrder, this.settings.defaultSortOrder);
398 } 398 }
399 this.pageLink.sortOrder = entityDataSortOrderFromString(this.defaultSortOrder, this.columns); 399 this.pageLink.sortOrder = entityDataSortOrderFromString(this.defaultSortOrder, this.columns);
400 let sortColumn: EntityColumn; 400 let sortColumn: EntityColumn;
@@ -959,7 +959,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> { @@ -959,7 +959,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> {
959 } 959 }
960 } 960 }
961 } 961 }
962 - alarm[dataKey.name] = value; 962 + alarm[dataKey.label] = value;
963 }); 963 });
964 return alarm; 964 return alarm;
965 } 965 }
@@ -189,7 +189,7 @@ export function getAlarmValue(alarm: AlarmDataInfo, key: EntityColumn) { @@ -189,7 +189,7 @@ export function getAlarmValue(alarm: AlarmDataInfo, key: EntityColumn) {
189 if (alarmField) { 189 if (alarmField) {
190 return getDescendantProp(alarm, alarmField.value); 190 return getDescendantProp(alarm, alarmField.value);
191 } else { 191 } else {
192 - return getDescendantProp(alarm, key.name); 192 + return getDescendantProp(alarm, key.label);
193 } 193 }
194 } 194 }
195 195
@@ -524,16 +524,22 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> { @@ -524,16 +524,22 @@ class TimeseriesDatasource implements DataSource<TimeseriesRow> {
524 }); 524 });
525 } 525 }
526 526
527 - const rows: TimeseriesRow[] = [];  
528 -  
529 - for (const value of Object.values(rowsMap)) {  
530 - if (this.hideEmptyLines && isDefinedAndNotNull(value[1])) {  
531 - rows.push(value);  
532 - } else {  
533 - rows.push(value); 527 + let rows: TimeseriesRow[] = [];
  528 + if (this.hideEmptyLines) {
  529 + for (const t of Object.keys(rowsMap)) {
  530 + let hideLine = true;
  531 + for (let c = 0; (c < data.length) && hideLine; c++) {
  532 + if (rowsMap[t][c + 1]) {
  533 + hideLine = false;
  534 + }
  535 + }
  536 + if (!hideLine) {
  537 + rows.push(rowsMap[t]);
  538 + }
534 } 539 }
  540 + } else {
  541 + rows = Object.values(rowsMap);
535 } 542 }
536 -  
537 return rows; 543 return rows;
538 } 544 }
539 545