fix(core-navigation-tree, plugin-navigation-tree): CB-2360 Do not duplicate confirmation when deleting tables

This commit is contained in:
Konstantin Vasilev
2022-08-23 16:38:01 +03:00
parent 0e03284b40
commit d5169480de
4 changed files with 25 additions and 35 deletions
@@ -62,32 +62,12 @@ export class ObjectPropertyTableFooterService {
onClick: async context => {
const nodes = this.getSelectedNodes(context.data.tableState.selectedList)
.filter(node => node.features?.includes(ENodeFeature.canDelete));
const nodeNames = nodes.map(getNodeDisplayName);
const result = await this.commonDialogService.open(ConfirmationDialogDelete, {
title: 'ui_data_delete_confirmation',
message: `You're going to delete following items: "${nodeNames.join(', ')}". Are you sure?`,
confirmActionText: 'ui_delete',
});
if (result === DialogueStateResult.Rejected) {
return;
}
const deleted: string[] = [];
try {
for (const node of nodes) {
await this.navTreeResource.deleteNode(node.id);
deleted.push(node.id);
}
await this.navTreeResource.deleteNode(resourceKeyList(nodes.map(node => node.id)));
} catch (exception: any) {
this.notificationService.logException(exception, 'Failed to delete item');
}
if (deleted.length) {
context.data.tableState.unselect(deleted);
}
},
});
}
@@ -28,6 +28,9 @@ const menuStyles = css`
cursor: pointer;
width: 100%;
}
menu-container:not([|menuEmpty]) value {
padding-right: 8px;
}
menu-box {
display: flex;
height: 100%;