diff --git a/frontend/src/components/common/ConfirmDialog.tsx b/frontend/src/components/common/ConfirmDialog.tsx
index a503fd43d9..4038982bca 100644
--- a/frontend/src/components/common/ConfirmDialog.tsx
+++ b/frontend/src/components/common/ConfirmDialog.tsx
@@ -1,3 +1,5 @@
+import { Checkbox } from '@mui/material';
+import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import MuiDialog, { DialogProps as MuiDialogProps } from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
@@ -9,7 +11,8 @@ import { DialogTitle } from './Dialog';
export interface ConfirmDialogProps extends MuiDialogProps {
title: string;
- description: string;
+ description: string | JSX.Element;
+ checkboxDescription?: string;
onConfirm: () => void;
handleClose: () => void;
}
@@ -18,6 +21,8 @@ export function ConfirmDialog(props: ConfirmDialogProps) {
const { onConfirm, open, handleClose, title, description } = props;
const { t } = useTranslation();
+ const [checkboxClicked, setCheckboxClicked] = React.useState(false);
+
function onConfirmationClicked() {
handleClose();
onConfirm();
@@ -30,6 +35,44 @@ export function ConfirmDialog(props: ConfirmDialogProps) {
}
}, []);
+ if (props.checkboxDescription) {
+ return (
+
+
+ {title}
+
+ {description}
+
+
+ {props.checkboxDescription}
+
+ setCheckboxClicked(!checkboxClicked)} />
+
+
+
+
+
+
+
+
+ );
+ }
+
return (
{
if (cluster) {
const kubeconfig = await findKubeconfigByClusterName(cluster);
@@ -89,12 +90,11 @@ export async function deleteCluster(
}
}
- return request(
- `/cluster/${cluster}`,
- { method: 'DELETE', headers: { ...getHeadlampAPIHeaders() } },
- false,
- false
- );
+ const url = removeKubeConfig
+ ? `/cluster/${cluster}?removeKubeconfig=true`
+ : `/cluster/${cluster}`;
+
+ return request(url, { method: 'DELETE', headers: { ...getHeadlampAPIHeaders() } }, false, false);
}
/**