From 3f752864aeecb0f64b5d64b00933d817cc5ae721 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 28 Feb 2019 22:16:04 +0100 Subject: [PATCH 1/4] Allow connecting nested collections to multiple=true inputs in workflow editor --- .../scripts/mvc/workflow/workflow-terminals.js | 15 +++++++-------- .../mvc/workflow/workflow-view-terminals.js | 4 +--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js index 9791cf2ec50..bff3cabf051 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js @@ -158,7 +158,13 @@ var Terminal = Backbone.Model.extend({ }, setMapOver: function(val) { if (this.multiple) { - return; // Cannot set this to be multirun... + // emulate list input + let description = new CollectionTypeDescription('list'); + if (val.collectionType === description.collectionType) { + // No mapping over necessary + return + } + val = val.effectiveMapOver ? val.effectiveMapOver(description): val; } if (!this.mapOver().equal(val)) { @@ -407,13 +413,6 @@ var InputTerminal = BaseInputTerminal.extend({ // collection (yet...) return false; } - if (otherCollectionType.rank == 1) { - return this._producesAcceptableDatatype(other); - } else { - // TODO: Allow subcollection mapping over this as if it were - // a list collection input. - return false; - } } if (thisMapOver.isCollection && thisMapOver.canMatch(otherCollectionType)) { return this._producesAcceptableDatatype(other); diff --git a/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js b/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js index a43e1be25b5..2458de63f78 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-view-terminals.js @@ -77,9 +77,7 @@ var BaseInputTerminalView = TerminalView.extend({ const name = input.name; const id = `node-${node.cid}-input-${name}`; const terminal = this.terminalForInput(input); - if (!terminal.multiple) { - this.setupMappingView(terminal); - } + this.setupMappingView(terminal); this.el.terminal = terminal; this.$el.attr("input-name", name); this.$el.attr("id", id); From 38219a2499af233edea95b3b7430ed359c9a752e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 1 Mar 2019 22:22:12 +0100 Subject: [PATCH 2/4] Only decrement output termninal map over Otherwise collection connections into multiple="true" inputs would be destroyed by the `destroyIfInvalid` check. --- client/galaxy/scripts/mvc/workflow/workflow-terminals.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js index bff3cabf051..2aa2ef71663 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js @@ -157,20 +157,21 @@ var Terminal = Backbone.Model.extend({ }); }, setMapOver: function(val) { + let output_val = val; if (this.multiple) { // emulate list input let description = new CollectionTypeDescription('list'); if (val.collectionType === description.collectionType) { // No mapping over necessary - return + return; } - val = val.effectiveMapOver ? val.effectiveMapOver(description): val; + output_val = val.effectiveMapOver ? val.effectiveMapOver(description): val; } if (!this.mapOver().equal(val)) { this.terminalMapping.setMapOver(val); _.each(this.node.output_terminals, outputTerminal => { - outputTerminal.setMapOver(val); + outputTerminal.setMapOver(output_val); }); } }, From ebd6c5cead38b257dab45a8990304d66ba695778 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 2 Mar 2019 12:52:50 +0100 Subject: [PATCH 3/4] Don't allow connection to paired input, fix qunit test --- client/galaxy/scripts/mvc/workflow/workflow-terminals.js | 4 ++++ .../galaxy/scripts/qunit/tests/workflow_editor_tests.js | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js index 2aa2ef71663..fd90296d9af 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-terminals.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-terminals.js @@ -414,6 +414,10 @@ var InputTerminal = BaseInputTerminal.extend({ // collection (yet...) return false; } + if (otherCollectionType.collectionType.endsWith('paired')) { + // shouldn't process pairs in multiple="true" input + return false; + } } if (thisMapOver.isCollection && thisMapOver.canMatch(otherCollectionType)) { return this._producesAcceptableDatatype(other); diff --git a/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js b/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js index 2836d353f27..5f997cc8382 100644 --- a/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js +++ b/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js @@ -1174,7 +1174,14 @@ QUnit.test("multiple input attachable by collections", function(assert) { this.verifyAttachable(assert, this.inputTerminal1, "list"); }); -QUnit.test("unconnected multiple inputs cannot be connected to rank > 1 collections (yet...)", function(assert) { +QUnit.test("multiple input attachable by nested collections", function(assert) { + this.inputTerminal1 = this.newInputTerminal(null, { multiple: true }); + var connectedInput1 = this.addConnectedInput(this.inputTerminal1); + this.addConnectedOutput(connectedInput1); + this.verifyAttachable(assert, this.inputTerminal1, "list:list"); +}); + +QUnit.test("Multiple inputs cannot be connected to pairs", function(assert) { this.inputTerminal1 = this.newInputTerminal(null, { multiple: true }); this.verifyNotAttachable(assert, this.inputTerminal1, "list:paired"); }); From 6c22f13e3ad7773337f84e72ab21d295f934ee9e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 4 Mar 2019 10:00:21 +0100 Subject: [PATCH 4/4] Fix qunit test --- client/galaxy/scripts/qunit/tests/workflow_editor_tests.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js b/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js index 5f997cc8382..4db44c86556 100644 --- a/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js +++ b/client/galaxy/scripts/qunit/tests/workflow_editor_tests.js @@ -545,6 +545,8 @@ QUnit.module("Node view ", { input_terminals: {}, output_terminals: {}, markChanged: function() {}, + hasConnectedOutputTerminals: function() {}, + connectedMappedInputTerminals: function() {}, terminalMapping: { disableMapOver: function() {} } }); },