Merge pull request #7435 from mvdbeek/multiple_true_nesting_wf_editor

Allow connecting nested collections to multiple=true inputs in workflow editor
This commit is contained in:
John Chilton
2019-03-04 09:34:56 -05:00
committed by GitHub
3 changed files with 22 additions and 11 deletions
@@ -157,14 +157,21 @@ var Terminal = Backbone.Model.extend({
});
},
setMapOver: function(val) {
let output_val = 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;
}
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);
});
}
},
@@ -407,11 +414,8 @@ 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.
if (otherCollectionType.collectionType.endsWith('paired')) {
// shouldn't process pairs in multiple="true" input
return false;
}
}
@@ -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);
@@ -545,6 +545,8 @@ QUnit.module("Node view ", {
input_terminals: {},
output_terminals: {},
markChanged: function() {},
hasConnectedOutputTerminals: function() {},
connectedMappedInputTerminals: function() {},
terminalMapping: { disableMapOver: function() {} }
});
},
@@ -1174,7 +1176,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");
});