Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into bibtex-replacement-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Nov 21, 2017
2 parents 5b53147 + 1d72b26 commit 8426158
Show file tree
Hide file tree
Showing 19 changed files with 353 additions and 188 deletions.
346 changes: 176 additions & 170 deletions client/galaxy/scripts/mvc/workflow/workflow-forms.js
Expand Up @@ -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);
Expand Down Expand Up @@ -151,181 +153,185 @@ function _addLabelAnnotation(form) {
});
}

/** 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}`;
/** 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];
}
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;
}
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.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));
}
if (input.inputs) {
_visit(input, head_list.slice(0), output_id, options);
}
}
}

/** 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;
/** 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 node = options.node;
var post_job_actions = node.post_job_actions;
var output_id = node.output_terminals && Object.keys(node.output_terminals)[0];

if (output_id) {
inputs.push({
Expand All @@ -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));
}
}
}
Expand Down

0 comments on commit 8426158

Please sign in to comment.