Merge pull request #147 from dbeaver/feat-database-search

fix(core): administration items deletion behavior
This commit is contained in:
Serge Rider
2020-08-19 15:08:54 +03:00
committed by GitHub
2 changed files with 40 additions and 41 deletions
@@ -117,39 +117,37 @@ export class ConnectionsAdministrationController {
return;
}
const deletionList = Array
.from(this.selectedItems)
.filter(([_, value]) => value)
.map(([connectionId]) => connectionId);
if (deletionList.length === 0) {
return;
}
const connectionNames = deletionList
.map(id => this.connectionsResource.get(id)?.name)
.filter(Boolean);
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
title: 'authentication_administration_confirm_user_deletion',
message: `Would you like to delete connections: ${connectionNames.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 connectionNames = deletionList
.map(id => this.connectionsResource.get(id)?.name)
.filter(Boolean);
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
title: 'authentication_administration_confirm_user_deletion',
message: `Would you like to delete connections: ${connectionNames.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();