Skip to content

Commit

Permalink
fix: exclude exstiting roles from iam role list
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Jun 6, 2024
1 parent 1019c9d commit c3f77e3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/app/permission/role-detail/role-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
[dismissableMask]="true"
>
<div class="flex flex-column row-gap-2">
<div>{{ 'ROLE.IAM.INFO' | translate }}</div>
<div>{{ 'ROLE.IAM.LIST' | translate }}</div>
<p-listbox
[options]="iamRoles"
[(ngModel)]="selectedIamRoles"
Expand All @@ -120,9 +120,11 @@
[multiple]="true"
[metaKeySelection]="false"
[showToggleAll]="false"
[emptyMessage]="'ACTIONS.SEARCH.NO_DATA' | translate"
[listStyle]="{ 'max-height': '300px' }"
/>
</div>
<div class="mt-2 text-xs">{{ 'ROLE.IAM.INFO' | translate }}</div>
<ng-template pTemplate="footer">
<div class="flex flex-wrap column-gap-2 row-gap-1 justify-content-end">
<button
Expand Down
5 changes: 4 additions & 1 deletion src/app/permission/role-detail/role-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ export class RoleDetailComponent implements OnChanges {
public getIamRoles() {
this.roleApi.searchAvailableRoles({ iAMRoleSearchCriteria: { pageSize: 1000 } }).subscribe({
next: (data) => {
this.iamRoles = data.stream ?? []
this.iamRoles = []
data.stream?.forEach((iamRole) => {
if (this.roles.filter((r) => r.name === iamRole.name).length === 0) this.iamRoles.push(iamRole)
})
},
error: (err) => {
console.error(err.error)
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@
"MANDATORY": "Diese Rolle ist notwendig für den Betrieb und kann somit nicht bearbeitet oder gelöscht werden.",
"IAM": {
"HEADER": "IAM Rollen auswählen",
"INFO": "Liste der fehlenden IAM Rollen",
"LIST": "Liste der fehlenden Rollen",
"INFO": "(IAM: Identity Access Management = Benutzer & Rollen)",
"Filter": "Filter",
"SAVE": "Auswahl übernehmen"
}
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@
"MANDATORY": "This Role is necessary for operation and cannot therefore be changed or deleted.",
"IAM": {
"HEADER": "Select IAM Roles",
"INFO": "List of missing IAM Roles",
"LIST": "List of missing Roles",
"INFO": "(IAM: Identity Access Management = User & Roles)",
"Filter": "Filter",
"SAVE": "Add selection"
}
Expand Down

0 comments on commit c3f77e3

Please sign in to comment.