From a8546730eb947801ac854d4dedd3a644081ffda3 Mon Sep 17 00:00:00 2001 From: Wroud Date: Wed, 19 Aug 2020 12:42:05 +0300 Subject: [PATCH] fix(core): administration items deletion behavior --- .../ConnectionsAdministrationController.ts | 38 +++++++++---------- .../Users/UsersAdministrationController.ts | 35 ++++++++--------- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/webapp/packages/core-connections/src/Administration/Connections/ConnectionsAdministrationController.ts b/webapp/packages/core-connections/src/Administration/Connections/ConnectionsAdministrationController.ts index 8cf9066c4e..deab957fe3 100644 --- a/webapp/packages/core-connections/src/Administration/Connections/ConnectionsAdministrationController.ts +++ b/webapp/packages/core-connections/src/Administration/Connections/ConnectionsAdministrationController.ts @@ -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'); diff --git a/webapp/packages/plugin-authentication/src/Administration/Users/UsersAdministrationController.ts b/webapp/packages/plugin-authentication/src/Administration/Users/UsersAdministrationController.ts index 27baf39fd2..0865681ffb 100644 --- a/webapp/packages/plugin-authentication/src/Administration/Users/UsersAdministrationController.ts +++ b/webapp/packages/plugin-authentication/src/Administration/Users/UsersAdministrationController.ts @@ -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();