From 1bdd9e7af54c554ed12717be8a7ca6071166155c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 19 Nov 2024 11:00:23 +0100 Subject: [PATCH 1/2] Make runtime value in optional parameter open legacy workflow run form We can only accept disconnected optional data inputs, for all other parameters we need to replace the runtime value placeholder. --- client/src/components/Workflow/Run/model.js | 26 +++++++++------------ 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/client/src/components/Workflow/Run/model.js b/client/src/components/Workflow/Run/model.js index 29eeca92c369..1238146d7ba6 100644 --- a/client/src/components/Workflow/Run/model.js +++ b/client/src/components/Workflow/Run/model.js @@ -136,34 +136,30 @@ export class WorkflowRunModel { // or if an explicit reference is specified as data_ref and available _.each(this.steps, (step) => { if (step.step_type == "tool") { - var data_resolved = true; + let dataResolved = true; visitInputs(step.inputs, (input, name, context) => { - var is_runtime_value = input.value && input.value.__class__ == "RuntimeValue"; - var is_data_input = ["data", "data_collection"].indexOf(input.type) != -1; - var data_ref = context[input.data_ref]; + const isRuntimeValue = input.value && input.value.__class__ == "RuntimeValue"; + const isDataInput = ["data", "data_collection"].indexOf(input.type) != -1; + const dataRef = context[input.data_ref]; if (input.step_linked && !isDataStep(input.step_linked)) { - data_resolved = false; + dataResolved = false; } - if (input.options && ((input.options.length == 0 && !data_resolved) || input.wp_linked)) { + if (input.options && ((input.options.length == 0 && !dataResolved) || input.wp_linked)) { input.is_workflow = true; } - if (data_ref) { + if (dataRef) { input.is_workflow = - (data_ref.step_linked && !isDataStep(data_ref.step_linked)) || input.wp_linked; + (dataRef.step_linked && !isDataStep(dataRef.step_linked)) || input.wp_linked; } - if ( - !input.optional && - (is_data_input || - (input.value && input.value.__class__ == "RuntimeValue" && !input.step_linked)) - ) { + if ((isDataInput && !input.optional) || (!isDataInput && isRuntimeValue && !input.step_linked)) { step.expanded = true; hasOpenToolSteps = true; } - if (is_runtime_value) { + if (isRuntimeValue) { input.value = null; } input.flavor = "workflow"; - if (!is_runtime_value && !is_data_input && input.type !== "hidden" && !input.wp_linked) { + if (!isRuntimeValue && !isDataInput && input.type !== "hidden" && !input.wp_linked) { if (input.optional || (!isEmpty(input.value) && input.value !== "")) { input.collapsible_value = input.value; input.collapsible_preview = true; From 29da6fec23f16e1813b4a13cbff984a05bc32077 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 19 Nov 2024 13:26:17 +0100 Subject: [PATCH 2/2] Add selenium test for optional runtime parameter submission --- lib/galaxy_test/selenium/test_workflow_run.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/galaxy_test/selenium/test_workflow_run.py b/lib/galaxy_test/selenium/test_workflow_run.py index 047681aa0f45..5405545ce2e1 100644 --- a/lib/galaxy_test/selenium/test_workflow_run.py +++ b/lib/galaxy_test/selenium/test_workflow_run.py @@ -75,6 +75,29 @@ def test_runtime_parameters_simple(self): self._assert_has_3_lines_after_run(hid=2) + @selenium_test + @managed_history + def test_runtime_parameters_simple_optional(self): + self.workflow_run_open_workflow( + """ +class: GalaxyWorkflow +inputs: {} +steps: + int_step: + tool_id: expression_null_handling_integer + runtime_inputs: + - int_input +""" + ) + self.tool_parameter_div("int_input") + self._set_num_lines_to_3("int_input") + self.screenshot("workflow_run_optional_runtime_parameters_modified") + self.workflow_run_submit() + self.workflow_run_wait_for_ok(hid=1) + history_id = self.current_history_id() + content = self.dataset_populator.get_history_dataset_content(history_id, hid=1) + assert json.loads(content) == 3 + @selenium_test @managed_history def test_subworkflows_expanded(self):