From 21f40a80883013834ab98d1723935c6606c49916 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 10 Jun 2021 12:45:42 +0200 Subject: [PATCH] Add basic failed-to-submit error handling to simplified workflow run form --- .../Workflow/Run/WorkflowRun.test.js | 19 +++++++++++++++++++ .../components/Workflow/Run/WorkflowRun.vue | 9 +++++++++ .../Workflow/Run/WorkflowRunFormSimple.vue | 1 + 3 files changed, 29 insertions(+) diff --git a/client/src/components/Workflow/Run/WorkflowRun.test.js b/client/src/components/Workflow/Run/WorkflowRun.test.js index 5ee08035a06..2e2bf583864 100644 --- a/client/src/components/Workflow/Run/WorkflowRun.test.js +++ b/client/src/components/Workflow/Run/WorkflowRun.test.js @@ -58,4 +58,23 @@ describe("WorkflowRun.vue", () => { expect(model.hasStepVersionChanges).toBe(false); expect(model.wpInputs.wf_param.label).toBe("wf_param"); }); + + it("displays submission error", async () => { + // waits for vue to render wrapper + await localVue.nextTick(); + + expect(wrapper.vm.loading).toBe(true); + expect(wrapper.vm.error).toBeNull(); + expect(wrapper.vm.model).toBeNull(); + + await watchForChange({ vm: wrapper.vm, propName: "loading" }); + + expect(wrapper.vm.error).toBeNull(); + expect(wrapper.vm.loading).toBe(false); + expect(wrapper.find("b-alert-stub").exists()).toBe(false); + wrapper.vm.handleSubmissionError("Some exception here"); + await localVue.nextTick(); + expect(wrapper.vm.submissionError).toBe("Some exception here"); + expect(wrapper.find("b-alert-stub").attributes("variant")).toEqual("danger"); + }); }); diff --git a/client/src/components/Workflow/Run/WorkflowRun.vue b/client/src/components/Workflow/Run/WorkflowRun.vue index 86c3824a07c..c7d1ee31425 100644 --- a/client/src/components/Workflow/Run/WorkflowRun.vue +++ b/client/src/components/Workflow/Run/WorkflowRun.vue @@ -25,6 +25,9 @@ instance. To upgrade your workflow and dismiss this message simply edit the workflow and re-save it. + + Workflow submission failed: {{ submissionError }} +
@@ -56,6 +59,7 @@ :target-history="simpleFormTargetHistory" :use-job-cache="simpleFormUseJobCache" @submissionSuccess="handleInvocations" + @submissionError="handleSubmissionError" /> Expand to full workflow form. @@ -111,6 +115,7 @@ export default { runButtonPercentage: -1, invocations: null, simpleForm: null, + submissionError: null, model: null, }; }, @@ -160,6 +165,7 @@ export default { methods: { execute() { this.$refs.runform.execute(); + this.submissionError = null; }, setRunButtonStatus(enabled, waitText, percentage) { this.runButtonEnabled = enabled; @@ -169,6 +175,9 @@ export default { handleInvocations(invocations) { this.invocations = invocations; }, + handleSubmissionError(error) { + this.submissionError = errorMessageAsString(error); + }, showAdvanced() { this.simpleForm = false; }, diff --git a/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue b/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue index dd43cd81cbf..b3809a92104 100644 --- a/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue +++ b/client/src/components/Workflow/Run/WorkflowRunFormSimple.vue @@ -105,6 +105,7 @@ export default { }) .catch((error) => { console.log(error); + this.$emit("submissionError", error); }); }, },