diff --git a/src/components/KillButton/index.tsx b/src/components/KillButton/index.tsx index 9ca5526..0febf82 100644 --- a/src/components/KillButton/index.tsx +++ b/src/components/KillButton/index.tsx @@ -1,7 +1,13 @@ +import { useState } from "react"; import type { UseMutationResult } from "@tanstack/react-query"; import Button from "@mui/material/Button"; import Box from "@mui/material/Box"; -import { CircularProgress } from "@mui/material"; +import CircularProgress from "@mui/material/CircularProgress"; +import DialogTitle from '@mui/material/DialogTitle'; +import DialogContent from '@mui/material/DialogContent'; +import Dialog from '@mui/material/Dialog'; +import Paper from "@mui/material/Paper"; +import Typography from "@mui/material/Typography"; import { KillRunPayload } from "../../lib/teuthologyAPI.d"; import { useSession } from "../../lib/teuthologyAPI"; @@ -15,17 +21,29 @@ type KillButtonProps = { disabled?: boolean; }; +type KillButtonDialogProps = { + mutation: UseMutationResult; + payload: KillRunPayload; + open: boolean; + handleClose: () => void; +}; export default function KillButton(props: KillButtonProps) { + const [open, setOpen] = useState(false); const mutation: UseMutationResult = props.mutation; const sessionQuery = useSession(); const loggedUser = sessionQuery.data?.session.username; - if (loggedUser?.toLowerCase() != props.payload["--user"].toLowerCase()) { + if (loggedUser?.toLowerCase() != props.payload["--owner"].toLowerCase()) { // logged user and owner of the job should be equal (case insensitive) return null } + const toggleDialog = () => { + setOpen(!open); + }; + + return (