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:
Max Peintner
2023-01-11 10:20:12 +00:00
committed by GitHub
co-authored by Livio Spring
parent f4b920c11c
commit 3be1f51e48
10 changed files with 203 additions and 106 deletions
@@ -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) {