Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Fix auto refresh after workflow action (terminate/restart etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlau committed Oct 25, 2021
1 parent 9094294 commit 85db363
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 7 additions & 7 deletions ui/src/pages/execution/ActionModule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,37 @@ export default function ActionModule({ execution, triggerReload }) {
const restartAction = useAction(
`/workflow/${workflowId}/restart`,
"post",
onSuccess
{ onSuccess }
);
const restartLatestAction = useAction(
`/workflow/${workflowId}/restart?useLatestDefinitions=true`,
"post",
onSuccess
{ onSuccess }
);
const retryAction = useAction(
`/workflow/${workflowId}/retry?resumeSubworkflowTasks=false`,
"post",
onSuccess
{ onSuccess }
);
const retryResumeSubworkflowTasksAction = useAction(
`/workflow/${workflowId}/retry?resumeSubworkflowTasks=true`,
"post",
onSuccess
{ onSuccess }
);
const terminateAction = useAction(
`/workflow/${workflowId}`,
"delete",
onSuccess
{ onSuccess }
);
const resumeAction = useAction(
`/workflow/${workflowId}/resume`,
"put",
onSuccess
{ onSuccess }
);
const pauseAction = useAction(
`/workflow/${workflowId}/pause`,
"put",
onSuccess
{ onSuccess }
);

const { restartable } = workflowDefinition;
Expand Down
10 changes: 9 additions & 1 deletion ui/src/plugins/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@ export function fetchWithContext(path, context, fetchParams) {
const newPath = `/api/${path}`;
const cleanPath = newPath.replace(/([^:]\/)\/+/g, "$1"); // Cleanup duplicated slashes

return fetch(cleanPath, newParams).then((res) => res.json());
return fetch(cleanPath, newParams).then(res => res.text())
.then(text => {
if(!text || text.length === 0){
return null;
}
else {
return JSON.parse(text);
}
})
}

0 comments on commit 85db363

Please sign in to comment.