diff --git a/client/src/components/Workflow/Editor/modules/terminals.js b/client/src/components/Workflow/Editor/modules/terminals.js index 51b39ab26c8..359c1c736bb 100644 --- a/client/src/components/Workflow/Editor/modules/terminals.js +++ b/client/src/components/Workflow/Editor/modules/terminals.js @@ -224,6 +224,15 @@ class BaseInputTerminal extends Terminal { this.datatypesMapper = attr.datatypesMapper; this.update(attr.input); // subclasses should implement this... } + setDefaultMapOver(connector) { + var other_output = connector.outputHandle; + if (other_output) { + var otherCollectionType = this._otherCollectionType(other_output); + if (otherCollectionType.isCollection) { + this.setMapOver(otherCollectionType); + } + } + } canAccept(other) { if (this._inputFilled()) { return new ConnectionAcceptable( @@ -385,14 +394,7 @@ class InputTerminal extends BaseInputTerminal { } connect(connector) { super.connect(connector); - var other_output = connector.outputHandle; - if (!other_output) { - return; - } - var otherCollectionType = this._otherCollectionType(other_output); - if (otherCollectionType.isCollection) { - this.setMapOver(otherCollectionType); - } + this.setDefaultMapOver(connector); } attachable(other) { var otherCollectionType = this._otherCollectionType(other); @@ -460,6 +462,10 @@ class InputParameterTerminal extends BaseInputTerminal { this.type = input.type; this.optional = input.optional; } + connect(connector) { + super.connect(connector); + this.setDefaultMapOver(connector); + } effectiveType(parameterType) { return parameterType == "select" ? "text" : parameterType; } diff --git a/client/tests/qunit/tests/workflow_editor_tests.js b/client/tests/qunit/tests/workflow_editor_tests.js index a55604b395f..bf4f43b7317 100644 --- a/client/tests/qunit/tests/workflow_editor_tests.js +++ b/client/tests/qunit/tests/workflow_editor_tests.js @@ -871,9 +871,9 @@ QUnit.test("resetMapping", function (assert) { }); QUnit.module("terminal mapping logic", { - newInputTerminal: function (mapOver, input, node) { + newInputTerminal: function (mapOver, input) { input = input || {}; - node = node || this.newNode(); + const node = this.newNode(); if (!("extensions" in input)) { input["extensions"] = ["data"]; } @@ -889,9 +889,19 @@ QUnit.module("terminal mapping logic", { } return inputTerminal; }, - newInputCollectionTerminal: function (input, node) { + newInputParameterTerminal: function () { + const node = this.newNode(); + const inputEl = $("
")[0]; + const inputTerminal = new Terminals.InputParameterTerminal({ + element: inputEl, + input: {}, + }); + inputTerminal.node = node; + return inputTerminal; + }, + newInputCollectionTerminal: function (input) { input = input || {}; - node = node || this.newNode(); + const node = this.newNode(); if (!("extensions" in input)) { input["extensions"] = ["data"]; } @@ -904,16 +914,12 @@ QUnit.module("terminal mapping logic", { }); return inputTerminal; }, - newOutputTerminal: function (mapOver, output, node) { - output = output || {}; - node = node || this.newNode(); - if (!("extensions" in output)) { - output["extensions"] = ["data"]; - } + newOutputTerminal: function (mapOver) { + const node = this.newNode(); const outputEl = $("
")[0]; const outputTerminal = new Terminals.OutputTerminal({ element: outputEl, - datatypes: output.extensions, + datatypes: ["data"], node: {}, }); outputTerminal.node = node; @@ -922,24 +928,17 @@ QUnit.module("terminal mapping logic", { } return outputTerminal; }, - newOutputCollectionTerminal: function (collectionType, output, node, mapOver) { + newOutputCollectionTerminal: function (collectionType) { collectionType = collectionType || "list"; - output = output || {}; - node = node || this.newNode(); - if (!("extensions" in output)) { - output["extensions"] = ["data"]; - } + const node = this.newNode(); const outputEl = $("
")[0]; const outputTerminal = new Terminals.OutputCollectionTerminal({ element: outputEl, - datatypes: output.extensions, + datatypes: ["data"], collection_type: collectionType, node: {}, }); outputTerminal.node = node; - if (mapOver) { - outputTerminal.setMapOver(new Terminals.CollectionTypeDescription(mapOver)); - } return outputTerminal; }, newNode: function () { @@ -1023,6 +1022,15 @@ QUnit.module("terminal mapping logic", { verifyNotMappedOver: function (assert, terminal) { assert.ok(!terminal.mapOver.isCollection); }, + verifyDefaultMapOver: function(assert, terminal) { + const outputCollectionTerminal = this.newOutputCollectionTerminal("list"); + assert.ok(!terminal.node.mapOver); + const connector = new Connector({}, outputCollectionTerminal, terminal); + outputCollectionTerminal.connect(connector); + assert.ok(terminal.node.mapOver); + terminal.disconnect(connector); + assert.ok(!terminal.node.mapOver); + } }); QUnit.test("unconstrained input can be mapped over", function (assert) { @@ -1280,13 +1288,12 @@ QUnit.test("simple mapping over collection outputs works correctly", function (a this.verifyNotAttachable(assert, testTerminal1, connectedOutput); }); -QUnit.test("node mapping state over collection outputs works correctly", function (assert) { - const inputTerminal1 = this.newInputTerminal(); - const outputCollectionTerminal1 = this.newOutputCollectionTerminal("list"); - assert.ok(!inputTerminal1.node.mapOver); - const connector = new Connector({}, outputCollectionTerminal1, inputTerminal1); - outputCollectionTerminal1.connect(connector); - assert.ok(inputTerminal1.node.mapOver); - inputTerminal1.disconnect(connector); - assert.ok(!inputTerminal1.node.mapOver); -}); \ No newline at end of file +QUnit.test("node input terminal mapping state over collection outputs works correctly", function (assert) { + const inputTerminal = this.newInputTerminal(); + this.verifyDefaultMapOver(assert, inputTerminal); +}); + +QUnit.test("node input parameter terminal mapping state over collection outputs works correctly", function (assert) { + const inputParameterTerminal = this.newInputParameterTerminal(); + this.verifyDefaultMapOver(assert, inputParameterTerminal); +}); diff --git a/lib/galaxy_test/selenium/test_workflow_editor.py b/lib/galaxy_test/selenium/test_workflow_editor.py index ca47f673b9a..854a5a41194 100644 --- a/lib/galaxy_test/selenium/test_workflow_editor.py +++ b/lib/galaxy_test/selenium/test_workflow_editor.py @@ -271,6 +271,32 @@ steps: self.workflow_editor_connect("input_int#output", "tool_exec#inttest", screenshot_partial="workflow_editor_parameter_connection_dragging") self.assert_connected("input_int#output", "tool_exec#inttest") + @selenium_test + def test_non_data_map_over_carried_through(self): + # Use auto_layout=false, which prevents placing any + # step outside of the scroll area + # xref: https://github.com/galaxyproject/galaxy/issues/13211 + self.open_in_workflow_editor(""" +class: GalaxyWorkflow +inputs: + input_collection: + type: collection + collection_type: "list" +steps: + param_value_from_file: + tool_id: param_value_from_file + in: + input1: input_collection + text_input_step: + tool_id: param_text_option + in: + text_param: param_value_from_file/text_param + collection_input: + tool_id: identifier_collection +""", auto_layout=False) + self.workflow_editor_connect("text_input_step#out_file1", "collection_input#input1") + self.assert_connected("text_input_step#out_file1", "collection_input#input1") + @selenium_test def test_existing_connections(self): self.open_in_workflow_editor(WORKFLOW_SIMPLE_CAT_TWICE) @@ -628,11 +654,12 @@ steps: source_id, sink_id = self.workflow_editor_source_sink_terminal_ids(source, sink) self.components.workflow_editor.connector_for(source_id=source_id, sink_id=sink_id).wait_for_absent() - def open_in_workflow_editor(self, yaml_content): + def open_in_workflow_editor(self, yaml_content, auto_layout=True): name = self.workflow_upload_yaml_with_random_name(yaml_content) self.workflow_index_open() self.workflow_index_open_with_name(name) - self.workflow_editor_click_option("Auto Layout") + if auto_layout: + self.workflow_editor_click_option("Auto Layout") return name def workflow_editor_source_sink_terminal_ids(self, source, sink):