fix(core): administration items deletion behavior

This commit is contained in:
Wroud
2020-08-19 12:42:05 +03:00
parent 5a69e01b17
commit a8546730eb
2 changed files with 36 additions and 37 deletions
@@ -117,35 +117,33 @@ export class ConnectionsAdministrationController {
return;
}
const deletionList = Array
.from(this.selectedItems)
.filter(([_, value]) => value)
.map(([connectionId]) => connectionId);
if (deletionList.length === 0) {
return;
}
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
title: 'authentication_administration_confirm_user_deletion',
message: `Would you like to delete connections: ${deletionList.join(', ')}`,
});
if (!confirmed) {
return;
}
this.isProcessing = true;
try {
const deletionList = Array
.from(this.selectedItems)
.filter(([_, value]) => value)
.map(([connectionId]) => connectionId);
if (deletionList.length === 0) {
return;
}
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
title: 'authentication_administration_confirm_user_deletion',
message: `Would you like to delete connections: ${deletionList.join(', ')}`,
});
if (!confirmed) {
return;
}
await this.connectionsResource.delete(resourceKeyList(deletionList));
this.selectedItems.clear();
for (const id of deletionList) {
this.expandedItems.delete(id);
}
await this.connectionsResource.refresh('all');
} catch (exception) {
if (!this.error.catch(exception)) {
this.notificationService.logException(exception, 'Connections delete failed');
@@ -35,7 +35,7 @@ export class UsersAdministrationController {
}
get isLoading() {
return this.usersResource.isLoading();
return this.usersResource.isLoading() || this.isDeleting;
}
constructor(
@@ -64,25 +64,26 @@ export class UsersAdministrationController {
return;
}
const deletionList = Array
.from(this.selectedItems)
.filter(([_, value]) => value)
.map(([userId]) => userId);
if (deletionList.length === 0) {
return;
}
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
title: 'authentication_administration_confirm_user_deletion',
message: `Would you like to delete users: ${deletionList.join(', ')}`,
});
if (!confirmed) {
return;
}
this.isDeleting = true;
try {
const deletionList = Array
.from(this.selectedItems)
.filter(([_, value]) => value)
.map(([userId]) => userId);
if (deletionList.length === 0) {
return;
}
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
title: 'authentication_administration_confirm_user_deletion',
message: `Would you like to delete users: ${deletionList.join(', ')}`,
});
if (!confirmed) {
return;
}
await this.usersResource.delete(resourceKeyList(deletionList));
this.selectedItems.clear();