From 7d7f80c4aa5039e8bc64dae408bcf7391963b149 Mon Sep 17 00:00:00 2001 From: julian Date: Sun, 24 Mar 2024 17:53:12 +0200 Subject: [PATCH] Add an http check on form updates as they default to success when there is an error, ie 403 --- .../manage/UpdateWorkflowInstanceSignalForm.tsx | 5 ++++- .../manage/UpdateWorkflowInstanceStateForm.tsx | 5 ++++- .../manage/UpdateWorkflowInstanceStateVariableForm.tsx | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceSignalForm.tsx b/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceSignalForm.tsx index 1b7f74ada..7451e8e21 100644 --- a/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceSignalForm.tsx +++ b/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceSignalForm.tsx @@ -25,7 +25,10 @@ const UpdateWorkflowInstanceSignalForm = function (props: { signal: values.signal, reason: values.reason }).then((reason: any) => { - if (reason.error) { + if (!reason.ok) { + setErrorMsg(`HTTP error! status: ${reason.status}`); + setConfirmationMsg(''); + } else if (reason.error) { setErrorMsg(reason.error); setConfirmationMsg(''); } else { diff --git a/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateForm.tsx b/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateForm.tsx index 0f75ae313..2dce2f4cf 100644 --- a/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateForm.tsx +++ b/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateForm.tsx @@ -26,7 +26,10 @@ const UpdateWorkflowInstanceStateForm = function (props: { ), actionDescription: values.actionDescription }).then((reason: any) => { - if (reason.error) { + if (!reason.ok) { + setErrorMsg(`HTTP error! status: ${reason.status}`); + setConfirmationMsg(''); + } else if (reason.error) { setErrorMsg(reason.error); setConfirmationMsg(''); } else { diff --git a/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateVariableForm.tsx b/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateVariableForm.tsx index 3c06e4f8c..f3f546e39 100644 --- a/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateVariableForm.tsx +++ b/nflow-explorer/src/workflow-instance/manage/UpdateWorkflowInstanceStateVariableForm.tsx @@ -23,7 +23,10 @@ const UpdateWorkflowInstanceStateVariableForm = function (props: { }, actionDescription: values.actionDescription }).then((reason: any) => { - if (reason.error) { + if (!reason.ok) { + setErrorMsg(`HTTP error! status: ${reason.status}`); + setConfirmationMsg(''); + } else if (reason.error) { setErrorMsg(reason.error); setConfirmationMsg(''); } else {