diff --git a/client/galaxy/docs/bootstrap.md b/client/galaxy/docs/bootstrap.md index e44d6423e84..ec879739331 100644 --- a/client/galaxy/docs/bootstrap.md +++ b/client/galaxy/docs/bootstrap.md @@ -135,8 +135,8 @@ Disabled ```
- Default Primary + Secondary Success Warning Danger diff --git a/client/galaxy/scripts/galaxy.pages.js b/client/galaxy/scripts/galaxy.pages.js index 2144f436268..a8bb8b9ccc4 100644 --- a/client/galaxy/scripts/galaxy.pages.js +++ b/client/galaxy/scripts/galaxy.pages.js @@ -447,7 +447,11 @@ WYMeditor.editor.prototype.dialog = function(dialogType, dialogFeatures, bodyHtm // Get item ID and name. var item_id = elt.val(); // Use ':first' because there are many labels in table; the first one is the item name. - var item_name = elt.closest('td').next('td').find('label').text(); + var item_name = elt + .closest("td") + .next("td") + .find("label") + .text(); if (make_importable) make_item_importable(item_info.controller, item_id, item_info.singular); diff --git a/client/galaxy/scripts/mvc/dataset/dataset-error.js b/client/galaxy/scripts/mvc/dataset/dataset-error.js index 74f735eab7e..6a288277b51 100644 --- a/client/galaxy/scripts/mvc/dataset/dataset-error.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-error.js @@ -2,6 +2,12 @@ import _l from "utils/localization"; import Utils from "utils/utils"; import Ui from "mvc/ui/ui-misc"; import Form from "mvc/form/form-view"; +import * as Backbone from "backbone"; +import * as _ from "underscore"; + +/* global Galaxy */ +/* global $ */ + /** Dataset edit attributes view */ var View = Backbone.View.extend({ initialize: function() { @@ -57,12 +63,23 @@ var View = Backbone.View.extend({

An error occured while running the tool ${job.tool_id}.

Tool execution generated the following messages:

${_.escape(job.stderr)}
-

Report This Error

+ +

Troubleshoot This Error

- Usually the local Galaxy administrators regularly review errors that occur on the server - However, if you would like to provide additional information (such as what you were trying - to do when the error occurred) and a contact e-mail address, we will be better able to - investigate your problem and get back to you. + There are a number of help resources to self diagnose and + correct problems. + Start here: My job ended with an error. What can I do? +

+ +

Report This Error

+

+ Usually the local Galaxy administrators regularly review errors + that occur on the server However, if you would like to provide + additional information (such as what you were trying to do when + the error occurred) and a contact e-mail address, we will be + better able to investigate your problem and get back to you.

`); this.$el.append(this._getBugFormTemplate(dataset, job)); }, diff --git a/client/galaxy/scripts/mvc/tool/tool-form-base.js b/client/galaxy/scripts/mvc/tool/tool-form-base.js index 5fac45cdf24..9239281cbfe 100644 --- a/client/galaxy/scripts/mvc/tool/tool-form-base.js +++ b/client/galaxy/scripts/mvc/tool/tool-form-base.js @@ -88,7 +88,7 @@ export default FormBase.extend({ } options.tool_errors && this.message.update({ - status: 'danger', + status: "danger", message: options.tool_errors, persistent: true }); diff --git a/client/galaxy/scripts/mvc/tool/tool-form-composite.js b/client/galaxy/scripts/mvc/tool/tool-form-composite.js index 3ce17a5595a..0a96cd2b641 100644 --- a/client/galaxy/scripts/mvc/tool/tool-form-composite.js +++ b/client/galaxy/scripts/mvc/tool/tool-form-composite.js @@ -129,14 +129,14 @@ var View = Backbone.View.extend({ this.wp_inputs = {}; function _ensureWorkflowParameter(wp_name) { - return self.wp_inputs[wp_name] = self.wp_inputs[wp_name] || { + return (self.wp_inputs[wp_name] = self.wp_inputs[wp_name] || { label: wp_name, name: wp_name, type: "text", color: `hsl( ${++wp_count * 100}, 70%, 30% )`, style: "ui-form-wp-source", links: [] - }; + }); } function _handleWorkflowParameter(value, callback) { diff --git a/client/galaxy/scripts/mvc/tool/tools.js b/client/galaxy/scripts/mvc/tool/tools.js index eca42113979..bd50d0c2a79 100644 --- a/client/galaxy/scripts/mvc/tool/tools.js +++ b/client/galaxy/scripts/mvc/tool/tools.js @@ -828,7 +828,7 @@ var templates = { '', '', "<% _.each( labels, function( label ){ %>", - '', + '', "<%- label %>", "", "<% }); %>", diff --git a/client/galaxy/scripts/mvc/workflow/workflow-manager.js b/client/galaxy/scripts/mvc/workflow/workflow-manager.js index f247d2606be..826caf8f78e 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-manager.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-manager.js @@ -278,7 +278,7 @@ class Workflow { $.each(node.output_terminals, (ot_id, ot) => { if (node.post_job_actions[`HideDatasetAction${ot.name}`] === undefined) { node.addWorkflowOutput(ot.name); - var callout = $(node.element).find(`.callout.${ot.name.replace(/(?=[()])/g, '\\')}`); + var callout = $(node.element).find(`.callout.${ot.name.replace(/(?=[()])/g, "\\")}`); callout.find("img").attr("src", `${Galaxy.root}static/images/fugue/asterisk-small.png`); wf.has_changes = true; } diff --git a/client/galaxy/scripts/mvc/workflow/workflow-view.js b/client/galaxy/scripts/mvc/workflow/workflow-view.js index 406d8dee70a..65645f3cfa4 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-view.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-view.js @@ -278,46 +278,51 @@ export default Backbone.View.extend({ let workflow_versions = JSON.parse( $.ajax({ url: `${Galaxy.root}api/workflows/${self.options.id}/versions`, - async: false, + async: false }).responseText ); for (let i = 0; i < workflow_versions.length; i++) { let current_wf = workflow_versions[i]; - let version_text = `Version ${current_wf['version']}, ${current_wf['steps']} steps`; + let version_text = `Version ${current_wf["version"]}, ${current_wf["steps"]} steps`; let selected = false; if (i == self.workflow.workflow_version) { version_text = `${version_text} (active)`; selected = true; - }; + } _workflow_version_dropdown[version_text] = { version: i, - selected: selected, - } + selected: selected + }; } - return _workflow_version_dropdown - } + return _workflow_version_dropdown; + }; this.build_version_select = function() { let versions = this.get_workflow_versions(); $("#workflow-version-switch").empty(); $.each(versions, function(k, v) { - $('#workflow-version-switch').append($('').html(k).val(v.version).selected(v.selected)); + $("#workflow-version-switch").append( + $("") + .html(k) + .val(v.version) + .selected(v.selected) + ); }); - $("#workflow-version-switch").on('change', function () { - $('#workflow-version-switch').unbind('change'); + $("#workflow-version-switch").on("change", function() { + $("#workflow-version-switch").unbind("change"); if (this.value != self.workflow.workflow_version) { if (self.workflow && self.workflow.has_changes) { let r = confirm("There are unsaved changes to your workflow which will be lost. Continue ?"); if (r == false) { // We rebuild the version select list, to reset the selected version self.build_version_select(); - return + return; } } self.load_workflow(self.options.id, this.value); } - }) + }); }; this.load_workflow = function load_workflow(id, version) { @@ -360,19 +365,21 @@ export default Backbone.View.extend({ self.showWorkflowParameters(); }, error: function(response) { - window.show_modal("Loading workflow failed.", response.err_msg, { Ok: function( response ){ - window.onbeforeunload = undefined; - window.document.location = workflow_index; -}}) + window.show_modal("Loading workflow failed.", response.err_msg, { + Ok: function(response) { + window.onbeforeunload = undefined; + window.document.location = workflow_index; + } + }); }, beforeSubmit: function(data) { show_message("Loading workflow", "progress"); } }); - } + }; // Load workflow definition - this.load_workflow(self.options.id, self.options.version) + this.load_workflow(self.options.id, self.options.version); if (window.make_popupmenu) { make_popupmenu($("#workflow-options-button"), { Save: save_current_workflow, diff --git a/config/datatypes_conf.xml.sample b/config/datatypes_conf.xml.sample index e11a7f2d435..bf49f95419a 100644 --- a/config/datatypes_conf.xml.sample +++ b/config/datatypes_conf.xml.sample @@ -576,10 +576,10 @@ - + - + diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index ed2c75ded0f..0724ed1bf39 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2599,7 +2599,7 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot self.version = self.version + 1 if self.version else 1 session.add(past_hda) - def copy(self, parent_id=None, copy_tags=None, force_flush=True, copy_hid=True): + def copy(self, parent_id=None, copy_tags=None, force_flush=True, copy_hid=True, new_name=None): """ Create a copy of this HDA. """ @@ -2607,7 +2607,7 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot if copy_hid: hid = self.hid hda = HistoryDatasetAssociation(hid=hid, - name=self.name, + name=new_name or self.name, info=self.info, blurb=self.blurb, peek=self.peek, @@ -3451,6 +3451,17 @@ class DatasetCollection(Dictifiable, UsesAnnotations): elements.append(element) return elements + @property + def first_dataset_element(self): + for element in self.elements: + if element.is_collection: + first_element = element.child_collection.first_dataset_element + if first_element: + return first_element + else: + return element + return None + @property def state(self): # TODO: DatasetCollection state handling... diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index bf83a5d640e..ef06bf71a49 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2481,14 +2481,15 @@ class ExtractDatasetCollectionTool(DatabaseOperationTool): assert collection_type in ["list", "paired"] how = incoming["which"]["which_dataset"] if how == "first": - extracted = collection.dataset_instances[0] + extracted_element = collection.first_dataset_element elif how == "by_identifier": - extracted = collection[incoming["which"]["identifier"]].element_object + extracted_element = collection[incoming["which"]["identifier"]] elif how == "by_index": - extracted = collection[int(incoming["which"]["index"])].element_object + extracted_element = collection[int(incoming["which"]["index"])] else: raise Exception("Invalid tool parameters.") - extracted_o = extracted.copy(copy_tags=tags) + extracted = extracted_element.element_object + extracted_o = extracted.copy(copy_tags=tags, new_name=extracted_element.element_identifier) self._add_datasets_to_history(history, [extracted_o]) out_data["output"] = extracted_o diff --git a/lib/galaxy/tools/extract_dataset.xml b/lib/galaxy/tools/extract_dataset.xml index 368f3df3d59..f4dd795e8f2 100644 --- a/lib/galaxy/tools/extract_dataset.xml +++ b/lib/galaxy/tools/extract_dataset.xml @@ -50,7 +50,9 @@ This tool will create new history datasets from your collection but your quota u - + + + @@ -63,7 +65,9 @@ This tool will create new history datasets from your collection but your quota u - + + + @@ -76,7 +80,9 @@ This tool will create new history datasets from your collection but your quota u - + + + diff --git a/lib/galaxy/tools/search/__init__.py b/lib/galaxy/tools/search/__init__.py index fe59c89d0d0..7f68703bc06 100644 --- a/lib/galaxy/tools/search/__init__.py +++ b/lib/galaxy/tools/search/__init__.py @@ -6,6 +6,7 @@ import logging import re import tempfile +from bleach import clean from whoosh import analysis from whoosh.analysis import StandardAnalyzer from whoosh.fields import ( @@ -49,7 +50,7 @@ class ToolBoxSearch(object): self.storage, self.index = self._index_setup() # We keep track of how many times the tool index has been rebuilt. # We start at -1, so that after the first index the count is at 0, - # which is the same is the toolbox reload count. This way we can skip + # which is the same as the toolbox reload count. This way we can skip # reindexing if the index count is equal to the toolbox reload count. self.index_count = -1 @@ -105,7 +106,9 @@ class ToolBoxSearch(object): add_doc_kwds['labels'] = to_unicode(" ".join(tool.labels)) if index_help and tool.help: try: - add_doc_kwds['help'] = to_unicode(tool.help.render(host_url="", static_path="")) + raw_html = tool.help.render(host_url="", static_path="") + cleantext = clean(raw_html, tags=[''], strip=True).replace('\n', ' ') + add_doc_kwds['help'] = to_unicode(cleantext) except Exception: # Don't fail to build index just because a help message # won't render. diff --git a/test/api/test_tools.py b/test/api/test_tools.py index fd09fe30f7d..d03676a4559 100644 --- a/test/api/test_tools.py +++ b/test/api/test_tools.py @@ -118,6 +118,27 @@ class ToolsTestCase(api.ApiTestCase): output_details = self.dataset_populator.get_history_dataset_details(history_id, dataset=output) assert output_details["file_ext"] == "bed" + @skip_without_tool("test_data_source") + def test_data_source_sniff_fastqsanger(self): + with self.dataset_populator.test_history() as history_id: + payload = self.dataset_populator.run_tool_payload( + tool_id="test_data_source", + inputs={ + "URL": "https://raw.githubusercontent.com/galaxyproject/galaxy/dev/test-data/1.fastqsanger.gz", + "URL_method": "get", + }, + history_id=history_id, + ) + create_response = self._post("tools", data=payload) + self._assert_status_code_is(create_response, 200) + create_object = create_response.json() + self._assert_has_keys(create_object, "outputs") + assert len(create_object["outputs"]) == 1 + output = create_object["outputs"][0] + self.dataset_populator.wait_for_history(history_id, assert_ok=True) + output_details = self.dataset_populator.get_history_dataset_details(history_id, dataset=output) + assert output_details["file_ext"] == "fastqsanger.gz", output_details + @skip_without_tool("test_data_source") def test_data_sources_block_file_parameters(self): with self.dataset_populator.test_history() as history_id: