Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import React from "react"; import CustomButton from "../../common/CustomButton/index.tsx"; import { PlayArrowRounded } from "@mui/icons-material"; import { unsupportedRunners } from "../../../utils/playbook/unsupportedRunners.ts"; import { CircularProgress, Tooltip } from "@mui/material"; import { executeTask } from "../../../utils/execution/executeTask.ts"; import useCurrentTask from "../../../hooks/playbooks/task/useCurrentTask.ts"; type RunButtonProps = { id: string; showText?: boolean; }; function RunButton({ id, showText = true }: RunButtonProps) { const [task] = useCurrentTask(id); const loading = task?.ui_requirement?.outputLoading; const handleExecuteTask = async () => { Iif (loading) return; Iif (task) executeTask(task.id); }; Iif (!task?.source || unsupportedRunners.includes(task?.source ?? "")) return <></>; return ( <Tooltip title="Run this Task"> <> <CustomButton onClick={handleExecuteTask}> {showText && (loading ? "Running" : "Run")} {loading ? ( <CircularProgress color="inherit" size={20} /> ) : ( <PlayArrowRounded fontSize="medium" /> )} </CustomButton> </> </Tooltip> ); } export default RunButton; |