From 85db363ad4eb1ce066cc2353447f31bdba15d01b Mon Sep 17 00:00:00 2001 From: Peter Lau Date: Mon, 25 Oct 2021 10:55:05 -0700 Subject: [PATCH] Fix auto refresh after workflow action (terminate/restart etc) --- ui/src/pages/execution/ActionModule.jsx | 14 +++++++------- ui/src/plugins/fetch.js | 10 +++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ui/src/pages/execution/ActionModule.jsx b/ui/src/pages/execution/ActionModule.jsx index a2adcc1099..8e8f4899ca 100644 --- a/ui/src/pages/execution/ActionModule.jsx +++ b/ui/src/pages/execution/ActionModule.jsx @@ -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; diff --git a/ui/src/plugins/fetch.js b/ui/src/plugins/fetch.js index 373184a6ab..e2b841c216 100644 --- a/ui/src/plugins/fetch.js +++ b/ui/src/plugins/fetch.js @@ -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); + } + }) }