diff --git a/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx b/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx index f83efd76..cc10f77a 100644 --- a/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx +++ b/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx @@ -1,22 +1,36 @@ import ConfirmDialog, { ConfirmDialogProps, } from 'components/shared/ConfirmDialog'; +import { ArrowRightCircleFilledIcon, LoadingIcon } from 'components/shared/CustomIcon'; + +interface DeleteDeploymentDialogProps extends ConfirmDialogProps { + isConfirmButtonLoading?: boolean; +} export const DeleteDeploymentDialog = ({ open, handleCancel, handleConfirm, + isConfirmButtonLoading, ...props -}: ConfirmDialogProps) => { +}: DeleteDeploymentDialogProps) => { return ( + ) : ( + + ), + }} >

Once deleted, the deployment will not be accessible. diff --git a/packages/frontend/src/components/projects/project/deployments/DeploymentMenu.tsx b/packages/frontend/src/components/projects/project/deployments/DeploymentMenu.tsx index 9301dd3b..421c2bba 100644 --- a/packages/frontend/src/components/projects/project/deployments/DeploymentMenu.tsx +++ b/packages/frontend/src/components/projects/project/deployments/DeploymentMenu.tsx @@ -48,6 +48,7 @@ export const DeploymentMenu = ({ const [changeToProduction, setChangeToProduction] = useState(false); const [redeployToProduction, setRedeployToProduction] = useState(false); const [deleteDeploymentDialog, setDeleteDeploymentDialog] = useState(false); + const [isConfirmDeleteLoading, setIsConfirmDeleteLoading] = useState(false); const [rollbackDeployment, setRollbackDeployment] = useState(false); const [assignDomainDialog, setAssignDomainDialog] = useState(false); const [isConfirmButtonLoading, setConfirmButtonLoadingLoading] = @@ -118,16 +119,11 @@ export const DeploymentMenu = ({ }; const deleteDeployment = async () => { - toast({ - id: 'deleting_deployment', - title: 'Deleting deployment....', - variant: 'success', - onDismiss: dismiss, - }); + const isDeleted = await client.deleteDeployment(deployment.id); + setIsConfirmDeleteLoading(false); setDeleteDeploymentDialog((preVal) => !preVal); - const isDeleted = await client.deleteDeployment(deployment.id); if (isDeleted) { await onUpdate(); toast({ @@ -271,8 +267,12 @@ export const DeploymentMenu = ({ /> { + setIsConfirmDeleteLoading(true); + await deleteDeployment(); + }} handleCancel={() => setDeleteDeploymentDialog((preVal) => !preVal)} + isConfirmButtonLoading={isConfirmDeleteLoading} /> );