List deployer LRNs in deployment configuration step #11

Merged
nabarun merged 9 commits from iv-deployer-dropdown into main 2024-10-23 15:36:20 +00:00
2 changed files with 25 additions and 11 deletions
Showing only changes of commit 30b493e567 - Show all commits

View File

@ -1,22 +1,36 @@
import ConfirmDialog, { import ConfirmDialog, {
ConfirmDialogProps, ConfirmDialogProps,
} from 'components/shared/ConfirmDialog'; } from 'components/shared/ConfirmDialog';
import { ArrowRightCircleFilledIcon, LoadingIcon } from 'components/shared/CustomIcon';
interface DeleteDeploymentDialogProps extends ConfirmDialogProps {
isConfirmButtonLoading?: boolean;
}
export const DeleteDeploymentDialog = ({ export const DeleteDeploymentDialog = ({
open, open,
handleCancel, handleCancel,
handleConfirm, handleConfirm,
isConfirmButtonLoading,
...props ...props
}: ConfirmDialogProps) => { }: DeleteDeploymentDialogProps) => {
return ( return (
<ConfirmDialog <ConfirmDialog
{...props} {...props}
dialogTitle="Delete deployment?" dialogTitle="Delete deployment?"
handleCancel={handleCancel} handleCancel={handleCancel}
open={open} open={open}
confirmButtonTitle="Yes, delete deployment" confirmButtonTitle={isConfirmButtonLoading ? "Deleting deployment" : "Yes, delete deployment"}
handleConfirm={handleConfirm} handleConfirm={handleConfirm}
confirmButtonProps={{ variant: 'danger' }} confirmButtonProps={{
variant: 'danger',
disabled: isConfirmButtonLoading,
rightIcon: isConfirmButtonLoading ? (
<LoadingIcon className="animate-spin" />
) : (
<ArrowRightCircleFilledIcon />
),
}}
> >
<p className="text-sm text-elements-high-em"> <p className="text-sm text-elements-high-em">
Once deleted, the deployment will not be accessible. Once deleted, the deployment will not be accessible.

View File

@ -48,6 +48,7 @@ export const DeploymentMenu = ({
const [changeToProduction, setChangeToProduction] = useState(false); const [changeToProduction, setChangeToProduction] = useState(false);
const [redeployToProduction, setRedeployToProduction] = useState(false); const [redeployToProduction, setRedeployToProduction] = useState(false);
const [deleteDeploymentDialog, setDeleteDeploymentDialog] = useState(false); const [deleteDeploymentDialog, setDeleteDeploymentDialog] = useState(false);
const [isConfirmDeleteLoading, setIsConfirmDeleteLoading] = useState(false);
const [rollbackDeployment, setRollbackDeployment] = useState(false); const [rollbackDeployment, setRollbackDeployment] = useState(false);
const [assignDomainDialog, setAssignDomainDialog] = useState(false); const [assignDomainDialog, setAssignDomainDialog] = useState(false);
const [isConfirmButtonLoading, setConfirmButtonLoadingLoading] = const [isConfirmButtonLoading, setConfirmButtonLoadingLoading] =
@ -118,16 +119,11 @@ export const DeploymentMenu = ({
}; };
const deleteDeployment = async () => { const deleteDeployment = async () => {
toast({ const isDeleted = await client.deleteDeployment(deployment.id);
id: 'deleting_deployment',
title: 'Deleting deployment....',
variant: 'success',
onDismiss: dismiss,
});
setIsConfirmDeleteLoading(false);
setDeleteDeploymentDialog((preVal) => !preVal); setDeleteDeploymentDialog((preVal) => !preVal);
const isDeleted = await client.deleteDeployment(deployment.id);
if (isDeleted) { if (isDeleted) {
await onUpdate(); await onUpdate();
toast({ toast({
@ -271,8 +267,12 @@ export const DeploymentMenu = ({
/> />
<DeleteDeploymentDialog <DeleteDeploymentDialog
open={deleteDeploymentDialog} open={deleteDeploymentDialog}
handleConfirm={deleteDeployment} handleConfirm={async () => {
setIsConfirmDeleteLoading(true);
await deleteDeployment();
}}
handleCancel={() => setDeleteDeploymentDialog((preVal) => !preVal)} handleCancel={() => setDeleteDeploymentDialog((preVal) => !preVal)}
isConfirmButtonLoading={isConfirmDeleteLoading}
/> />
</> </>
); );