From 49e4518f50b42bb9978f2f44659e3f41001ba431 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 18 Dec 2023 17:03:13 +0530 Subject: [PATCH] #435 add confirmation dialog for Repository delete --- .../src/components/dialogs/DeleteDialog.tsx | 16 +++++++------- .../repository/RepositoryActionsMenu.tsx | 21 ++++++++++++++++++- .../workspace/WorkspaceActionsMenu.tsx | 6 ++++-- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/applications/osb-portal/src/components/dialogs/DeleteDialog.tsx b/applications/osb-portal/src/components/dialogs/DeleteDialog.tsx index 477e2c89..e8392a4c 100644 --- a/applications/osb-portal/src/components/dialogs/DeleteDialog.tsx +++ b/applications/osb-portal/src/components/dialogs/DeleteDialog.tsx @@ -12,15 +12,17 @@ import { Button } from "@mui/material"; const DeleteDialog = ({ open, setOpen, - workspace, - handleDeleteWorkspace, + title, + description, + handleDeleteCallback, + navigateToPath }) => { const navigate = useNavigate(); const handleDelete = () => { - handleDeleteWorkspace(); - if (window.location.pathname !== "/") { - navigate("/"); + handleDeleteCallback(); + if (navigateToPath && window.location.pathname !== "/") { + navigate(navigateToPath) } } @@ -29,8 +31,8 @@ const DeleteDialog = ({ open={open} onClose={() => setOpen(false)} > - {'Delete Workspace "' + workspace.name + '"'} - {'You are about to delete Workspace "' + workspace.name + '". This action cannot be undone. Are you sure?'} + {title} + {description}