Skip to content

Commit 4f74e37

Browse files
Kuliakxflord
authored andcommitted
fix(admin): entityless attributes key-value pairs correctly displayed
* fixed problem when adding new key-value pair for attribute definition, table was not rendered (loaded) properly - missing newly prepared row * checkboxes fixed * mat-sort-header keyword removed from table headers (for now)
1 parent 63e5ff9 commit 4f74e37

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ <h1 mat-dialog-title>{{this.attDef.namespace + ':' + this.attDef.friendlyName}}<
6262
</ng-container>
6363

6464
<ng-container matColumnDef="key">
65-
<th *matHeaderCellDef mat-header-cell mat-sort-header>
65+
<th *matHeaderCellDef mat-header-cell>
6666
{{'SHARED.COMPONENTS.ENTITYLESS_ATTRIBUTES_LIST.KEY' | translate}}
6767
</th>
6868
<td *matCellDef="let record" mat-cell>
@@ -77,7 +77,7 @@ <h1 mat-dialog-title>{{this.attDef.namespace + ':' + this.attDef.friendlyName}}<
7777
</td>
7878
</ng-container>
7979
<ng-container matColumnDef="value">
80-
<th *matHeaderCellDef mat-header-cell mat-sort-header>
80+
<th *matHeaderCellDef mat-header-cell>
8181
{{'SHARED.COMPONENTS.ENTITYLESS_ATTRIBUTES_LIST.VALUE' | translate}}
8282
</th>
8383
<td *matCellDef="let record" mat-cell>

apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
AfterViewInit,
3+
ChangeDetectorRef,
34
Component,
45
EventEmitter,
56
Inject,
@@ -62,7 +63,8 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
6263
@Inject(MAT_DIALOG_DATA) public data: EntitylessAttributeKeysListData,
6364
private notificator: NotificatorService,
6465
private translate: TranslateService,
65-
private attributesManager: AttributesManagerService
66+
private attributesManager: AttributesManagerService,
67+
private cd: ChangeDetectorRef
6668
) {}
6769

6870
@ViewChild(MatSort, { static: true }) set matSort(ms: MatSort) {
@@ -119,6 +121,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
119121
}
120122
this.selection.clear();
121123
this.isAddButtonDisabled = false;
124+
this.cd.detectChanges();
122125
}
123126

124127
onRemove(): void {
@@ -135,6 +138,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
135138
this.ngOnInit();
136139
this.selection.clear();
137140
this.isAddButtonDisabled = false;
141+
this.cd.detectChanges();
138142
}
139143

140144
onAdd(): void {
@@ -146,6 +150,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
146150
this.selection.clear();
147151
this.selection.select(rec);
148152
this.isAddButtonDisabled = true;
153+
this.cd.detectChanges();
149154
}
150155

151156
onCancel(): void {
@@ -185,5 +190,6 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
185190
this.child = children.first;
186191
this.dataSource.paginator = this.child.paginator;
187192
});
193+
this.setDataSource();
188194
}
189195
}

libs/perun/services/src/lib/table-checkbox.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export class TableCheckbox {
4141
}
4242
this.pageIterator = 0;
4343

44-
dataSource.sortData(dataSource.filteredData, sort).forEach((row: T) => {
44+
const data = sort
45+
? dataSource.sortData(dataSource.filteredData, sort)
46+
: dataSource.filteredData;
47+
data.forEach((row: T) => {
4548
if (
4649
this.pageStart <= this.pageIterator &&
4750
this.pageIterator < this.pageEnd &&

0 commit comments

Comments
 (0)