From 1ae2c5b1e1b10c763654671e1ad1ddc4afd39247 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Wed, 23 Oct 2024 15:05:30 +0530 Subject: [PATCH] Display confirm dialog on deleting deployment --- .../Dialog/DeleteDeploymentDialog.tsx | 26 +++++++ .../project/deployments/DeploymentMenu.tsx | 11 ++- .../project/overview/Activity/AuctionCard.tsx | 68 ++++++++++--------- 3 files changed, 73 insertions(+), 32 deletions(-) create mode 100644 packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx diff --git a/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx b/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx new file mode 100644 index 00000000..f83efd76 --- /dev/null +++ b/packages/frontend/src/components/projects/Dialog/DeleteDeploymentDialog.tsx @@ -0,0 +1,26 @@ +import ConfirmDialog, { + ConfirmDialogProps, +} from 'components/shared/ConfirmDialog'; + +export const DeleteDeploymentDialog = ({ + open, + handleCancel, + handleConfirm, + ...props +}: ConfirmDialogProps) => { + 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 fec28246..9301dd3b 100644 --- a/packages/frontend/src/components/projects/project/deployments/DeploymentMenu.tsx +++ b/packages/frontend/src/components/projects/project/deployments/DeploymentMenu.tsx @@ -23,6 +23,7 @@ import { useGQLClient } from 'context/GQLClientContext'; import { cn } from 'utils/classnames'; import { ChangeStateToProductionDialog } from 'components/projects/Dialog/ChangeStateToProductionDialog'; import { useToast } from 'components/shared/Toast'; +import { DeleteDeploymentDialog } from 'components/projects/Dialog/DeleteDeploymentDialog'; interface DeploymentMenuProps extends ComponentPropsWithRef<'div'> { deployment: Deployment; @@ -46,6 +47,7 @@ export const DeploymentMenu = ({ const [changeToProduction, setChangeToProduction] = useState(false); const [redeployToProduction, setRedeployToProduction] = useState(false); + const [deleteDeploymentDialog, setDeleteDeploymentDialog] = useState(false); const [rollbackDeployment, setRollbackDeployment] = useState(false); const [assignDomainDialog, setAssignDomainDialog] = useState(false); const [isConfirmButtonLoading, setConfirmButtonLoadingLoading] = @@ -123,6 +125,8 @@ export const DeploymentMenu = ({ onDismiss: dismiss, }); + setDeleteDeploymentDialog((preVal) => !preVal); + const isDeleted = await client.deleteDeployment(deployment.id); if (isDeleted) { await onUpdate(); @@ -212,7 +216,7 @@ export const DeploymentMenu = ({ deleteDeployment()} + onClick={() => setDeleteDeploymentDialog((preVal) => !preVal)} > Delete deployment @@ -265,6 +269,11 @@ export const DeploymentMenu = ({ open={assignDomainDialog} handleOpen={() => setAssignDomainDialog(!assignDomainDialog)} /> + setDeleteDeploymentDialog((preVal) => !preVal)} + /> ); }; diff --git a/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx b/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx index 291bc7ff..5e83d91c 100644 --- a/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx +++ b/packages/frontend/src/components/projects/project/overview/Activity/AuctionCard.tsx @@ -96,13 +96,6 @@ export const AuctionCard = ({ project }: { project: Project }) => { -
- - Auction Status - -
{renderAuctionStatus()}
-
-
Auction Id @@ -112,35 +105,48 @@ export const AuctionCard = ({ project }: { project: Project }) => {
- {deployers?.length > 0 ? ( -
- - Deployer LRNs - - {deployers.map((deployer, index) => ( -

- {'\u2022'} {deployer.deployerLrn} -

- ))} -
- ) : ( -
- - No winning deployers - -
- )}
- Deployer Funds Status + Auction Status -
- - {fundsStatus ? 'RELEASED' : 'LOCKED'} - -
+
{renderAuctionStatus()}
+ + {auctionStatus === 'completed' && ( + <> + {deployers?.length > 0 ? ( +
+ + Deployer LRNs + + {deployers.map((deployer, index) => ( +

+ {'\u2022'} {deployer.deployerLrn} +

+ ))} +
+ ) : ( +
+ + No winning deployers + +
+ )} + +
+ + Deployer Funds Status + +
+ + {fundsStatus ? 'RELEASED' : 'LOCKED'} + +
+
+ + )} +