From 5c0c444a57af50bcb0aff2060d6c7401be78e071 Mon Sep 17 00:00:00 2001 From: David Flor <493294@mail.muni.cz> Date: Mon, 16 Jan 2023 14:17:35 +0100 Subject: [PATCH 1/5] fix(admin): removed unused import in add-role-dialog.component.ts --- .../dialogs/add-role-dialog/add-role-dialog.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.ts b/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.ts index 193b09189..c3410beaf 100644 --- a/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.ts +++ b/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.ts @@ -14,7 +14,6 @@ import { } from '@perun-web-apps/perun/openapi'; import { SelectionModel } from '@angular/cdk/collections'; import { ToEnrichedFacilityPipe } from '@perun-web-apps/perun/pipes'; -import { UntypedFormControl } from '@angular/forms'; import { ImmediateFilterComponent } from '@perun-web-apps/perun/components'; export interface AddRoleDialogData { From 63e5ff9d2c69ed2efe5fd8abf631b6f6aec4c35b Mon Sep 17 00:00:00 2001 From: David Flor <493294@mail.muni.cz> Date: Thu, 12 Jan 2023 13:08:45 +0100 Subject: [PATCH 2/5] fix(admin): write operation are now correctly critical by default when creating new attribute definition --- .../attribute-critical-operations-toggles.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/perun/components/src/lib/attribute-critical-operations-toggles/attribute-critical-operations-toggles.component.ts b/libs/perun/components/src/lib/attribute-critical-operations-toggles/attribute-critical-operations-toggles.component.ts index 3263a5650..39898b48c 100644 --- a/libs/perun/components/src/lib/attribute-critical-operations-toggles/attribute-critical-operations-toggles.component.ts +++ b/libs/perun/components/src/lib/attribute-critical-operations-toggles/attribute-critical-operations-toggles.component.ts @@ -7,7 +7,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; }) export class AttributeCriticalOperationsTogglesComponent { @Input() readOperation = false; - @Input() writeOperation = false; + @Input() writeOperation = true; @Output() readOperationChanged: EventEmitter = new EventEmitter(); @Output() writeOperationChanged: EventEmitter = new EventEmitter(); } From 4f74e373569426e8ba73e79153cc08d1c55a6f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDuboslav=20Halama?= Date: Tue, 17 Jan 2023 15:36:26 +0100 Subject: [PATCH 3/5] 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) --- .../entityless-attribute-keys-list.component.html | 4 ++-- .../entityless-attribute-keys-list.component.ts | 8 +++++++- libs/perun/services/src/lib/table-checkbox.service.ts | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.html b/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.html index 2a4da4f76..8be854f0d 100644 --- a/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.html +++ b/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.html @@ -62,7 +62,7 @@

{{this.attDef.namespace + ':' + this.attDef.friendlyName}}< - + {{'SHARED.COMPONENTS.ENTITYLESS_ATTRIBUTES_LIST.KEY' | translate}} @@ -77,7 +77,7 @@

