mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 00:03:57 +08:00
Distinguish tool datatype and PJA (=forced_dataype)
This makes it easier switching back to the default datatype and unifies front- and backend changes. This fixes https://github.com/galaxyproject/galaxy/issues/7965 and https://github.com/galaxyproject/galaxy/issues/4813
This commit is contained in:
@@ -278,6 +278,9 @@ function _makeSection(output_id, label, options) {
|
||||
options: extensions,
|
||||
help: "This action will change the datatype of the output to the indicated datatype.",
|
||||
onchange: function(new_value) {
|
||||
if (new_value === '__empty__') {
|
||||
new_value = null;
|
||||
}
|
||||
workflow.updateDatatype(node, output_id, new_value);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -63,10 +63,11 @@ var Node = Backbone.Model.extend({
|
||||
changeOutputDatatype: function(outputName, datatype) {
|
||||
const output_terminal = this.output_terminals[outputName];
|
||||
const output = this.nodeView.outputViews[outputName].output;
|
||||
output_terminal.datatypes = [datatype];
|
||||
output.extensions = [datatype];
|
||||
output_terminal.force_datatype = datatype;
|
||||
output.force_datatype = datatype;
|
||||
this.nodeView.updateDataOutputView(output);
|
||||
this.markChanged();
|
||||
output_terminal.destroyInvalidConnections();
|
||||
},
|
||||
connectedOutputTerminals: function() {
|
||||
return this._connectedTerminals(this.output_terminals);
|
||||
@@ -284,6 +285,7 @@ var Node = Backbone.Model.extend({
|
||||
// the output already exists, but the output formats may have changed.
|
||||
// Therefore we update the datatypes and destroy invalid connections.
|
||||
node.output_terminals[output.name].datatypes = output.extensions;
|
||||
node.output_terminals[output.name].force_datatype = output.force_datatype;
|
||||
if (node.type == "parameter_input") {
|
||||
node.output_terminals[output.name].attributes.type = output.type;
|
||||
}
|
||||
|
||||
@@ -212,6 +212,7 @@ var OutputTerminal = Terminal.extend({
|
||||
initialize: function(attr) {
|
||||
Terminal.prototype.initialize.call(this, attr);
|
||||
this.datatypes = attr.datatypes;
|
||||
this.force_datatype = attr.force_datatype;
|
||||
},
|
||||
|
||||
resetMappingIfNeeded: function() {
|
||||
@@ -354,19 +355,8 @@ var BaseInputTerminal = Terminal.extend({
|
||||
return new ConnectionAcceptable(true, null);
|
||||
}
|
||||
var cat_outputs = [];
|
||||
cat_outputs = cat_outputs.concat(other.datatypes);
|
||||
if (other.node.post_job_actions) {
|
||||
for (var pja_i in other.node.post_job_actions) {
|
||||
var pja = other.node.post_job_actions[pja_i];
|
||||
if (
|
||||
pja.action_type == "ChangeDatatypeAction" &&
|
||||
(pja.output_name === "" || pja.output_name == other.name) &&
|
||||
pja.action_arguments
|
||||
) {
|
||||
cat_outputs.push(pja.action_arguments.newtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
const other_datatypes = other.force_datatype ? [other.force_datatype] : other.datatypes;
|
||||
cat_outputs = cat_outputs.concat(other_datatypes);
|
||||
// FIXME: No idea what to do about case when datatype is 'input'
|
||||
for (var other_datatype_i in cat_outputs) {
|
||||
var other_datatype = cat_outputs[other_datatype_i];
|
||||
@@ -615,6 +605,7 @@ var OutputCollectionTerminal = Terminal.extend({
|
||||
initialize: function(attr) {
|
||||
Terminal.prototype.initialize.call(this, attr);
|
||||
this.datatypes = attr.datatypes;
|
||||
this.force_datatype = attr.force_datatype;
|
||||
if (attr.collection_type) {
|
||||
this.collectionType = new CollectionTypeDescription(attr.collection_type);
|
||||
} else {
|
||||
|
||||
@@ -49,7 +49,7 @@ var DataOutputView = Backbone.View.extend({
|
||||
|
||||
var isInput = output.extensions.indexOf("input") >= 0 || output.extensions.indexOf("input_collection") >= 0;
|
||||
if (!isInput) {
|
||||
label = `${label} (${output.extensions.join(", ")})`;
|
||||
label = `${label} (${output.force_datatype || output.extensions.join(", ")})`;
|
||||
}
|
||||
this.$el.html(label);
|
||||
this.calloutView = null;
|
||||
|
||||
@@ -115,7 +115,7 @@ export default Backbone.View.extend({
|
||||
this.tool_body.append(outputView.$el.append(terminalView.terminalElements()));
|
||||
},
|
||||
|
||||
updateDataOutputView(output){
|
||||
updateDataOutputView: function(output) {
|
||||
const terminalView = this.terminalViewForOutput(output);
|
||||
const outputView = this.outputViews[output.name];
|
||||
const newOutputView = this.outputViewforOutput(output, terminalView);
|
||||
|
||||
@@ -291,7 +291,8 @@ var OutputTerminalView = BaseOutputTerminalView.extend({
|
||||
var type = output.extensions;
|
||||
var terminal = new Terminals.OutputTerminal({
|
||||
element: this.el,
|
||||
datatypes: type
|
||||
datatypes: type,
|
||||
force_datatype: output.force_datatype,
|
||||
});
|
||||
return terminal;
|
||||
}
|
||||
@@ -307,7 +308,8 @@ var OutputCollectionTerminalView = BaseOutputTerminalView.extend({
|
||||
element: this.el,
|
||||
collection_type: collection_type,
|
||||
collection_type_source: collection_type_source,
|
||||
datatypes: output.extensions
|
||||
datatypes: output.extensions,
|
||||
force_datatype: output.force_datatype,
|
||||
});
|
||||
return terminal;
|
||||
}
|
||||
|
||||
@@ -645,6 +645,10 @@ class WorkflowContentsManager(UsesAnnotations):
|
||||
output_name=pja.output_name,
|
||||
action_arguments=pja.action_arguments
|
||||
)
|
||||
if pja.action_type == 'ChangeDatatypeAction':
|
||||
for output in step_dict['outputs']:
|
||||
if output['name'] == pja.output_name:
|
||||
output['force_datatype'] = [pja.action_arguments['newtype']]
|
||||
step_dict['post_job_actions'] = pja_dict
|
||||
|
||||
# workflow outputs
|
||||
|
||||
Reference in New Issue
Block a user