Skip to content
Snippets Groups Projects
Commit 6f4d77be authored by ali asaria's avatar ali asaria
Browse files

disable buttons if no workflow selected

parent 03f19368
No related branches found
No related tags found
No related merge requests found
......@@ -143,45 +143,66 @@ export default function Workflows({ experimentInfo }) {
Workflow {selectedWorkflow?.name}
</Typography>
<Box pl={2} display="flex" flexDirection="row" gap={1}>
{selectedWorkflow?.status != 'RUNNING' ? (
<>
{selectedWorkflow?.status != 'RUNNING' ? (
<Button
disabled={!selectedWorkflow}
startDecorator={<PlayIcon />}
onClick={() => runWorkflow(selectedWorkflow.id)}
>
Run
</Button>
) : (
<Button startDecorator={<PlayIcon />} disabled>
Running
</Button>
)}
<Button
startDecorator={<PlayIcon />}
onClick={() => runWorkflow(selectedWorkflow.id)}
startDecorator={<AxeIcon />}
variant="outlined"
disabled={!selectedWorkflow}
>
Run
</Button>
) : (
<Button startDecorator={<PlayIcon />} disabled={true}>
Running
Fight
</Button>
)}
<Button startDecorator={<AxeIcon />} variant="outlined">
Fight
</Button>
<Dropdown>
<MenuButton variant="plain">
<EllipsisIcon />
</MenuButton>
<Menu>
<MenuItem onClick={() => alert('not implemented')}>
<ListItemDecorator>
<PenIcon />
</ListItemDecorator>
Edit Workflow Name
</MenuItem>
<MenuItem
color="danger"
onClick={() => alert('not implemented')}
>
<ListItemDecorator>
<Trash2Icon />
</ListItemDecorator>
Delete Workflow
</MenuItem>
</Menu>
</Dropdown>
<Dropdown>
<MenuButton variant="plain" disabled={!selectedWorkflow}>
<EllipsisIcon />
</MenuButton>
<Menu>
<MenuItem onClick={() => alert('not implemented')}>
<ListItemDecorator>
<PenIcon />
</ListItemDecorator>
Edit Workflow Name
</MenuItem>
<MenuItem
color="danger"
onClick={async () => {
if (
confirm(
'Are you sure you want to delete this workflow?'
)
) {
await fetch(
chatAPI.Endpoints.Workflows.DeleteWorkflow(
selectedWorkflow?.id
)
);
mutateWorkflows();
setSelectedWorkflowId(null);
}
}}
>
<ListItemDecorator>
<Trash2Icon />
</ListItemDecorator>
Delete Workflow
</MenuItem>
</Menu>
</Dropdown>
</>
</Box>
</Box>
<Box
......
......@@ -1017,6 +1017,8 @@ Endpoints.Workflows = {
name +
'&experiment_id=' +
experimentId,
DeleteWorkflow: (workflowId: string) =>
API_URL() + 'workflows/delete/' + workflowId,
AddNode: (workflowId: string, node: string) =>
API_URL() +
'workflows/add_node' +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment