Commit 4bc1f2bd0d490c719888cc423ef57c5f4b3edde2
1 parent
6ddf0a63
UI: Entities and alarm tables improvements
Showing
4 changed files
with
18 additions
and
5 deletions
@@ -119,7 +119,7 @@ | @@ -119,7 +119,7 @@ | ||
119 | </mat-cell> | 119 | </mat-cell> |
120 | </ng-container> | 120 | </ng-container> |
121 | <mat-header-row [ngClass]="{'mat-row-select': enableSelection}" *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row> | 121 | <mat-header-row [ngClass]="{'mat-row-select': enableSelection}" *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row> |
122 | - <mat-row [ngClass]="{'mat-row-select': enableSelection, | 122 | + <mat-row [fxShow]="!alarmsDatasource.dataLoading" [ngClass]="{'mat-row-select': enableSelection, |
123 | 'mat-selected': alarmsDatasource.isSelected(alarm), | 123 | 'mat-selected': alarmsDatasource.isSelected(alarm), |
124 | 'tb-current-entity': alarmsDatasource.isCurrentAlarm(alarm)}" | 124 | 'tb-current-entity': alarmsDatasource.isCurrentAlarm(alarm)}" |
125 | *matRowDef="let alarm; columns: displayedColumns;" | 125 | *matRowDef="let alarm; columns: displayedColumns;" |
@@ -368,7 +368,12 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, | @@ -368,7 +368,12 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, | ||
368 | dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label); | 368 | dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label); |
369 | dataKey.def = 'def' + this.columns.length; | 369 | dataKey.def = 'def' + this.columns.length; |
370 | const keySettings: TableWidgetDataKeySettings = dataKey.settings; | 370 | const keySettings: TableWidgetDataKeySettings = dataKey.settings; |
371 | - | 371 | + if (dataKey.type === DataKeyType.alarm && !isDefined(keySettings.columnWidth)) { |
372 | + const alarmField = alarmFields[dataKey.name]; | ||
373 | + if (alarmField && alarmField.time) { | ||
374 | + keySettings.columnWidth = '120px'; | ||
375 | + } | ||
376 | + } | ||
372 | this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings); | 377 | this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings); |
373 | this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, alarm, ctx'); | 378 | this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, alarm, ctx'); |
374 | this.columnWidth[dataKey.def] = getColumnWidth(keySettings); | 379 | this.columnWidth[dataKey.def] = getColumnWidth(keySettings); |
@@ -863,7 +868,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> { | @@ -863,7 +868,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> { | ||
863 | 868 | ||
864 | loadAlarms(pageLink: AlarmDataPageLink, sortOrderLabel: string, keyFilters: KeyFilter[]) { | 869 | loadAlarms(pageLink: AlarmDataPageLink, sortOrderLabel: string, keyFilters: KeyFilter[]) { |
865 | this.dataLoading = true; | 870 | this.dataLoading = true; |
866 | - this.clear(); | 871 | + // this.clear(); |
867 | this.appliedPageLink = pageLink; | 872 | this.appliedPageLink = pageLink; |
868 | this.appliedSortOrderLabel = sortOrderLabel; | 873 | this.appliedSortOrderLabel = sortOrderLabel; |
869 | this.subscription.subscribeForAlarms(pageLink, keyFilters); | 874 | this.subscription.subscribeForAlarms(pageLink, keyFilters); |
@@ -82,7 +82,7 @@ | @@ -82,7 +82,7 @@ | ||
82 | </mat-cell> | 82 | </mat-cell> |
83 | </ng-container> | 83 | </ng-container> |
84 | <mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row> | 84 | <mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></mat-header-row> |
85 | - <mat-row [ngClass]="{'tb-current-entity': entityDatasource.isCurrentEntity(entity)}" | 85 | + <mat-row [fxShow]="!entityDatasource.dataLoading" [ngClass]="{'tb-current-entity': entityDatasource.isCurrentEntity(entity)}" |
86 | *matRowDef="let entity; columns: displayedColumns;" | 86 | *matRowDef="let entity; columns: displayedColumns;" |
87 | (click)="onRowClick($event, entity)" (dblclick)="onRowClick($event, entity, true)"></mat-row> | 87 | (click)="onRowClick($event, entity)" (dblclick)="onRowClick($event, entity, true)"></mat-row> |
88 | </table> | 88 | </table> |
@@ -87,6 +87,7 @@ import { | @@ -87,6 +87,7 @@ import { | ||
87 | import { sortItems } from '@shared/models/page/page-link'; | 87 | import { sortItems } from '@shared/models/page/page-link'; |
88 | import { entityFields } from '@shared/models/entity.models'; | 88 | import { entityFields } from '@shared/models/entity.models'; |
89 | import { DatePipe } from '@angular/common'; | 89 | import { DatePipe } from '@angular/common'; |
90 | +import { alarmFields } from '@shared/models/alarm.models'; | ||
90 | 91 | ||
91 | interface EntitiesTableWidgetSettings extends TableWidgetSettings { | 92 | interface EntitiesTableWidgetSettings extends TableWidgetSettings { |
92 | entitiesTitle: string; | 93 | entitiesTitle: string; |
@@ -348,6 +349,13 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni | @@ -348,6 +349,13 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni | ||
348 | dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label); | 349 | dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label); |
349 | dataKey.def = 'def' + this.columns.length; | 350 | dataKey.def = 'def' + this.columns.length; |
350 | const keySettings: TableWidgetDataKeySettings = dataKey.settings; | 351 | const keySettings: TableWidgetDataKeySettings = dataKey.settings; |
352 | + if (dataKey.type === DataKeyType.entityField && | ||
353 | + !isDefined(keySettings.columnWidth) || keySettings.columnWidth === '0px') { | ||
354 | + const entityField = entityFields[dataKey.name]; | ||
355 | + if (entityField && entityField.time) { | ||
356 | + keySettings.columnWidth = '120px'; | ||
357 | + } | ||
358 | + } | ||
351 | 359 | ||
352 | this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings); | 360 | this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings); |
353 | this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, entity, ctx'); | 361 | this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, entity, ctx'); |
@@ -595,7 +603,7 @@ class EntityDatasource implements DataSource<EntityData> { | @@ -595,7 +603,7 @@ class EntityDatasource implements DataSource<EntityData> { | ||
595 | 603 | ||
596 | loadEntities(pageLink: EntityDataPageLink, sortOrderLabel: string, keyFilters: KeyFilter[]) { | 604 | loadEntities(pageLink: EntityDataPageLink, sortOrderLabel: string, keyFilters: KeyFilter[]) { |
597 | this.dataLoading = true; | 605 | this.dataLoading = true; |
598 | - this.clear(); | 606 | + // this.clear(); |
599 | this.appliedPageLink = pageLink; | 607 | this.appliedPageLink = pageLink; |
600 | this.appliedSortOrderLabel = sortOrderLabel; | 608 | this.appliedSortOrderLabel = sortOrderLabel; |
601 | this.subscription.subscribeForPaginatedData(0, pageLink, keyFilters); | 609 | this.subscription.subscribeForPaginatedData(0, pageLink, keyFilters); |