Skip to content

Commit 40a6a08

Browse files
committed
fix(admin): sort attributes list by display name
* attributes and attribute definition lists are now sorted by display name by default * added display name column to admin attribute definitions list * the mentioned lists now display 25 entities on one page by default * fixed the personal preferred table page size config (changes didn't take effect correctly before)
1 parent 4f39543 commit 40a6a08

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class="w-100"
1212
mat-table
1313
matSort
14-
matSortActive="id"
14+
matSortActive="displayName"
1515
matSortDirection="asc"
1616
matSortDisableClear>
1717
<ng-container
@@ -58,6 +58,14 @@
5858
{{attrDef.friendlyName}}
5959
</td>
6060
</ng-container>
61+
<ng-container matColumnDef="displayName">
62+
<th *matHeaderCellDef mat-header-cell mat-sort-header>
63+
{{'ADMIN.ATTRIBUTES.TABLE_ATTR_DISPLAY_NAME' | translate}}
64+
</th>
65+
<td mat-cell *matCellDef="let attribute">
66+
{{attribute.displayName}}
67+
</td>
68+
</ng-container>
6169
<ng-container matColumnDef="entity">
6270
<th *matHeaderCellDef mat-header-cell mat-sort-header>
6371
{{'ADMIN.ATTRIBUTES.TABLE_ATTR_ENTITY' | translate}}

apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class AttrDefListComponent implements OnChanges, AfterViewInit {
4040
'select',
4141
'id',
4242
'friendlyName',
43+
'displayName',
4344
'entity',
4445
'namespace',
4546
'type',
@@ -79,6 +80,8 @@ export class AttrDefListComponent implements OnChanges, AfterViewInit {
7980
return data.id.toString();
8081
case 'friendlyName':
8182
return data.friendlyName;
83+
case 'displayName':
84+
return data.displayName;
8285
case 'entity':
8386
return data.entity;
8487
case 'namespace':

apps/admin-gui/src/app/users/pages/user-detail-page/user-settings/user-settings-app-configuration/user-settings-app-configuration.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ <h1 class="page-subtitle">{{'USER_DETAIL.SETTINGS.GUI_CONFIG.TITLE' | translate}
22
<div class="col-12 col-lg-6 p-0">
33
<mat-form-field class="w-100">
44
<mat-label>{{'USER_DETAIL.SETTINGS.GUI_CONFIG.PREF_TABLE_PAGE_SIZE' | translate}}</mat-label>
5-
<mat-select (valueChange)="updatePreferredTablePageSize()" [(value)]="preferredTablePageSize">
5+
<mat-select [(value)]="preferredTablePageSize" (valueChange)="updatePreferredTablePageSize()">
66
<mat-option *ngFor="let value of tablePageSizeOptions" [value]="value">
77
{{value}}
88
</mat-option>

apps/admin-gui/src/assets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,6 +2356,7 @@
23562356
"TITLE": "Attribute definitions",
23572357
"TABLE_ATTR_ID": "Id",
23582358
"TABLE_ATTR_FRIENDLY_NAME": "Friendly name",
2359+
"TABLE_ATTR_DISPLAY_NAME": "Display name",
23592360
"TABLE_ATTR_ENTITY": "Entity",
23602361
"TABLE_ATTR_DEF": "Def",
23612362
"TABLE_ATTR_TYPE": "Type",

libs/config/table-config/src/lib/table-config.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { GUIConfigService, LS_TABLE_PREFIX, PREF_PAGE_SIZE } from './guiconfig.s
55
providedIn: 'root',
66
})
77
export class TableConfigService {
8-
constructor(private guiConfigService: GUIConfigService) {}
8+
defaultTableSizes = new Map<string, number>();
9+
constructor(private guiConfigService: GUIConfigService) {
10+
this.defaultTableSizes.set(TABLE_ATTRIBUTES_SETTINGS, 25);
11+
this.defaultTableSizes.set(TABLE_ADMIN_ATTRIBUTES, 25);
12+
}
913

1014
getTablePageSize(tableId: string): number {
1115
const tablePref = this.guiConfigService.getNumber(LS_TABLE_PREFIX + tableId);
@@ -17,7 +21,7 @@ export class TableConfigService {
1721
return pref;
1822
}
1923

20-
return 10;
24+
return this.defaultTableSizes.get(tableId) ?? 10;
2125
}
2226

2327
setTablePageSize(tableId: string, value: number): void {

libs/perun/components/src/lib/attributes-list/attributes-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
mat-table
1010
[dataSource]="dataSource"
1111
matSort
12-
matSortActive="id"
12+
matSortActive="displayName"
1313
matSortDirection="asc"
1414
matSortDisableClear
1515
class="w-100">

0 commit comments

Comments
 (0)