mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-10 08:05:12 +00:00
fix(console): member table updates (#4984)
* fix: members table refresh, delete with single role * trigger update after change * remove event propagation handler Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
f4b920c11c
commit
3be1f51e48
@@ -69,27 +69,32 @@ export class MembersTableComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public removeRole(member: Member.AsObject, role: string) {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'GRANTS.DIALOG.DELETE_TITLE',
|
||||
descriptionKey: 'GRANTS.DIALOG.DELETE_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
if (member.rolesList.length === 1) {
|
||||
this.triggerDeleteMember(member);
|
||||
} else {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'ROLES.DIALOG.DELETE_TITLE',
|
||||
descriptionKey: 'ROLES.DIALOG.DELETE_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp) {
|
||||
const newRoles = Object.assign([], member.rolesList);
|
||||
const index = newRoles.findIndex((r) => r === role);
|
||||
if (index > -1) {
|
||||
newRoles.splice(index, 1);
|
||||
member.rolesList = newRoles;
|
||||
this.updateRoles.emit({ member: member, change: newRoles });
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp) {
|
||||
const newRoles = Object.assign([], member.rolesList);
|
||||
|
||||
const index = newRoles.findIndex((r) => r === role);
|
||||
if (index > -1) {
|
||||
newRoles.splice(index, 1);
|
||||
member.rolesList = newRoles;
|
||||
this.updateRoles.emit({ member: member, change: newRoles });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public addRole(member: Member.AsObject) {
|
||||
|
||||
Reference in New Issue
Block a user