delete popup added for entity delete action

Signed-off-by: AmbrishRamachandiran <ambrish.r@infosys.com>
This commit is contained in:
AmbrishRamachandiran
2023-08-22 13:19:36 +05:30
parent f9faeca0a6
commit 7029ba1ce0
2 changed files with 20 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-react': patch
---
Added delete alert popup when user delete the entity
@@ -85,7 +85,21 @@ const Contents = ({
setBusy(true);
try {
await state.deleteEntity();
const entityArray = [entity].flat();
const entityNames = entityArray.map(
item => item.metadata.title ?? item.metadata.name,
);
onConfirm();
const message =
entityNames.length === 1
? `Removed entity '${entityNames[0]}'`
: `Removed entities: '${entityNames.join("', '")}'`;
alertApi.post({
message,
severity: 'success',
display: 'transient',
});
} catch (err) {
assertError(err);
alertApi.post({ message: err.message });
@@ -94,7 +108,7 @@ const Contents = ({
}
}
},
[alertApi, onConfirm, state],
[alertApi, onConfirm, state, entity],
);
const DialogActionsPanel = () => (