mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #5021 from dannon/fix-workflow-editor-outputs
Workflow editor outputs fixes
This commit is contained in:
@@ -98,12 +98,14 @@ var Tool = Backbone.View.extend({
|
||||
__class__: "RuntimeValue"
|
||||
};
|
||||
input.is_workflow =
|
||||
(input.options && input.options.length == 0) || ["integer", "float"].indexOf(input.type) != -1;
|
||||
(input.options && input.options.length === 0) || ["integer", "float"].indexOf(input.type) != -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
Utils.deepeach(options.inputs, input => {
|
||||
input.type == "conditional" && (input.test_param.collapsible_value = undefined);
|
||||
if (input.type === "conditional") {
|
||||
input.test_param.collapsible_value = undefined;
|
||||
}
|
||||
});
|
||||
_addSections(form);
|
||||
_addLabelAnnotation(form);
|
||||
@@ -151,182 +153,186 @@ function _addLabelAnnotation(form) {
|
||||
});
|
||||
}
|
||||
|
||||
/** Visit input nodes and enrich by name/value pairs from server data */
|
||||
function _visit(head, head_list, output_id, options) {
|
||||
var post_job_actions = options.node.post_job_actions;
|
||||
head_list = head_list || [];
|
||||
head_list.push(head);
|
||||
for (var i in head.inputs) {
|
||||
var input = head.inputs[i];
|
||||
var action = input.action;
|
||||
if (action) {
|
||||
input.name = `pja__${output_id}__${input.action}`;
|
||||
if (input.pja_arg) {
|
||||
input.name += `__${input.pja_arg}`;
|
||||
}
|
||||
if (input.payload) {
|
||||
for (var p_id in input.payload) {
|
||||
input.payload[`${input.name}__${p_id}`] = input.payload[p_id];
|
||||
delete input.payload[p_id];
|
||||
}
|
||||
}
|
||||
var d = post_job_actions[input.action + output_id];
|
||||
if (d) {
|
||||
for (var j in head_list) {
|
||||
head_list[j].expanded = true;
|
||||
}
|
||||
if (input.pja_arg) {
|
||||
input.value = (d.action_arguments && d.action_arguments[input.pja_arg]) || input.value;
|
||||
} else {
|
||||
input.value = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (input.inputs) {
|
||||
_visit(input, head_list.slice(0), output_id, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Builds sub section with step actions/annotation */
|
||||
function _makeSection(output_id, options) {
|
||||
var extensions = [];
|
||||
var input_terminal_names = [];
|
||||
var datatypes = options.datatypes;
|
||||
var node = options.node;
|
||||
var workflow = options.workflow;
|
||||
|
||||
for (var key in datatypes) {
|
||||
extensions.push({ 0: datatypes[key], 1: datatypes[key] });
|
||||
}
|
||||
for (key in node.input_terminals) {
|
||||
input_terminal_names.push(node.input_terminals[key].name);
|
||||
}
|
||||
extensions.sort((a, b) => (a.label > b.label ? 1 : a.label < b.label ? -1 : 0));
|
||||
extensions.unshift({
|
||||
0: "Sequences",
|
||||
1: "Sequences"
|
||||
});
|
||||
extensions.unshift({
|
||||
0: "Roadmaps",
|
||||
1: "Roadmaps"
|
||||
});
|
||||
extensions.unshift({
|
||||
0: "Leave unchanged",
|
||||
1: "__empty__"
|
||||
});
|
||||
var output;
|
||||
var input_config = {
|
||||
title: `Configure Output: '${output_id}'`,
|
||||
type: "section",
|
||||
flat: true,
|
||||
inputs: [
|
||||
{
|
||||
label: "Label",
|
||||
type: "text",
|
||||
value: ((output = node.getWorkflowOutput(output_id)) && output.label) || "",
|
||||
help: "This will provide a short name to describe the output - this must be unique across workflows.",
|
||||
onchange: function(new_value) {
|
||||
workflow.attemptUpdateOutputLabel(node, output_id, new_value);
|
||||
}
|
||||
},
|
||||
{
|
||||
action: "RenameDatasetAction",
|
||||
pja_arg: "newname",
|
||||
label: "Rename dataset",
|
||||
type: "text",
|
||||
value: "",
|
||||
ignore: "",
|
||||
help: `This action will rename the output dataset. Click <a href="https://galaxyproject.org/learn/advanced-workflow/variables/">here</a> for more information. Valid inputs are: <strong>${input_terminal_names.join(
|
||||
", "
|
||||
)}</strong>.`
|
||||
},
|
||||
{
|
||||
action: "ChangeDatatypeAction",
|
||||
pja_arg: "newtype",
|
||||
label: "Change datatype",
|
||||
type: "select",
|
||||
ignore: "__empty__",
|
||||
value: "__empty__",
|
||||
options: extensions,
|
||||
help: "This action will change the datatype of the output to the indicated value."
|
||||
},
|
||||
{
|
||||
action: "TagDatasetAction",
|
||||
pja_arg: "tags",
|
||||
label: "Add Tags",
|
||||
type: "text",
|
||||
value: "",
|
||||
ignore: "",
|
||||
help: "This action will set tags for the dataset."
|
||||
},
|
||||
{
|
||||
action: "RemoveTagDatasetAction",
|
||||
pja_arg: "tags",
|
||||
label: "Remove Tags",
|
||||
type: "text",
|
||||
value: "",
|
||||
ignore: "",
|
||||
help: "This action will remove tags for the dataset."
|
||||
},
|
||||
{
|
||||
title: "Assign columns",
|
||||
type: "section",
|
||||
flat: true,
|
||||
inputs: [
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "chromCol",
|
||||
label: "Chrom column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "startCol",
|
||||
label: "Start column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "endCol",
|
||||
label: "End column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "strandCol",
|
||||
label: "Strand column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "nameCol",
|
||||
label: "Name column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
}
|
||||
],
|
||||
help: "This action will set column assignments in the output dataset. Blank fields are ignored."
|
||||
}
|
||||
]
|
||||
};
|
||||
_visit(input_config, [], output_id, options);
|
||||
return input_config;
|
||||
}
|
||||
|
||||
/** Builds all sub sections */
|
||||
function _addSections(form) {
|
||||
var options = form.model.attributes;
|
||||
var inputs = options.inputs;
|
||||
var datatypes = options.datatypes;
|
||||
var node = options.node;
|
||||
var workflow = options.workflow;
|
||||
var post_job_actions = node.post_job_actions;
|
||||
var output_id = node.output_terminals && Object.keys(node.output_terminals)[0];
|
||||
|
||||
/** Visit input nodes and enrich by name/value pairs from server data */
|
||||
function visit(head, head_list) {
|
||||
head_list = head_list || [];
|
||||
head_list.push(head);
|
||||
for (var i in head.inputs) {
|
||||
var input = head.inputs[i];
|
||||
var action = input.action;
|
||||
if (action) {
|
||||
input.name = `pja__${output_id}__${input.action}`;
|
||||
if (input.pja_arg) {
|
||||
input.name += `__${input.pja_arg}`;
|
||||
}
|
||||
if (input.payload) {
|
||||
for (var p_id in input.payload) {
|
||||
input.payload[`${input.name}__${p_id}`] = input.payload[p_id];
|
||||
delete input.payload[p_id];
|
||||
}
|
||||
}
|
||||
var d = post_job_actions[input.action + output_id];
|
||||
if (d) {
|
||||
for (var j in head_list) {
|
||||
head_list[j].expanded = true;
|
||||
}
|
||||
if (input.pja_arg) {
|
||||
input.value = (d.action_arguments && d.action_arguments[input.pja_arg]) || input.value;
|
||||
} else {
|
||||
input.value = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
input.inputs && visit(input, head_list.slice(0));
|
||||
}
|
||||
}
|
||||
|
||||
/** Builds sub section with step actions/annotation */
|
||||
function _makeSection(output_id, datatypes) {
|
||||
var extensions = [];
|
||||
var input_terminal_names = [];
|
||||
for (var key in datatypes) {
|
||||
extensions.push({ 0: datatypes[key], 1: datatypes[key] });
|
||||
}
|
||||
for (key in node.input_terminals) {
|
||||
input_terminal_names.push(node.input_terminals[key].name);
|
||||
}
|
||||
extensions.sort((a, b) => (a.label > b.label ? 1 : a.label < b.label ? -1 : 0));
|
||||
extensions.unshift({
|
||||
0: "Sequences",
|
||||
1: "Sequences"
|
||||
});
|
||||
extensions.unshift({
|
||||
0: "Roadmaps",
|
||||
1: "Roadmaps"
|
||||
});
|
||||
extensions.unshift({
|
||||
0: "Leave unchanged",
|
||||
1: "__empty__"
|
||||
});
|
||||
var output;
|
||||
var input_config = {
|
||||
title: `Configure Output: '${output_id}'`,
|
||||
type: "section",
|
||||
flat: true,
|
||||
inputs: [
|
||||
{
|
||||
label: "Label",
|
||||
type: "text",
|
||||
value: ((output = node.getWorkflowOutput(output_id)) && output.label) || "",
|
||||
help:
|
||||
"This will provide a short name to describe the output - this must be unique across workflows.",
|
||||
onchange: function(new_value) {
|
||||
workflow.attemptUpdateOutputLabel(node, output_id, new_value);
|
||||
}
|
||||
},
|
||||
{
|
||||
action: "RenameDatasetAction",
|
||||
pja_arg: "newname",
|
||||
label: "Rename dataset",
|
||||
type: "text",
|
||||
value: "",
|
||||
ignore: "",
|
||||
help: `This action will rename the output dataset. Click <a href="https://galaxyproject.org/learn/advanced-workflow/variables/">here</a> for more information. Valid inputs are: <strong>${input_terminal_names.join(
|
||||
", "
|
||||
)}</strong>.`
|
||||
},
|
||||
{
|
||||
action: "ChangeDatatypeAction",
|
||||
pja_arg: "newtype",
|
||||
label: "Change datatype",
|
||||
type: "select",
|
||||
ignore: "__empty__",
|
||||
value: "__empty__",
|
||||
options: extensions,
|
||||
help: "This action will change the datatype of the output to the indicated value."
|
||||
},
|
||||
{
|
||||
action: "TagDatasetAction",
|
||||
pja_arg: "tags",
|
||||
label: "Add Tags",
|
||||
type: "text",
|
||||
value: "",
|
||||
ignore: "",
|
||||
help: "This action will set tags for the dataset."
|
||||
},
|
||||
{
|
||||
action: "RemoveTagDatasetAction",
|
||||
pja_arg: "tags",
|
||||
label: "Remove Tags",
|
||||
type: "text",
|
||||
value: "",
|
||||
ignore: "",
|
||||
help: "This action will remove tags for the dataset."
|
||||
},
|
||||
{
|
||||
title: "Assign columns",
|
||||
type: "section",
|
||||
flat: true,
|
||||
inputs: [
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "chromCol",
|
||||
label: "Chrom column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "startCol",
|
||||
label: "Start column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "endCol",
|
||||
label: "End column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "strandCol",
|
||||
label: "Strand column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
},
|
||||
{
|
||||
action: "ColumnSetAction",
|
||||
pja_arg: "nameCol",
|
||||
label: "Name column",
|
||||
type: "integer",
|
||||
value: "",
|
||||
ignore: ""
|
||||
}
|
||||
],
|
||||
help: "This action will set column assignments in the output dataset. Blank fields are ignored."
|
||||
}
|
||||
]
|
||||
};
|
||||
visit(input_config);
|
||||
return input_config;
|
||||
}
|
||||
|
||||
if (output_id) {
|
||||
inputs.push({
|
||||
name: `pja__${output_id}__EmailAction`,
|
||||
@@ -349,7 +355,7 @@ function _addSections(form) {
|
||||
"Upon completion of this step, delete non-starred outputs from completed workflow steps if they are no longer required as inputs."
|
||||
});
|
||||
for (var i in node.output_terminals) {
|
||||
inputs.push(_makeSection(i, datatypes));
|
||||
inputs.push(_makeSection(i, options));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ var Node = Backbone.Model.extend({
|
||||
});
|
||||
},
|
||||
isWorkflowOutput: function(outputName) {
|
||||
return this.getWorkflowOutput(outputName) != undefined;
|
||||
return this.getWorkflowOutput(outputName) !== undefined;
|
||||
},
|
||||
removeWorkflowOutput: function(outputName) {
|
||||
while (this.isWorkflowOutput(outputName)) {
|
||||
@@ -25,7 +25,7 @@ var Node = Backbone.Model.extend({
|
||||
if (!this.isWorkflowOutput(outputName)) {
|
||||
var output = { output_name: outputName };
|
||||
if (label) {
|
||||
output["label"] = label;
|
||||
output.label = label;
|
||||
}
|
||||
this.workflow_outputs.push(output);
|
||||
return true;
|
||||
@@ -37,8 +37,8 @@ var Node = Backbone.Model.extend({
|
||||
var oldLabel = null;
|
||||
if (this.isWorkflowOutput(outputName)) {
|
||||
var workflowOutput = this.getWorkflowOutput(outputName);
|
||||
oldLabel = workflowOutput["label"];
|
||||
workflowOutput["label"] = label;
|
||||
oldLabel = workflowOutput.label;
|
||||
workflowOutput.label = label;
|
||||
changed = oldLabel != label;
|
||||
} else {
|
||||
changed = this.addWorkflowOutput(outputName, label);
|
||||
@@ -239,7 +239,7 @@ var Node = Backbone.Model.extend({
|
||||
this.config_form = data.config_form;
|
||||
this.tool_version = this.config_form && this.config_form.version;
|
||||
this.errors = data.errors;
|
||||
this.annotation = data["annotation"];
|
||||
this.annotation = data.annotation;
|
||||
this.label = data.label;
|
||||
if ("post_job_actions" in data) {
|
||||
// Won't be present in response for data inputs
|
||||
@@ -271,7 +271,7 @@ var Node = Backbone.Model.extend({
|
||||
old_body.replaceWith(new_body);
|
||||
if ("workflow_outputs" in data) {
|
||||
// Won't be present in response for data inputs
|
||||
this.workflow_outputs = workflow_outputs ? workflow_outputs : [];
|
||||
this.workflow_outputs = data.workflow_outputs ? data.workflow_outputs : [];
|
||||
}
|
||||
// If active, reactivate with new config_form
|
||||
this.markChanged();
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user