diff --git a/src/pages/Run/index.tsx b/src/pages/Run/index.tsx index f7eba32..96dc46b 100644 --- a/src/pages/Run/index.tsx +++ b/src/pages/Run/index.tsx @@ -1,13 +1,9 @@ -import { useReducer, useState } from "react"; +import { useReducer } from "react"; import { useParams } from "react-router-dom"; import { makeStyles, useTheme } from "@mui/styles"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import ButtonGroup from "@mui/material/ButtonGroup"; -import Alert from "@mui/material/Alert"; -import Box from "@mui/material/Box"; -import CircularProgress from "@mui/material/CircularProgress"; -import Snackbar from "@mui/material/Snackbar"; import { format } from "date-fns"; import SourceBranch from "mdi-material-ui/SourceBranch"; import { Helmet } from "react-helmet"; @@ -18,6 +14,7 @@ import { useRun } from "../../lib/paddles"; import JobList from "../../components/JobList"; import Link from "../../components/Link"; + const useStyles = makeStyles(() => ({ root: { "& .MuiButton-root": { @@ -28,17 +25,17 @@ const useStyles = makeStyles(() => ({ type StatusFilterState = { [key: string]: string; -}; +} type StatusFilterReducerAction = { type: string; payload: StatusFilterReducerPayload; -}; +} type StatusFilterReducerPayload = { key: string; value: string; -}; +} function reducer(state: StatusFilterState, action: StatusFilterReducerAction) { let newState: StatusFilterState; @@ -61,31 +58,9 @@ export default function Run() { const theme = useTheme(); const { name } = useParams(); const [state, dispatch] = useReducer(reducer, {}); - const [kill, setKill] = useState(false); - const [success, setSuccess] = useState(false); - const [error, setError] = useState(false); - const query = useRun(name === undefined ? "" : name); - if (query === null) return 404; + const query = useRun(name === undefined? "" : name); + if ( query === null ) return (404); if (!query.isSuccess) return null; - const killRun = async () => { - setKill(true); - const response = await fetch("https://reqres.in/api/users/2?delay=3"); // success response - // const response = await fetch("https://reqres.in/api/users/23?delay=3"); // error response - const status = response.status; - if (status === 200) setSuccess(true); - else setError(true); - setKill(false); - }; - const handleClose = ( - event?: React.SyntheticEvent | Event, - reason?: string - ) => { - if (reason === "clickaway") { - return; - } - setSuccess(false); - setError(false); - }; const setFilter = (key: string, value: string) => { dispatch({ type: "set", @@ -102,7 +77,7 @@ export default function Run() { return (
- {`${name} - Pulpito`} + { `${name} - Pulpito` } {name} @@ -116,42 +91,13 @@ export default function Run() { - + scheduled on {date}
-
- - {kill ? ( - - - - ) : null} -
- - - Run killed successfully - - - - - Unable to kill run - -