From 4fbaa161232f1b8e12b23788e258def10e6aa156 Mon Sep 17 00:00:00 2001 From: Dan Fornika Date: Fri, 7 Dec 2018 15:23:54 -0800 Subject: [PATCH 01/42] Add simple stub for mash sketch files --- config/datatypes_conf.xml.sample | 1 + lib/galaxy/datatypes/binary.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/config/datatypes_conf.xml.sample b/config/datatypes_conf.xml.sample index 29daee09b6f..7fe5ab9c57e 100644 --- a/config/datatypes_conf.xml.sample +++ b/config/datatypes_conf.xml.sample @@ -538,6 +538,7 @@ + diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 19ec0f80962..b6b57b644a6 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -126,6 +126,18 @@ class Cel(Binary): return False +class MashSketch(Binary): + """ + Mash Sketch file. + Sketches are used by the MinHash algorithm to allow fast distance estimations + with low storage and memory requirements. To make a sketch, each k-mer in a sequence + is hashed, which creates a pseudo-random identifier. By sorting these identifiers (hashes), + a small subset from the top of the sorted list can represent the entire sequence (these are min-hashes). + The more similar another sequence is, the more min-hashes it is likely to share. + """ + file_ext = "msh" + + class CompressedArchive(Binary): """ Class describing an compressed binary file From 7d5a006b01ccd37ad65156be95f5e606dc4ea985 Mon Sep 17 00:00:00 2001 From: Dan Fornika Date: Fri, 7 Dec 2018 16:42:35 -0800 Subject: [PATCH 02/42] Removed extra whitespace to appease linter --- lib/galaxy/datatypes/binary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index b6b57b644a6..a2963ec2914 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -136,8 +136,8 @@ class MashSketch(Binary): The more similar another sequence is, the more min-hashes it is likely to share. """ file_ext = "msh" - - + + class CompressedArchive(Binary): """ Class describing an compressed binary file From 27dc7c42c97db9230657a7db86567ac8b253d6b5 Mon Sep 17 00:00:00 2001 From: Dan Fornika Date: Fri, 7 Dec 2018 16:43:51 -0800 Subject: [PATCH 03/42] Removed extra whitespace to appease linter --- lib/galaxy/datatypes/binary.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index a2963ec2914..8da7603ad4d 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -129,10 +129,10 @@ class Cel(Binary): class MashSketch(Binary): """ Mash Sketch file. - Sketches are used by the MinHash algorithm to allow fast distance estimations - with low storage and memory requirements. To make a sketch, each k-mer in a sequence - is hashed, which creates a pseudo-random identifier. By sorting these identifiers (hashes), - a small subset from the top of the sorted list can represent the entire sequence (these are min-hashes). + Sketches are used by the MinHash algorithm to allow fast distance estimations + with low storage and memory requirements. To make a sketch, each k-mer in a sequence + is hashed, which creates a pseudo-random identifier. By sorting these identifiers (hashes), + a small subset from the top of the sorted list can represent the entire sequence (these are min-hashes). The more similar another sequence is, the more min-hashes it is likely to share. """ file_ext = "msh" From de3b7bb55fd4949456bfb61637cb67b1fd367d6e Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 11 Dec 2018 18:19:28 -0500 Subject: [PATCH 04/42] Add display applications api endpoint --- .../galaxy/api/display_applications.py | 36 +++++++++++++++++++ lib/galaxy/webapps/galaxy/buildapp.py | 10 ++++++ 2 files changed, 46 insertions(+) create mode 100644 lib/galaxy/webapps/galaxy/api/display_applications.py diff --git a/lib/galaxy/webapps/galaxy/api/display_applications.py b/lib/galaxy/webapps/galaxy/api/display_applications.py new file mode 100644 index 00000000000..bafafadd8aa --- /dev/null +++ b/lib/galaxy/webapps/galaxy/api/display_applications.py @@ -0,0 +1,36 @@ +""" +API operations on annotations. +""" +import logging + +from galaxy import exceptions +from galaxy.web import expose_api +from galaxy.web.base.controller import BaseAPIController + +log = logging.getLogger(__name__) + + +class DisplayApplicationsController(BaseAPIController): + + @expose_api + def index(self, trans, **kwd): + """ + GET /api/display_applications/ + + Returns the list of display applications. + + :returns: list of available display applications + :rtype: list + """ + response = [] + for display_app in trans.app.datatypes_registry.display_applications.values(): + + response.append({ + "id" : display_app.id, + "name": display_app.name, + "version": display_app.version, + "filename_": display_app._filename, + "links": [{"name": l.name} for l in display_app.links.values()] + }) + return response + diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 20f7f361258..26e6ead41d2 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -553,6 +553,16 @@ def populate_api_routes(webapp, app): action='get_api_key', conditions=dict(method=["GET"])) + # ======================= + # ====== DISPLAY APPLICATIONS API ====== + # ======================= + + webapp.mapper.connect('index', + '/api/display_applications', + controller='display_applications', + action='index', + conditions=dict(method=["GET"])) + # ===================== # ===== TOURS API ===== # ===================== From 6546e35bff27a60b09bf30ca68c2beb62a61acd4 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 11 Dec 2018 18:30:09 -0500 Subject: [PATCH 05/42] Add reload feature to display applications api endpoint --- .../galaxy/api/display_applications.py | 39 +++++++++++++++---- lib/galaxy/webapps/galaxy/buildapp.py | 6 +++ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/display_applications.py b/lib/galaxy/webapps/galaxy/api/display_applications.py index bafafadd8aa..35c4d02d0bb 100644 --- a/lib/galaxy/webapps/galaxy/api/display_applications.py +++ b/lib/galaxy/webapps/galaxy/api/display_applications.py @@ -3,7 +3,7 @@ API operations on annotations. """ import logging -from galaxy import exceptions +from galaxy.exceptions import MessageException from galaxy.web import expose_api from galaxy.web.base.controller import BaseAPIController @@ -24,13 +24,38 @@ class DisplayApplicationsController(BaseAPIController): """ response = [] for display_app in trans.app.datatypes_registry.display_applications.values(): - response.append({ - "id" : display_app.id, - "name": display_app.name, - "version": display_app.version, - "filename_": display_app._filename, - "links": [{"name": l.name} for l in display_app.links.values()] + 'id' : display_app.id, + 'name': display_app.name, + 'version': display_app.version, + 'filename_': display_app._filename, + 'links': [{'name': l.name} for l in display_app.links.values()] }) return response + @expose_api + def reload(self, trans, **kwd): + """ + GET /api/display_applications/reload + + Reloads the list of display applications. + + :param ids: list containing ids of display to be reloaded + :type ids: list + """ + ids = payload.get('ids') + galaxy.queue_worker.send_control_task(trans.app, + 'reload_display_application', + noop_self=True, + kwargs={'display_application_ids': ids}) + reloaded, failed = trans.app.datatypes_registry.reload_display_applications(ids) + if not reloaded and failed: + raise MessageException('Unable to reload any of the %i requested display applications ("%s").' + % (len(failed), '", "'.join(failed))) + if failed: + raise MessageException('Reloaded %i display applications ("%s"), but failed to reload %i display applications ("%s").' + % (len(reloaded), '", "'.join(reloaded), len(failed), '", "'.join(failed))) + if not reloaded: + raise MessageException('You need to request at least one display application to reload.') + return {'message': 'Reloaded %i requested display applications ("%s").' % (len(reloaded), '", "'.join(reloaded)))} + diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 26e6ead41d2..49e4238f868 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -563,6 +563,12 @@ def populate_api_routes(webapp, app): action='index', conditions=dict(method=["GET"])) + webapp.mapper.connect('reload', + '/api/display_applications/reload', + controller='display_applications', + action='reload', + conditions=dict(method=["POST"])) + # ===================== # ===== TOURS API ===== # ===================== From eb0c0ad9ab204cee83233523c01b11aa040a6388 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 11 Dec 2018 19:04:15 -0500 Subject: [PATCH 06/42] Add display application vue component --- client/galaxy/scripts/apps/admin.js | 6 +++ .../components/admin/DisplayApplications.vue | 44 +++++++++++++++++++ .../galaxy/api/display_applications.py | 2 +- lib/galaxy/webapps/galaxy/buildapp.py | 1 + .../webapps/galaxy/controllers/admin.py | 2 +- 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 client/galaxy/scripts/components/admin/DisplayApplications.vue diff --git a/client/galaxy/scripts/apps/admin.js b/client/galaxy/scripts/apps/admin.js index c52f399ba58..cbd957ed4b2 100644 --- a/client/galaxy/scripts/apps/admin.js +++ b/client/galaxy/scripts/apps/admin.js @@ -14,6 +14,7 @@ import DataTables from "components/admin/DataTables.vue"; import DataTypes from "components/admin/DataTypes.vue"; import DataManagerView from "components/admin/DataManager/DataManagerView.vue"; import DataManagerRouter from "components/admin/DataManager/DataManagerRouter.vue"; +import DisplayApplications from "components/admin/DisplayApplications.vue"; import Vue from "vue"; import { serverPath } from "utils/serverPath"; @@ -33,6 +34,7 @@ window.app = function app(options, bootstrapped) { "(/)admin(/)users": "show_users", "(/)admin(/)roles": "show_roles", "(/)admin(/)groups": "show_groups", + "(/)admin(/)display_applications": "show_display_applications", "(/)admin(/)tool_versions": "show_tool_versions", "(/)admin(/)quotas": "show_quotas", "(/)admin(/)repositories": "show_repositories", @@ -124,6 +126,10 @@ window.app = function app(options, bootstrapped) { this._display_vue_helper(DataTypes); }, + show_display_applications: function() { + this._display_vue_helper(DisplayApplications); + }, + show_data_manager: function(path) { let vueMount = document.createElement("div"); this.page.display(vueMount); diff --git a/client/galaxy/scripts/components/admin/DisplayApplications.vue b/client/galaxy/scripts/components/admin/DisplayApplications.vue new file mode 100644 index 00000000000..415d01bafc6 --- /dev/null +++ b/client/galaxy/scripts/components/admin/DisplayApplications.vue @@ -0,0 +1,44 @@ + + diff --git a/lib/galaxy/webapps/galaxy/api/display_applications.py b/lib/galaxy/webapps/galaxy/api/display_applications.py index 35c4d02d0bb..6b27d553690 100644 --- a/lib/galaxy/webapps/galaxy/api/display_applications.py +++ b/lib/galaxy/webapps/galaxy/api/display_applications.py @@ -57,5 +57,5 @@ class DisplayApplicationsController(BaseAPIController): % (len(reloaded), '", "'.join(reloaded), len(failed), '", "'.join(failed))) if not reloaded: raise MessageException('You need to request at least one display application to reload.') - return {'message': 'Reloaded %i requested display applications ("%s").' % (len(reloaded), '", "'.join(reloaded)))} + return {'message': 'Reloaded %i requested display applications ("%s").' % (len(reloaded), '", "'.join(reloaded))} diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 49e4238f868..485715b95a4 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -103,6 +103,7 @@ def app_factory(global_conf, load_app_kwds={}, **kwargs): webapp.add_client_route('/admin/data_types', 'admin') webapp.add_client_route('/admin/data_manager{path_info:.*}', 'admin') webapp.add_client_route('/admin/users', 'admin') + webapp.add_client_route('/admin/display_applications', 'admin') webapp.add_client_route('/admin/roles', 'admin') webapp.add_client_route('/admin/forms', 'admin') webapp.add_client_route('/admin/groups', 'admin') diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index a8d411be2e0..cf7b33e8b37 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -910,7 +910,7 @@ class AdminGalaxy(controller.JSAppLauncher, AdminActions, UsesQuotaMixin, QuotaP @web.expose @web.require_admin - def display_applications(self, trans, **kwd): + def display_applications_legacy(self, trans, **kwd): return trans.fill_template('admin/view_display_applications.mako', display_applications=trans.app.datatypes_registry.display_applications) @web.expose From 727ab11480962ec31387cc6934c0fcec14a4ead0 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 11 Dec 2018 19:20:28 -0500 Subject: [PATCH 07/42] Fix spacing in admin app router --- client/galaxy/scripts/apps/panels/admin-panel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/galaxy/scripts/apps/panels/admin-panel.js b/client/galaxy/scripts/apps/panels/admin-panel.js index e77995c4e0a..dbd4eb4c4f9 100644 --- a/client/galaxy/scripts/apps/panels/admin-panel.js +++ b/client/galaxy/scripts/apps/panels/admin-panel.js @@ -34,6 +34,7 @@ var AdminPanel = Backbone.View.extend({ { title: _l("Display applications"), url: "admin/display_applications", + target: "__use_router__", id: "admin-link-display-applications" }, { From 35d2cd9bf62a748bc3dd5963a3246b5a5a7e2a18 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 11 Dec 2018 19:33:04 -0500 Subject: [PATCH 08/42] Load display application data and display number of available applications --- client/galaxy/scripts/apps/admin.js | 3 +++ .../components/admin/DisplayApplications.vue | 27 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/client/galaxy/scripts/apps/admin.js b/client/galaxy/scripts/apps/admin.js index cbd957ed4b2..831c65c54cd 100644 --- a/client/galaxy/scripts/apps/admin.js +++ b/client/galaxy/scripts/apps/admin.js @@ -113,15 +113,18 @@ window.app = function app(options, bootstrapped) { }) ); }, + _display_vue_helper: function(component, props) { let instance = Vue.extend(component); let vm = document.createElement("div"); this.page.display(vm); new instance(props).$mount(vm); }, + show_data_tables: function() { this._display_vue_helper(DataTables); }, + show_data_types: function() { this._display_vue_helper(DataTypes); }, diff --git a/client/galaxy/scripts/components/admin/DisplayApplications.vue b/client/galaxy/scripts/components/admin/DisplayApplications.vue index 415d01bafc6..02bb25f5dab 100644 --- a/client/galaxy/scripts/components/admin/DisplayApplications.vue +++ b/client/galaxy/scripts/components/admin/DisplayApplications.vue @@ -1,9 +1,15 @@ diff --git a/client/galaxy/scripts/mvc/collection/collection-li.js b/client/galaxy/scripts/mvc/collection/collection-li.js index 89663b4d463..48c0b7cf88c 100644 --- a/client/galaxy/scripts/mvc/collection/collection-li.js +++ b/client/galaxy/scripts/mvc/collection/collection-li.js @@ -1,12 +1,10 @@ -import LIST_ITEM from "mvc/list/list-item"; -import DATASET_LI from "mvc/dataset/dataset-li"; +import _ from "underscore"; +import $ from "jquery"; +import { ListItemView, FoldoutListItemView } from "mvc/list/list-item"; +import { DatasetListItemView } from "mvc/dataset/dataset-li"; import BASE_MVC from "mvc/base-mvc"; import _l from "utils/localization"; -//============================================================================== -var FoldoutListItemView = LIST_ITEM.FoldoutListItemView; - -var ListItemView = LIST_ITEM.ListItemView; /** @class Read only view for DatasetCollection. */ var DCListItemView = FoldoutListItemView.extend( @@ -189,9 +187,9 @@ DCEListItemView.prototype.templates = (() => { /** @class Read only view for a DatasetCollectionElement that is also an DatasetAssociation * (a dataset contained in a dataset collection). */ -var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend( +var DatasetDCEListItemView = DatasetListItemView.extend( /** @lends DatasetDCEListItemView.prototype */ { - className: `${DATASET_LI.DatasetListItemView.prototype.className} dataset-collection-element`, + className: `${DatasetListItemView.prototype.className} dataset-collection-element`, /** set up */ initialize: function(attributes) { @@ -199,7 +197,7 @@ var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend( this.logger = this.model.logger = attributes.logger; } this.log("DatasetDCEListItemView.initialize:", attributes); - DATASET_LI.DatasetListItemView.prototype.initialize.call(this, attributes); + DatasetListItemView.prototype.initialize.call(this, attributes); }, /** In this override, only get details if in the ready state. @@ -210,7 +208,7 @@ var DatasetDCEListItemView = DATASET_LI.DatasetListItemView.extend( if (view.model.inReadyState() && !view.model.hasDetails()) { return view.model.fetch({ silent: true }); } - return jQuery.when(); + return $.when(); }, // ......................................................................... misc @@ -239,7 +237,7 @@ DatasetDCEListItemView.prototype.templates = (() => { "element" ); - return _.extend({}, DATASET_LI.DatasetListItemView.prototype.templates, { + return _.extend({}, DatasetListItemView.prototype.templates, { titleBar: titleBarTemplate }); })(); diff --git a/client/galaxy/scripts/mvc/collection/collection-view.js b/client/galaxy/scripts/mvc/collection/collection-view.js index 68419881def..ac49b034789 100644 --- a/client/galaxy/scripts/mvc/collection/collection-view.js +++ b/client/galaxy/scripts/mvc/collection/collection-view.js @@ -1,9 +1,7 @@ import _ from "underscore"; import { getAppRoot } from "onload/loadConfig"; import LIST_VIEW from "mvc/list/list-view"; -import DC_MODEL from "mvc/collection/collection-model"; import DC_LI from "mvc/collection/collection-li"; -import BASE_MVC from "mvc/base-mvc"; import _l from "utils/localization"; var logNamespace = "collections"; @@ -56,7 +54,6 @@ var CollectionView = _super.extend( var panel = this; this.handleWarning($newRender); panel.log("_queueNewRender:", $newRender, speed); - // TODO: jquery@1.12 doesn't change display when the elem has display: flex // this causes display: block for those elems after the use of show/hide animations // animations are removed from this view for now until fixed diff --git a/client/galaxy/scripts/mvc/dataset/dataset-li.js b/client/galaxy/scripts/mvc/dataset/dataset-li.js index 5fa3614c6f0..d12fa457005 100644 --- a/client/galaxy/scripts/mvc/dataset/dataset-li.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li.js @@ -20,7 +20,7 @@ var _super = LIST_ITEM.ListItemView; /** @class Read only list view for either LDDAs, HDAs, or HDADCEs. * Roughly, any DatasetInstance (and not a raw Dataset). */ -var DatasetListItemView = _super.extend( +export var DatasetListItemView = _super.extend( /** @lends DatasetListItemView.prototype */ { _logNamespace: logNamespace, diff --git a/client/galaxy/scripts/mvc/history/hdca-li.js b/client/galaxy/scripts/mvc/history/hdca-li.js index f7a89692287..8b5383ba526 100644 --- a/client/galaxy/scripts/mvc/history/hdca-li.js +++ b/client/galaxy/scripts/mvc/history/hdca-li.js @@ -1,7 +1,7 @@ +import _ from "underscore"; import STATES from "mvc/dataset/states"; import DC_LI from "mvc/collection/collection-li"; import DC_VIEW from "mvc/collection/collection-view"; -import BASE_MVC from "mvc/base-mvc"; import HISTORY_ITEM_LI from "mvc/history/history-item-li"; import _l from "utils/localization"; @@ -17,7 +17,8 @@ var HDCAListItemView = _super.extend( _setUpListeners: function() { _super.prototype._setUpListeners.call(this); var renderListen = (model, options) => { - this.render(); + // We want this to swap immediately without extra animations. + this.render(0); }; if (this.model.jobStatesSummary) { this.listenTo(this.model.jobStatesSummary, "change", renderListen); @@ -64,9 +65,7 @@ var HDCAListItemView = _super.extend( stateDescription: function() { var collection = this.model; - var elementCount = collection.get("element_count"); var jobStateSource = collection.get("job_source_type"); - var collectionType = this.model.get("collection_type"); var collectionTypeDescription = DC_VIEW.collectionTypeDescription(collection); var simpleDescription = DC_VIEW.collectionDescription(collection); var jobStatesSummary = collection.jobStatesSummary; diff --git a/client/galaxy/scripts/mvc/history/history-item-li.js b/client/galaxy/scripts/mvc/history/history-item-li.js index 42ab15671d0..0208ffbfda9 100644 --- a/client/galaxy/scripts/mvc/history/history-item-li.js +++ b/client/galaxy/scripts/mvc/history/history-item-li.js @@ -1,7 +1,9 @@ import Utils from "utils/utils"; function _templateNametag(tag) { - return `${_.escape(tag.slice(5))}`; + return `${_.escape( + tag.slice(5) + )}`; } function nametagTemplate(historyItem) { diff --git a/client/galaxy/scripts/mvc/list/list-item.js b/client/galaxy/scripts/mvc/list/list-item.js index 8633ad9cd60..3f1d0b0430a 100644 --- a/client/galaxy/scripts/mvc/list/list-item.js +++ b/client/galaxy/scripts/mvc/list/list-item.js @@ -1,5 +1,7 @@ +import $ from "jquery"; +import Backbone from "backbone"; +import _ from "underscore"; import BASE_MVC from "mvc/base-mvc"; -import _l from "utils/localization"; var logNamespace = "list"; //============================================================================== @@ -142,7 +144,7 @@ var ExpandableView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({ if (!this.model.hasDetails()) { return this.model.fetch(); } - return jQuery.when(); + return $.when(); }, /** Inner fn called when expand (public) has fetched the details */ @@ -182,7 +184,7 @@ var ExpandableView = Backbone.View.extend(BASE_MVC.LoggableMixin).extend({ * * Designed as a base class for history panel contents - but usable elsewhere (I hope). */ -var ListItemView = ExpandableView.extend( +export var ListItemView = ExpandableView.extend( BASE_MVC.mixin(BASE_MVC.SelectableViewMixin, BASE_MVC.DraggableViewMixin, { tagName: "div", className: "list-item", @@ -380,7 +382,7 @@ ListItemView.prototype.templates = (() => { * * _renderDetails does the work of creating this.details: a sub-view that shows the nested list */ -var FoldoutListItemView = ListItemView.extend({ +export var FoldoutListItemView = ListItemView.extend({ /** If 'foldout': show the sub-panel inside the expanded item * If 'drilldown': only fire events and handle by pub-sub * (allow the panel containing this item to attach it, hide itself, etc.) diff --git a/client/galaxy/scripts/mvc/list/list-view.js b/client/galaxy/scripts/mvc/list/list-view.js index 009b2fe0470..25bb73ed901 100644 --- a/client/galaxy/scripts/mvc/list/list-view.js +++ b/client/galaxy/scripts/mvc/list/list-view.js @@ -1,3 +1,6 @@ +import $ from "jquery"; +import Backbone from "backbone"; +import _ from "underscore"; import LIST_ITEM from "mvc/list/list-item"; import LoadingIndicator from "ui/loading-indicator"; import BASE_MVC from "mvc/base-mvc"; diff --git a/client/galaxy/scripts/mvc/ui/ui-select-default.js b/client/galaxy/scripts/mvc/ui/ui-select-default.js index e3b29a6bd66..6e4281d6a60 100644 --- a/client/galaxy/scripts/mvc/ui/ui-select-default.js +++ b/client/galaxy/scripts/mvc/ui/ui-select-default.js @@ -208,9 +208,9 @@ var View = Backbone.View.extend({ ${_.reduce( filteredTags.slice(0, 5), (memo, tag) => { - return `${memo} 
${_.escape( - tag - )}
`; + return `${memo} 
${_.escape(tag)}
`; }, "" )} diff --git a/client/galaxy/scripts/utils/utils.js b/client/galaxy/scripts/utils/utils.js index 89ce6ec3f5d..7d9bf09043a 100644 --- a/client/galaxy/scripts/utils/utils.js +++ b/client/galaxy/scripts/utils/utils.js @@ -358,7 +358,8 @@ export function setWindowTitle(title) { * @returns {integer} */ function hashFnv32a(str) { - var i, l, + var i, + l, hval = 0x811c9dc5; for (i = 0, l = str.length; i < l; i++) { @@ -380,10 +381,8 @@ function hashFnv32a(str) { * Assumes r, g, b are in the set [0, 1] */ function contrastingColor(r, g, b) { - var o = ((r * 255 * 299) + - (g * 255 * 587) + - (b * 255 * 114)) / 1000; - return (o > 125) ? 'black' : 'white'; + var o = (r * 255 * 299 + g * 255 * 587 + b * 255 * 114) / 1000; + return o > 125 ? "black" : "white"; } /** @@ -397,26 +396,26 @@ function contrastingColor(r, g, b) { * @param {number} l The lightness * @return {Array} The RGB representation */ -function hslToRgb(h, s, l){ +function hslToRgb(h, s, l) { var r, g, b; - if(s == 0){ + if (s == 0) { r = g = b = l; // achromatic - }else{ - var hue2rgb = function hue2rgb(p, q, t){ - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; + } else { + var hue2rgb = function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; return p; - } + }; var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); + r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); + b = hue2rgb(p, q, h - 1 / 3); } return [r, g, b]; @@ -431,12 +430,11 @@ export function generateTagStyle(tag) { var brColor = `hsl(${hue}, 100%, ${lightness - 40}%)`; var [r, g, b] = hslToRgb(hue, 1.0, lightness / 100); - var fgColor = contrastingColor(r, g, b) + var fgColor = contrastingColor(r, g, b); - return `background-color: ${bgColor}; color: ${fgColor}; border: 1px solid ${brColor}` + return `background-color: ${bgColor}; color: ${fgColor}; border: 1px solid ${brColor}`; } - export default { cssLoadFile: cssLoadFile, cssGetAttribute: cssGetAttribute, From f5b7553fea0f08c1bb37ce43172b91feed15bb44 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 17 Dec 2018 12:56:27 -0500 Subject: [PATCH 23/42] Add require admin to display applications api --- lib/galaxy/webapps/galaxy/api/display_applications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/api/display_applications.py b/lib/galaxy/webapps/galaxy/api/display_applications.py index 9e56afa83bd..f6501f145fd 100644 --- a/lib/galaxy/webapps/galaxy/api/display_applications.py +++ b/lib/galaxy/webapps/galaxy/api/display_applications.py @@ -4,7 +4,7 @@ API operations on annotations. import logging from galaxy import queue_worker -from galaxy.web import expose_api +from galaxy.web import expose_api, require_admin from galaxy.web.base.controller import BaseAPIController log = logging.getLogger(__name__) @@ -13,6 +13,7 @@ log = logging.getLogger(__name__) class DisplayApplicationsController(BaseAPIController): @expose_api + @require_admin def index(self, trans, **kwd): """ GET /api/display_applications/ @@ -34,6 +35,7 @@ class DisplayApplicationsController(BaseAPIController): return response @expose_api + @require_admin def reload(self, trans, payload={}, **kwd): """ POST /api/display_applications/reload From fe349ef334f643faf08fe35b4f1da87e82fa1bbf Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 17 Dec 2018 13:54:24 -0500 Subject: [PATCH 24/42] Remove __collected_datasets__ from hook dict. Added for Tool subclass hooks in ca8cc1420ef80bd2fef17fa9bb21dbb0714b4a88 but doesn't seem to be used in any tool implementation hooks. --- lib/galaxy/jobs/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index 95474dbcf02..81568791562 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1441,11 +1441,9 @@ class JobWrapper(HasResourceParameters): # why not re-use self.param_dict here? param_dict = dict([(p.name, p.value) for p in job.parameters]) param_dict = self.tool.params_from_strings(param_dict, self.app) - # Create generated output children and primary datasets and add to param_dict + # Create generated output children and primary datasets and dynamic outputs. tool_working_directory = self.tool_working_directory - collected_datasets = { - 'primary': self.tool.collect_primary_datasets(out_data, self.get_tool_provided_job_metadata(), tool_working_directory, input_ext, input_dbkey) - } + self.tool.collect_primary_datasets(out_data, self.get_tool_provided_job_metadata(), tool_working_directory, input_ext, input_dbkey) self.tool.collect_dynamic_outputs( out_collections, self.get_tool_provided_job_metadata(), @@ -1454,7 +1452,6 @@ class JobWrapper(HasResourceParameters): job=job, input_dbkey=input_dbkey, ) - param_dict.update({'__collected_datasets__': collected_datasets}) # Certain tools require tasks to be completed after job execution # ( this used to be performed in the "exec_after_process" hook, but hooks are deprecated ). self.tool.exec_after_process(self.app, inp_data, out_data, param_dict, job=job) From 22e1350f7a9eeddd53ffa5b6febb492ceefb004c Mon Sep 17 00:00:00 2001 From: pvanheus Date: Tue, 18 Dec 2018 14:35:35 +0200 Subject: [PATCH 25/42] Update help text as per suggestion from CWunder This [thread](https://help.galaxyproject.org/t/clearer-documentation-for-filter-list/231) suggests that the help text for this tool is not clear. This PR attempts to address that weakness. --- lib/galaxy/tools/filter_from_file.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tools/filter_from_file.xml b/lib/galaxy/tools/filter_from_file.xml index 6dbb28277a4..defcba39147 100644 --- a/lib/galaxy/tools/filter_from_file.xml +++ b/lib/galaxy/tools/filter_from_file.xml @@ -81,9 +81,11 @@ .. class:: infomark - This tool will take an input list and a text file with identifiers to - filter the list with. It will build two new lists - one "filtered" to - contain only the supplied identifiers and one of the discarded elements. + This tool will take an input list and a text file with + names (i.e. identifiers). It will split the input list into + two new lists - one filtered to contain only the list members + whose names are listed in the text file, and one containing + all the other elements. This tool will create new history datasets from your collection but your quota usage will not increase. From a00d013fd14ecc1eca59b8d572c1ec5a673bce74 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 18 Dec 2018 09:12:59 -0500 Subject: [PATCH 26/42] Remove admin requirment from index endpoint of display applications --- lib/galaxy/webapps/galaxy/api/display_applications.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/api/display_applications.py b/lib/galaxy/webapps/galaxy/api/display_applications.py index f6501f145fd..d41ad8057e9 100644 --- a/lib/galaxy/webapps/galaxy/api/display_applications.py +++ b/lib/galaxy/webapps/galaxy/api/display_applications.py @@ -13,7 +13,6 @@ log = logging.getLogger(__name__) class DisplayApplicationsController(BaseAPIController): @expose_api - @require_admin def index(self, trans, **kwd): """ GET /api/display_applications/ From e1e32cdcc6e3a300f5534ca961d2459634142367 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 18 Dec 2018 12:05:27 -0500 Subject: [PATCH 27/42] Test for 'metadata' in newer style discovered primary datasets. --- test/functional/tools/samples_tool_conf.xml | 1 + .../tools/tool_provided_metadata_10.xml | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 test/functional/tools/tool_provided_metadata_10.xml diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index 112103d7e85..7618f93d6b9 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -28,6 +28,7 @@ + diff --git a/test/functional/tools/tool_provided_metadata_10.xml b/test/functional/tools/tool_provided_metadata_10.xml new file mode 100644 index 00000000000..fce8be2f042 --- /dev/null +++ b/test/functional/tools/tool_provided_metadata_10.xml @@ -0,0 +1,38 @@ + + + + echo "1" > sample1.report.tsv; + cp $c1 galaxy.json; + + + {"sample": { +"datasets": [ +{"filename": "sample1.report.tsv", "name": "cool name 1", "ext": "txt", "info": "cool 1 info", "dbkey": "hg19", "metadata": {"data_lines": 10}} +] +}} + + + + + + + + + + + + + + + + + + + + + + + + + From 62a7c40ba4f29293bc921e81bd90ea59a570319b Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 18 Dec 2018 15:02:37 -0500 Subject: [PATCH 28/42] Fix for testing extra files in tool tests. Wouldn't be testing if primary file didn't specify a filename to test against. --- lib/galaxy/tools/parameters/output_collect.py | 2 +- lib/galaxy/tools/verify/__init__.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/tools/parameters/output_collect.py b/lib/galaxy/tools/parameters/output_collect.py index 8beb2b353d4..a30429b5c2c 100644 --- a/lib/galaxy/tools/parameters/output_collect.py +++ b/lib/galaxy/tools/parameters/output_collect.py @@ -613,6 +613,7 @@ def collect_primary_datasets(tool, output, tool_provided_metadata, job_working_d extra_files_path_joined = os.path.join(job_working_directory, extra_files_path) for root, dirs, files in os.walk(extra_files_path_joined): extra_dir = os.path.join(primary_data.extra_files_path, root.replace(extra_files_path_joined, '', 1).lstrip(os.path.sep)) + extra_dir = os.path.normpath(extra_dir) for f in files: app.object_store.update_from_file( primary_data.dataset, @@ -620,7 +621,6 @@ def collect_primary_datasets(tool, output, tool_provided_metadata, job_working_d alt_name=f, file_name=os.path.join(root, f), create=True, - dir_only=True, preserve_symlinks=True ) metadata_dict = new_primary_datasets_attributes.get('metadata', None) diff --git a/lib/galaxy/tools/verify/__init__.py b/lib/galaxy/tools/verify/__init__.py index 8f41eaafcbb..7ad36c8322e 100644 --- a/lib/galaxy/tools/verify/__init__.py +++ b/lib/galaxy/tools/verify/__init__.py @@ -69,6 +69,9 @@ def verify( errmsg += str(err) raise AssertionError(errmsg) + if attributes is None: + attributes = {} + if filename is not None: local_name = get_filename(filename) temp_name = make_temp_fname(fname=filename) @@ -88,8 +91,6 @@ def verify( else: log.debug('## GALAXY_TEST_SAVE=%s. saved %s' % (keep_outputs_dir, ofn)) try: - if attributes is None: - attributes = {} compare = attributes.get('compare', 'diff') if attributes.get('ftype', None) in ['bam', 'qname_sorted.bam', 'qname_input_sorted.bam', 'unsorted.bam']: local_fh, temp_name = _bam_to_sam(local_name, temp_name) @@ -110,10 +111,6 @@ def verify( files_contains(local_name, temp_name, attributes=attributes) else: raise Exception('Unimplemented Compare type: %s' % compare) - if verify_extra_files: - extra_files = attributes.get('extra_files', None) - if extra_files: - verify_extra_files(extra_files) except AssertionError as err: errmsg = '%s different than expected, difference (using %s):\n' % (item_label, compare) errmsg += "( %s v. %s )\n" % (local_name, temp_name) @@ -123,6 +120,11 @@ def verify( if 'GALAXY_TEST_NO_CLEANUP' not in os.environ: os.remove(temp_name) + if verify_extra_files: + extra_files = attributes.get('extra_files', None) + if extra_files: + verify_extra_files(extra_files) + def make_temp_fname(fname=None): """Safe temp name - preserve the file extension for tools that interpret it.""" From 953730d61ca81e79f898312b526ab8fa0680c9e0 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 18 Dec 2018 15:03:54 -0500 Subject: [PATCH 29/42] Tests for tool provided metadata specifing extra files. --- test/functional/tools/samples_tool_conf.xml | 2 + .../tools/tool_provided_metadata_11.xml | 41 +++++++++++++++++ .../tools/tool_provided_metadata_12.xml | 45 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 test/functional/tools/tool_provided_metadata_11.xml create mode 100644 test/functional/tools/tool_provided_metadata_12.xml diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index 7618f93d6b9..e2060ddce3b 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -29,6 +29,8 @@ + + diff --git a/test/functional/tools/tool_provided_metadata_11.xml b/test/functional/tools/tool_provided_metadata_11.xml new file mode 100644 index 00000000000..415816ac9c4 --- /dev/null +++ b/test/functional/tools/tool_provided_metadata_11.xml @@ -0,0 +1,41 @@ + + + + mkdir sample1data; + echo "1" > sample1.report.tsv; + echo "foo line" > sample1data/foo; + echo "moo cow bar" > sample1data/bar; + cp $c1 galaxy.json; + + + {"type": "new_primary_dataset", "filename": "sample1.report.tsv", "name": "cool name 1", "ext": "txt", "info": "cool 1 info", "dbkey": "hg19", "extra_files": "sample1data"} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/functional/tools/tool_provided_metadata_12.xml b/test/functional/tools/tool_provided_metadata_12.xml new file mode 100644 index 00000000000..c3887785075 --- /dev/null +++ b/test/functional/tools/tool_provided_metadata_12.xml @@ -0,0 +1,45 @@ + + + + mkdir sample1data; + echo "1" > sample1.report.tsv; + echo "foo line" > sample1data/foo; + echo "moo cow bar" > sample1data/bar; + cp $c1 galaxy.json; + + + {"sample": { +"datasets": [ +{"filename": "sample1.report.tsv", "name": "cool name 1", "ext": "txt", "info": "cool 1 info", "dbkey": "hg19", "extra_files": "sample1data"} +] +}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a3d1c6872b558d470b1a2f2667e6abffd920d856 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 18 Dec 2018 20:25:36 -0500 Subject: [PATCH 30/42] Minor formatting; tabstop=4 --- client/galaxy/scripts/mvc/dataset/dataset-li-edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js b/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js index 88cdabbcf8c..3ee38074df1 100644 --- a/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js @@ -120,12 +120,12 @@ var DatasetListItemEdit = _super.extend( var state = this.model.get("state"); if (!this.model.isDeletedOrPurged()) { - //Enable tagging+annotation regardless of job state (see issue #6330) + //Enable tagging+annotation regardless of job state (see issue #6330) this._renderTags($details); this._renderAnnotation($details); if (_.contains([STATES.OK, STATES.FAILED_METADATA], state)) { - this._makeDbkeyEditLink($details); + this._makeDbkeyEditLink($details); } } From 5a666eb656093cd3df5332ca78c617cb3d547b8c Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 18 Dec 2018 21:52:18 -0500 Subject: [PATCH 31/42] Avoid using underscore where there's a vanilla alternative. --- client/galaxy/scripts/mvc/dataset/dataset-li-edit.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js b/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js index 3ee38074df1..7b303b528aa 100644 --- a/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js @@ -83,7 +83,7 @@ var DatasetListItemEdit = _super.extend( } // disable if still uploading or new - } else if (_.contains([STATES.UPLOAD, STATES.NEW], this.model.get("state"))) { + } else if ([STATES.UPLOAD, STATES.NEW].includes(this.model.get("state"))) { editBtnData.disabled = true; editBtnData.title = _l("This dataset is not yet editable"); } @@ -123,8 +123,7 @@ var DatasetListItemEdit = _super.extend( //Enable tagging+annotation regardless of job state (see issue #6330) this._renderTags($details); this._renderAnnotation($details); - - if (_.contains([STATES.OK, STATES.FAILED_METADATA], state)) { + if ([STATES.OK, STATES.FAILED_METADATA].includes(state)) { this._makeDbkeyEditLink($details); } } From e237bcfd16d6a72e78afe1405e4eaeb05a91af20 Mon Sep 17 00:00:00 2001 From: guerler Date: Wed, 19 Dec 2018 11:19:47 -0500 Subject: [PATCH 32/42] Use b-alert instead of basic bootstrap alert messages --- .../components/admin/DisplayApplications.vue | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/galaxy/scripts/components/admin/DisplayApplications.vue b/client/galaxy/scripts/components/admin/DisplayApplications.vue index 0d5f07b4337..76b521ad254 100644 --- a/client/galaxy/scripts/components/admin/DisplayApplications.vue +++ b/client/galaxy/scripts/components/admin/DisplayApplications.vue @@ -1,11 +1,11 @@