Skip to content

Commit

Permalink
improve delete label
Browse files Browse the repository at this point in the history
  • Loading branch information
pa-lem committed Sep 18, 2024
1 parent 20b99ec commit 83eebec
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions frontend/app/src/components/modals/modal-delete-object.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export default function ModalDeleteObject({ label, rowToDelete, open, close, onD
const date = useAtomValue(datetimeAtom);
const { objectKind } = useParams();

const objectDisplay = rowToDelete?.display_label || rowToDelete?.name?.value || rowToDelete?.name;

const handleDeleteObject = async () => {
if (!rowToDelete?.id) {
return;
Expand Down Expand Up @@ -60,12 +62,7 @@ export default function ModalDeleteObject({ label, rowToDelete, open, close, onD

close();

toast(
<Alert
type={ALERT_TYPES.SUCCESS}
message={`Object ${rowToDelete?.display_label} deleted`}
/>
);
toast(<Alert type={ALERT_TYPES.SUCCESS} message={`Object ${objectDisplay} deleted`} />);
} catch (error) {
console.error("Error while deleting object: ", error);
}
Expand All @@ -77,11 +74,11 @@ export default function ModalDeleteObject({ label, rowToDelete, open, close, onD
<ModalDelete
title="Delete"
description={
rowToDelete?.display_label || rowToDelete?.name?.value || rowToDelete?.name ? (
objectDisplay ? (
<>
Are you sure you want to remove the <i>{label}</i>
<b className="ml-2">
&quot;{rowToDelete?.display_label || rowToDelete?.name?.value || rowToDelete?.name}
&quot;{objectDisplay}
&quot;
</b>
?
Expand Down

0 comments on commit 83eebec

Please sign in to comment.