From 1019c9dad209bbbae97ff20ef50bab8ba6518817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henry=20T=C3=A4schner?= <129834483+HenryT-CG@users.noreply.github.com> Date: Thu, 6 Jun 2024 07:45:32 +0200 Subject: [PATCH] feat: add IAM roles (#88) --- src/_mixins.scss | 10 +++ .../app-detail/app-detail.component.html | 8 +-- .../app-detail/app-detail.component.spec.ts | 8 +-- .../app-detail/app-detail.component.ts | 9 +-- .../app-search/app-search.component.html | 2 +- .../app-search/app-search.component.scss | 8 --- .../permission-detail.component.html | 6 +- .../role-detail/role-detail.component.html | 61 +++++++++++++++++-- .../role-detail/role-detail.component.scss | 18 ++++++ .../role-detail/role-detail.component.ts | 41 ++++++++++++- src/assets/i18n/de.json | 22 +++++-- src/assets/i18n/en.json | 28 ++++++--- 12 files changed, 175 insertions(+), 46 deletions(-) create mode 100644 src/app/permission/role-detail/role-detail.component.scss diff --git a/src/_mixins.scss b/src/_mixins.scss index e69f53d..3a62968 100644 --- a/src/_mixins.scss +++ b/src/_mixins.scss @@ -229,3 +229,13 @@ } } } + +@mixin listbox-zebra-rows { + :host ::ng-deep { + .p-listbox:not(.p-disabled) .p-listbox-item:not(.p-highlight):not(.p-disabled) { + &:nth-child(odd) { + background-color: #f8f9fa; + } + } + } +} diff --git a/src/app/permission/app-detail/app-detail.component.html b/src/app/permission/app-detail/app-detail.component.html index 1e95918..34071e9 100644 --- a/src/app/permission/app-detail/app-detail.component.html +++ b/src/app/permission/app-detail/app-detail.component.html @@ -183,10 +183,9 @@ pbutton type="button" *ngIf="myPermissions.includes('ROLE#CREATE') && showRoleTools" - [id]="'app_detail_permission_table_header_add_idm_roles_action'" - (click)="onCreateIDMRoles($event)" - [disabled]="true" - [title]="'ACTIONS.CREATE.IDM_ROLES.TOOLTIP' | translate" + [id]="'app_detail_permission_table_header_add_iam_roles_action'" + (click)="onAddIAMRoles($event)" + [title]="'ACTIONS.CREATE.IAM_ROLES.TOOLTIP' | translate" class="p-1 p-button-rounded font-medium p-button-text p-button p-component p-button-icon-only" > @@ -512,6 +511,7 @@ [roles]="roles" [role]="role" [changeMode]="changeMode" + [showIamRolesDialog]="showIamRolesDialog" [displayDetailDialog]="showRoleDetailDialog" [displayDeleteDialog]="showRoleDeleteDialog" (dataChanged)="onDetailChanged($event)" diff --git a/src/app/permission/app-detail/app-detail.component.spec.ts b/src/app/permission/app-detail/app-detail.component.spec.ts index 7f744af..a3ee1c9 100644 --- a/src/app/permission/app-detail/app-detail.component.spec.ts +++ b/src/app/permission/app-detail/app-detail.component.spec.ts @@ -380,12 +380,10 @@ describe('AppDetailComponent', () => { /** * CREATE */ - it('should do something onCreateIDMRoles', () => { - spyOn(console, 'log') + it('should do something onAddIAMRoles', () => { + component.onAddIAMRoles(new MouseEvent('click')) - component.onCreateIDMRoles(new MouseEvent('click')) - - expect(console.log).toHaveBeenCalled() + expect(component.showIamRolesDialog).toBeTrue() }) it('should return if there are no missing ws roles', () => { diff --git a/src/app/permission/app-detail/app-detail.component.ts b/src/app/permission/app-detail/app-detail.component.ts index 3a6ee8f..769b961 100644 --- a/src/app/permission/app-detail/app-detail.component.ts +++ b/src/app/permission/app-detail/app-detail.component.ts @@ -115,6 +115,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { public missingWorkspaceRoles = false public showRoleDetailDialog = false public showRoleDeleteDialog = false + public showIamRolesDialog = false public showRoleTools = false constructor( @@ -366,10 +367,6 @@ export class AppDetailComponent implements OnInit, OnDestroy { } } - public onCreateIDMRoles(ev: MouseEvent) { - console.log('TODO: select IDM roles to take over into permissions') - } - public onCreateWorkspaceRoles(ev: MouseEvent) { ev.stopPropagation() if (!this.missingWorkspaceRoles) return @@ -624,8 +621,12 @@ export class AppDetailComponent implements OnInit, OnDestroy { this.showPermissionDeleteDialog = false this.showRoleDetailDialog = false this.showRoleDeleteDialog = false + this.showIamRolesDialog = false if (changed) this.loadData() } + public onAddIAMRoles(ev: MouseEvent) { + this.showIamRolesDialog = true + } /**************************************************************************** * PERMISSION diff --git a/src/app/permission/app-search/app-search.component.html b/src/app/permission/app-search/app-search.component.html index bb9128b..f59361e 100644 --- a/src/app/permission/app-search/app-search.component.html +++ b/src/app/permission/app-search/app-search.component.html @@ -114,7 +114,7 @@ *ngIf="app.apps" [id]="'app_search_data_idx_' + idx + '_apps'" [title]="'APP.APPS' | translate" - class="card-badge-right badge-2-1 p-1 text-primary" + class="card-badge-right badge-2 p-1 text-xs" >{{ app.apps }}