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 44 45 46 47 48 49 50 51 | import { useNavigate } from "react-router-dom"; import CustomButton from "../../common/CustomButton"; import { ExecutionStatus } from "../../../types"; import { useStopWorkflowExecutionMutation } from "../../../store/features/workflow/api"; import { CircularProgress, Tooltip } from "@mui/material"; import { PowerSettingsNewRounded } from "@mui/icons-material"; type WorkflowExecutionActionsProps = { item: any; }; function WorkflowExecutionActions({ item }: WorkflowExecutionActionsProps) { const navigate = useNavigate(); const [stopExecution, { isLoading: stopLoading }] = useStopWorkflowExecutionMutation(); const handleViewExecutions = () => { navigate(`/workflows/logs/${item.workflow_run_id}`); }; const handleStopExecution = () => { stopExecution({ workflow_run_id: item.workflow_run_id }); window.location.reload(); }; const showStop = item.status === ExecutionStatus.WORKFLOW_RUNNING || item.status === ExecutionStatus.WORKFLOW_SCHEDULED; return ( <div className="flex items-center gap-2 flex-wrap"> <CustomButton onClick={handleViewExecutions}> View Playbook Executions </CustomButton> {showStop && ( <CustomButton onClick={handleStopExecution}> <Tooltip title="Stop Execution"> {stopLoading ? ( <CircularProgress size={20} /> ) : ( <PowerSettingsNewRounded fontSize="small" /> )} </Tooltip> </CustomButton> )} </div> ); } export default WorkflowExecutionActions; |