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 | 119 | </mat-cell> |
120 | 120 | </ng-container> |
121 | 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 | 123 | 'mat-selected': alarmsDatasource.isSelected(alarm), |
124 | 124 | 'tb-current-entity': alarmsDatasource.isCurrentAlarm(alarm)}" |
125 | 125 | *matRowDef="let alarm; columns: displayedColumns;" | ... | ... |
... | ... | @@ -368,7 +368,12 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, |
368 | 368 | dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label); |
369 | 369 | dataKey.def = 'def' + this.columns.length; |
370 | 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 | 377 | this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings); |
373 | 378 | this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, alarm, ctx'); |
374 | 379 | this.columnWidth[dataKey.def] = getColumnWidth(keySettings); |
... | ... | @@ -863,7 +868,7 @@ class AlarmsDatasource implements DataSource<AlarmDataInfo> { |
863 | 868 | |
864 | 869 | loadAlarms(pageLink: AlarmDataPageLink, sortOrderLabel: string, keyFilters: KeyFilter[]) { |
865 | 870 | this.dataLoading = true; |
866 | - this.clear(); | |
871 | + // this.clear(); | |
867 | 872 | this.appliedPageLink = pageLink; |
868 | 873 | this.appliedSortOrderLabel = sortOrderLabel; |
869 | 874 | this.subscription.subscribeForAlarms(pageLink, keyFilters); | ... | ... |
... | ... | @@ -82,7 +82,7 @@ |
82 | 82 | </mat-cell> |
83 | 83 | </ng-container> |
84 | 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 | 86 | *matRowDef="let entity; columns: displayedColumns;" |
87 | 87 | (click)="onRowClick($event, entity)" (dblclick)="onRowClick($event, entity, true)"></mat-row> |
88 | 88 | </table> | ... | ... |
... | ... | @@ -87,6 +87,7 @@ import { |
87 | 87 | import { sortItems } from '@shared/models/page/page-link'; |
88 | 88 | import { entityFields } from '@shared/models/entity.models'; |
89 | 89 | import { DatePipe } from '@angular/common'; |
90 | +import { alarmFields } from '@shared/models/alarm.models'; | |
90 | 91 | |
91 | 92 | interface EntitiesTableWidgetSettings extends TableWidgetSettings { |
92 | 93 | entitiesTitle: string; |
... | ... | @@ -348,6 +349,13 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni |
348 | 349 | dataKey.title = this.utils.customTranslation(dataKey.label, dataKey.label); |
349 | 350 | dataKey.def = 'def' + this.columns.length; |
350 | 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 | 360 | this.stylesInfo[dataKey.def] = getCellStyleInfo(keySettings); |
353 | 361 | this.contentsInfo[dataKey.def] = getCellContentInfo(keySettings, 'value, entity, ctx'); |
... | ... | @@ -595,7 +603,7 @@ class EntityDatasource implements DataSource<EntityData> { |
595 | 603 | |
596 | 604 | loadEntities(pageLink: EntityDataPageLink, sortOrderLabel: string, keyFilters: KeyFilter[]) { |
597 | 605 | this.dataLoading = true; |
598 | - this.clear(); | |
606 | + // this.clear(); | |
599 | 607 | this.appliedPageLink = pageLink; |
600 | 608 | this.appliedSortOrderLabel = sortOrderLabel; |
601 | 609 | this.subscription.subscribeForPaginatedData(0, pageLink, keyFilters); | ... | ... |