{{this.attDef.namespace + ':' + this.attDef.friendlyName}}< - + {{'SHARED.COMPONENTS.ENTITYLESS_ATTRIBUTES_LIST.VALUE' | translate}} diff --git a/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.ts b/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.ts index 64017ecf7..abe9c884b 100644 --- a/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/entityless-attribute-keys-list/entityless-attribute-keys-list.component.ts @@ -1,5 +1,6 @@ import { AfterViewInit, + ChangeDetectorRef, Component, EventEmitter, Inject, @@ -62,7 +63,8 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit, @Inject(MAT_DIALOG_DATA) public data: EntitylessAttributeKeysListData, private notificator: NotificatorService, private translate: TranslateService, - private attributesManager: AttributesManagerService + private attributesManager: AttributesManagerService, + private cd: ChangeDetectorRef ) {} @ViewChild(MatSort, { static: true }) set matSort(ms: MatSort) { @@ -119,6 +121,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit, } this.selection.clear(); this.isAddButtonDisabled = false; + this.cd.detectChanges(); } onRemove(): void { @@ -135,6 +138,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit, this.ngOnInit(); this.selection.clear(); this.isAddButtonDisabled = false; + this.cd.detectChanges(); } onAdd(): void { @@ -146,6 +150,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit, this.selection.clear(); this.selection.select(rec); this.isAddButtonDisabled = true; + this.cd.detectChanges(); } onCancel(): void { @@ -185,5 +190,6 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit, this.child = children.first; this.dataSource.paginator = this.child.paginator; }); + this.setDataSource(); } } diff --git a/libs/perun/services/src/lib/table-checkbox.service.ts b/libs/perun/services/src/lib/table-checkbox.service.ts index 34f9f3505..1a4e76d76 100644 --- a/libs/perun/services/src/lib/table-checkbox.service.ts +++ b/libs/perun/services/src/lib/table-checkbox.service.ts @@ -41,7 +41,10 @@ export class TableCheckbox { } this.pageIterator = 0; - dataSource.sortData(dataSource.filteredData, sort).forEach((row: T) => { + const data = sort + ? dataSource.sortData(dataSource.filteredData, sort) + : dataSource.filteredData; + data.forEach((row: T) => { if ( this.pageStart <= this.pageIterator && this.pageIterator < this.pageEnd && From 74f311a3922737e41e8b3a969862adca5528ac98 Mon Sep 17 00:00:00 2001 From: David Flor <493294@mail.muni.cz> Date: Mon, 23 Jan 2023 11:08:58 +0100 Subject: [PATCH 4/5] fix: footer loads properly even when RPC version cannot be parsed * fixed a bug where if the call for rpc version returned a different response than expected, a type error would happen and the whole footer would not load --- .../src/lib/perun-footer/perun-footer.component.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/perun/components/src/lib/perun-footer/perun-footer.component.ts b/libs/perun/components/src/lib/perun-footer/perun-footer.component.ts index ffd90c4f7..24eedfc8e 100644 --- a/libs/perun/components/src/lib/perun-footer/perun-footer.component.ts +++ b/libs/perun/components/src/lib/perun-footer/perun-footer.component.ts @@ -5,7 +5,7 @@ import { Component, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ReportIssueDialogComponent } from '../report-issue-dialog/report-issue-dialog.component'; -import { AuthService, InitAuthService, StoreService } from '@perun-web-apps/perun/services'; +import { StoreService } from '@perun-web-apps/perun/services'; import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils'; import { TranslateService } from '@ngx-translate/core'; import { UtilsService } from '@perun-web-apps/perun/openapi'; @@ -30,7 +30,7 @@ export class PerunFooterComponent implements OnInit { githubBackendRepository: string = this.storeService.getProperty('footer').github_backend_releases; bgColor: string = this.storeService.getProperty('theme').footer_bg_color; version = ''; - backendVersion = ''; + backendVersion = 'N/A'; guiVersion = ''; language = 'en'; columnContentHeight = 0; @@ -39,9 +39,7 @@ export class PerunFooterComponent implements OnInit { private storeService: StoreService, private translateService: TranslateService, private utilsService: UtilsService, - private dialog: MatDialog, - private authService: AuthService, - private initAuthService: InitAuthService + private dialog: MatDialog ) {} ngOnInit(): void { @@ -54,7 +52,10 @@ export class PerunFooterComponent implements OnInit { this.guiVersion = require('../../../../../../package.json').version as string; this.utilsService.getPerunRPCVersion(true).subscribe((val) => { - this.backendVersion = val.match('\\bVersion:\\s*([^,\\s]+)')[1]; + const match = val.match('\\bVersion:\\s*([^,\\s]+)'); + if (match !== null) { + this.backendVersion = match[1]; + } }); this.footerColumns = this.storeService.getProperty('footer').columns; From c9a5121745352c5bf76b8d4a61f64019445f9c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDuboslav=20Halama?= Date: Mon, 23 Jan 2023 16:39:44 +0100 Subject: [PATCH 5/5] fix(admin): do not loop in vo groups reloading * usage of filterValue replaced by filter in add-role-dialog * redundant filterValue Input removed * redundant methods from groups-list component removed --- .../add-role-dialog.component.html | 2 +- .../lib/groups-list/groups-list.component.ts | 54 +------------------ 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.html b/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.html index 8997655fe..52273f0d1 100644 --- a/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.html +++ b/apps/admin-gui/src/app/shared/components/dialogs/add-role-dialog/add-role-dialog.component.html @@ -21,11 +21,11 @@

{{'DIALOGS.ADD_ROLE.TITLE' | translate}}

[disableRouting]="true"> (true, []); - @Input() filterValue: string; @Input() disableMembers: boolean; @Input() disableGroups: boolean; @Input() groupsToDisableCheckbox: Set = new Set(); @@ -151,13 +141,6 @@ export class GroupsListComponent implements OnChanges { return this.groupUtils.getSortDataForColumn(data, column, this.voNames, this.recentIds); }; - ngOnChanges(): void { - if (!this.authResolver.isPerunAdminOrObserver()) { - this.displayedColumns = this.displayedColumns.filter((column) => column !== 'id'); - } - this.setDataSource(); - } - exportAllData(format: string): void { if (isDynamicDataSource(this.dataSource)) { this.downloadAll.emit({ format: format, length: this.dataSource.paginator.length }); @@ -299,39 +282,6 @@ export class GroupsListComponent implements OnChanges { ); }; - setDataSource(): void { - if (!this.dataSource) { - this.dataSource = new MatTableDataSource(); - this.dataSource.sort = this.sort; - this.dataSource.paginator = this.tableWrapper.paginator; - this.dataSource.filterPredicate = (data: Vo, filter: string): boolean => - customDataSourceFilterPredicate( - data, - filter, - this.displayedColumns, - this.getDataForColumnFun - ); - this.dataSource.sortData = (data: GroupWithStatus[], sort: MatSort): GroupWithStatus[] => - customDataSourceSort(data, sort, this.getDataForColumnFun); - } - this.dataSource.filter = this.filterValue; - - // if groups not loaded yet, skip - if (!this.groups) { - return; - } - - const paginated = this.isPaginated(this.groups); - if (isDynamicDataSource(this.dataSource) || paginated) { - this.dataSource.data = (this.groups as PaginatedRichGroups).data; - (this.dataSource as DynamicDataSource).count = ( - this.groups as PaginatedRichGroups - ).totalCount; - } else if (!isDynamicDataSource(this.dataSource) && !paginated) { - this.dataSource.data = this.groups as GroupWithStatus[]; - } - } - private dataSourceInit(groups: GroupWithStatus[] | PaginatedRichGroups): void { const paginated = this.isPaginated(groups);