From ceea0a5dd5fb90f12a68771d445ad1470cec92d8 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 16 Sep 2022 19:17:44 +0200 Subject: [PATCH 1/2] Allow using simplified workflow run form with unconnected optional data input Fixes https://github.com/galaxyproject/galaxy/issues/13247. I'm not sure we need any other special treatment for optional data inputs, just don't set them seems sufficient to me? I think that's the natural course of action from the API consumer perspective. Whether we want to track this more robsutly in the backend and whether we want to require explicitly stating that optional data inputs must be set as not specifyiable are separate questions IMO. FWIW the best practices panel only checks for disconnected required data inputs, so that brings the experience in line. --- client/src/components/Workflow/Run/model.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/Workflow/Run/model.js b/client/src/components/Workflow/Run/model.js index efe09e6720b..9be78546cff 100644 --- a/client/src/components/Workflow/Run/model.js +++ b/client/src/components/Workflow/Run/model.js @@ -153,8 +153,9 @@ export class WorkflowRunModel { (data_ref.step_linked && !isDataStep(data_ref.step_linked)) || input.wp_linked; } if ( - is_data_input || - (input.value && input.value.__class__ == "RuntimeValue" && !input.step_linked) + !input.optional && + (is_data_input || + (input.value && input.value.__class__ == "RuntimeValue" && !input.step_linked)) ) { step.expanded = true; hasOpenToolSteps = true; From 0d7149c3299c6b92f6ab0595ac729ff2645a0c9e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 19 Sep 2022 11:25:01 +0200 Subject: [PATCH 2/2] Test that optional data inputs render with simplified form --- .../Workflow/Run/WorkflowRun.test.js | 1 + .../src/components/Workflow/Run/model.test.js | 48 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/client/src/components/Workflow/Run/WorkflowRun.test.js b/client/src/components/Workflow/Run/WorkflowRun.test.js index 63e954522cf..7841af064fb 100644 --- a/client/src/components/Workflow/Run/WorkflowRun.test.js +++ b/client/src/components/Workflow/Run/WorkflowRun.test.js @@ -49,6 +49,7 @@ describe("WorkflowRun.vue", () => { expect(wrapper.vm.error).toBeNull(); expect(wrapper.vm.loading).toBe(false); + expect(wrapper.vm.simpleForm).toBe(false); const model = wrapper.vm.model; expect(model).not.toBeNull(); expect(model.workflowId).toBe(run1WorkflowId); diff --git a/client/src/components/Workflow/Run/model.test.js b/client/src/components/Workflow/Run/model.test.js index 09b80303241..64c9f0814fc 100644 --- a/client/src/components/Workflow/Run/model.test.js +++ b/client/src/components/Workflow/Run/model.test.js @@ -1,4 +1,5 @@ -import { getReplacements } from "./model"; +import { getReplacements, WorkflowRunModel } from "./model"; +import sampleRunData1 from "./testdata/run1.json"; describe("test basic parameter replacement", () => { it("should replace", async () => { @@ -15,3 +16,48 @@ describe("test basic parameter replacement", () => { expect(result.input_2.values[0]).toEqual("input_new_data"); }); }); + +describe("WorkflowRunModel status", () => { + it("expands tool steps with disconnected data inputs", async () => { + const runModel = new WorkflowRunModel(sampleRunData1); + expect(runModel.hasOpenToolSteps).toBe(true); + }); + it("collapses tool steps with optional disconnected data inputs", async () => { + const optionalDataSteps = { + ...sampleRunData1, + steps: [ + { + id: "cat", + inputs: [ + { + label: "Concatenate Dataset", + model_class: "DataToolParameter", + multiple: false, + name: "input1", + optional: true, + options: { + hda: [], + hdca: [], + }, + text_value: "Not available.", + type: "data", + value: { + __class__: "RuntimeValue", + }, + }, + ], + model_class: "Tool", + name: "Concatenate datasets (for test workflows)", + replacement_parameters: [], + step_index: 0, + step_label: "", + step_name: "Concatenate datasets (for test workflows)", + step_type: "tool", + step_version: "1.0.0", + }, + ], + }; + const runModel = new WorkflowRunModel(optionalDataSteps); + expect(runModel.hasOpenToolSteps).toBe(false); + }); +});