From 22a5d8eb76ad2f0680497a483e6058c24c5f8b19 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Thu, 14 Jan 2021 19:27:38 -0500 Subject: [PATCH 01/97] simply creating the UI components --- .../ContentItem/DatasetCollection/DscMenu.vue | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index 6a52cc1a6e1..19d82fbdc05 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -1,18 +1,39 @@ From 09b877785e62476215d50f9f2912fa27180cc314 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 19 Jan 2021 20:33:11 -0500 Subject: [PATCH 02/97] adding the event handler and creating a vue page for collection editing --- .../ContentItem/DatasetCollection/DscMenu.vue | 49 ++++++++++++------- .../src/mvc/collection/CollectionEditView.vue | 15 ++++++ 2 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 client/src/mvc/collection/CollectionEditView.vue diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index 19d82fbdc05..0119766e048 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -18,22 +18,37 @@ - - - - - - Edit Database/Build - - - - Convert Datatype - - - - + + + diff --git a/client/src/mvc/collection/CollectionEditView.vue b/client/src/mvc/collection/CollectionEditView.vue new file mode 100644 index 00000000000..e2ff1a54047 --- /dev/null +++ b/client/src/mvc/collection/CollectionEditView.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file From 1f4411bc531ead2d59e25287cc2b3284a5741ee5 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Thu, 4 Feb 2021 01:08:34 -0500 Subject: [PATCH 03/97] attempt to route to collection edit page --- .../common}/CollectionEditView.vue | 8 ++--- .../ContentItem/DatasetCollection/DscMenu.vue | 29 ++++++++++++++++--- client/src/entry/analysis/AnalysisRouter.js | 8 ++++- 3 files changed, 34 insertions(+), 11 deletions(-) rename client/src/{mvc/collection => components/Collections/common}/CollectionEditView.vue (69%) diff --git a/client/src/mvc/collection/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue similarity index 69% rename from client/src/mvc/collection/CollectionEditView.vue rename to client/src/components/Collections/common/CollectionEditView.vue index e2ff1a54047..773b84a6244 100644 --- a/client/src/mvc/collection/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -5,11 +5,7 @@ - \ No newline at end of file + diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index 0119766e048..9051703fe28 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -23,17 +23,24 @@ key="edit-collection" :title="editButtonTitle" :disabled="collection.deleted || isIn(STATES.UPLOAD, STATES.NEW)" - @click.stop="CollectionEditView" + :href="collectionEditURL()" icon="fa fa-pencil" /> diff --git a/client/src/entry/analysis/AnalysisRouter.js b/client/src/entry/analysis/AnalysisRouter.js index 57b307aecb4..ef1194d0ebe 100644 --- a/client/src/entry/analysis/AnalysisRouter.js +++ b/client/src/entry/analysis/AnalysisRouter.js @@ -31,6 +31,7 @@ import TrsSearch from "components/Workflow/TrsSearch.vue"; import InteractiveTools from "components/InteractiveTools/InteractiveTools.vue"; import LibraryFolder from "components/LibraryFolder/LibraryFolder.vue"; import WorkflowList from "components/Workflow/WorkflowList.vue"; +import CollectionEditView from "components/Collections/common/CollectionEditView.vue"; import HistoryImport from "components/HistoryImport.vue"; import { HistoryExport } from "components/HistoryExport/index"; import HistoryView from "components/HistoryView.vue"; @@ -96,9 +97,10 @@ export const getAnalysisRouter = (Galaxy) => "(/)datasets(/)list(/)": "show_datasets", "(/)custom_builds": "show_custom_builds", "(/)datasets/edit": "show_dataset_edit_attributes", + "(/)collection(/)edit(/)": "show_collection_edit_attributes", "(/)datasets/error": "show_dataset_error", "(/)interactivetool_entry_points(/)list": "show_interactivetool_list", - "(/)library/folders(/)(:folder_id)": "show_library_folder", + "(/)library/folders(/)(:folder_id)": "show_library_folder" }, require_login: ["show_user", "show_user_form", "show_workflows", "show_cloud_auth", "show_external_ids"], @@ -389,6 +391,10 @@ export const getAnalysisRouter = (Galaxy) => this.page.display(new DatasetEditAttributes.View()); }, + show_collection_edit_attributes: function () { + this._display_vue_helper(CollectionEditView); + }, + show_dataset_error: function () { this.page.display(new DatasetError.View()); }, From abcc9253d0dd2efe081716871246baf035e4068d Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Thu, 4 Feb 2021 11:40:49 -0500 Subject: [PATCH 04/97] routing figured out --- .../components/History/ContentItem/DatasetCollection/DscUI.vue | 2 +- lib/galaxy/webapps/galaxy/buildapp.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscUI.vue b/client/src/components/History/ContentItem/DatasetCollection/DscUI.vue index 57a6cd1966b..f362cd35fb8 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscUI.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscUI.vue @@ -50,7 +50,7 @@ - + Date: Wed, 10 Feb 2021 20:01:09 -0500 Subject: [PATCH 05/97] able to display data from the collection --- .../Collections/common/CollectionEditView.vue | 93 ++++++++++++++++++- .../ContentItem/DatasetCollection/DscMenu.vue | 14 +-- client/src/entry/analysis/AnalysisRouter.js | 8 +- lib/galaxy/webapps/galaxy/buildapp.py | 2 +- 4 files changed, 104 insertions(+), 13 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 773b84a6244..21080e598ff 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -1,11 +1,100 @@ diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index 9051703fe28..38e88bdbb99 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -23,7 +23,9 @@ key="edit-collection" :title="editButtonTitle" :disabled="collection.deleted || isIn(STATES.UPLOAD, STATES.NEW)" - :href="collectionEditURL()" + @click.stop=" + backboneRoute('collection/edit/' + collection.hdca_id) + " icon="fa fa-pencil" /> @@ -32,12 +34,13 @@ diff --git a/client/src/entry/analysis/AnalysisRouter.js b/client/src/entry/analysis/AnalysisRouter.js index ef1194d0ebe..a6547f2b00e 100644 --- a/client/src/entry/analysis/AnalysisRouter.js +++ b/client/src/entry/analysis/AnalysisRouter.js @@ -97,10 +97,10 @@ export const getAnalysisRouter = (Galaxy) => "(/)datasets(/)list(/)": "show_datasets", "(/)custom_builds": "show_custom_builds", "(/)datasets/edit": "show_dataset_edit_attributes", - "(/)collection(/)edit(/)": "show_collection_edit_attributes", + "(/)collection(/)edit(/)(:collection_id)": "show_collection_edit_attributes", "(/)datasets/error": "show_dataset_error", "(/)interactivetool_entry_points(/)list": "show_interactivetool_list", - "(/)library/folders(/)(:folder_id)": "show_library_folder" + "(/)library/folders(/)(:folder_id)": "show_library_folder", }, require_login: ["show_user", "show_user_form", "show_workflows", "show_cloud_auth", "show_external_ids"], @@ -391,8 +391,8 @@ export const getAnalysisRouter = (Galaxy) => this.page.display(new DatasetEditAttributes.View()); }, - show_collection_edit_attributes: function () { - this._display_vue_helper(CollectionEditView); + show_collection_edit_attributes: function (collection_id) { + this._display_vue_helper(CollectionEditView, {collection_id: collection_id}); }, show_dataset_error: function () { diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 922072d34d6..49150efedbc 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -178,7 +178,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs): webapp.add_client_route('/histories/show_structure') webapp.add_client_route('/datasets/list') webapp.add_client_route('/datasets/edit') - webapp.add_client_route('/collection/edit') + webapp.add_client_route('/collection/edit/{collection_id}') webapp.add_client_route('/datasets/error') webapp.add_client_route('/workflows/list') webapp.add_client_route('/workflows/list_published') From b4e6cc4971387f4c856ce0ad237458828f452fc6 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Thu, 18 Feb 2021 13:12:22 -0500 Subject: [PATCH 06/97] adding uploadutils to pull extensions/genomes --- .../Collections/common/CollectionEditView.vue | 96 ++++++++++++++++++- .../ContentItem/DatasetCollection/DscMenu.vue | 6 +- client/src/entry/analysis/AnalysisRouter.js | 2 +- 3 files changed, 94 insertions(+), 10 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 21080e598ff..a99de369934 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -2,7 +2,11 @@

{{ l("Edit Collection Attributes") }}

- {{ l("Collections are immutable. This means there will be some things you cannot change without creating a new collection. ") }} + {{ + l( + "Collections are immutable. This means there will be some things you cannot change without creating a new collection. " + ) + }} @@ -16,15 +20,32 @@ -

WIP Database/Build in here

+ {{ l("Database/Build: ") }} + + {{ genome.text }} + + + {{ databaseKeyFromElements }}
-

WIP Convert Tool in here

+ {{ l("Datatype: ") }} {{ datatypesFromElements }}
-

WIP Datatypes in here

+ {{ l("Datatype: ") }} {{ datatypesFromElements }}
@@ -39,17 +60,35 @@ import Vue from "vue"; import BootstrapVue from "bootstrap-vue"; import axios from "axios"; import { prependPath } from "utils/redirect"; +import UploadUtils from "mvc/upload/upload-utils"; import _l from "utils/localization"; +import Multiselect from "vue-multiselect"; +//import VueObserveVisibility from "vue-observe-visibility"; +//Vue.use(VueObserveVisibility); Vue.use(BootstrapVue); export default { created() { this.apiCallToGetData(); + UploadUtils.getUploadDatatypes( + (extensions) => { + this.extensions = extensions; + //this.extension = UploadUtils.DEFAULT_EXTENSION; + }, + true, + UploadUtils.AUTO_EXTENSION + ); + UploadUtils.getUploadGenomes((genomes) => { + this.genomes = genomes; + //this.genome = UploadUtils.DEFAULT_GENOME; + }, UploadUtils.DEFAULT_GENOME); }, - components: {}, + components: { Multiselect }, data: function () { return { collection_data: {}, //all data from the response + extensions: {}, + genomes: {}, }; }, props: { @@ -77,6 +116,53 @@ export default { return this.collection_data.elements; }, }, + numberOfCollectionElements: { + get() { + return this.collection_data.element_count; + }, + }, + databaseKeyFromElements: { + get() { + const dbkeysInCollection = []; + for (var index in this.collectionElements) { + var element = this.collectionElements[index]; + if (!dbkeysInCollection.includes(element.object.metadata_dbkey)) { + dbkeysInCollection.push(element.object.metadata_dbkey); + } + } + if (dbkeysInCollection.length == 1) { + return dbkeysInCollection[0]; + } else { + return "?"; + } + }, + }, + genome: { + get() { + return this.databaseKeyFromElements; + }, + }, + datatypesFromElements: { + get() { + const datatypesInCollection = []; + for (var index in this.collectionElements) { + var element = this.collectionElements[index]; + if (!datatypesInCollection.includes(element.object.data_type)) { + datatypesInCollection.push(element.object.data_type); + } + } + if (datatypesInCollection.length == 1) { + return datatypesInCollection[0]; + } else { + return "?"; + } + }, + }, + extension: { + get() { + return this.datatypesFromElements; + }, + }, }, methods: { l(str) { diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index 38e88bdbb99..18125127580 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -23,9 +23,7 @@ key="edit-collection" :title="editButtonTitle" :disabled="collection.deleted || isIn(STATES.UPLOAD, STATES.NEW)" - @click.stop=" - backboneRoute('collection/edit/' + collection.hdca_id) - " + @click.stop="backboneRoute('collection/edit/' + collection.hdca_id)" icon="fa fa-pencil" /> @@ -71,7 +69,7 @@ export default { isIn(...states) { const goodStates = new Set(states); return goodStates.has(this.collection.state); - } + }, }, }; diff --git a/client/src/entry/analysis/AnalysisRouter.js b/client/src/entry/analysis/AnalysisRouter.js index a6547f2b00e..06c310f1228 100644 --- a/client/src/entry/analysis/AnalysisRouter.js +++ b/client/src/entry/analysis/AnalysisRouter.js @@ -392,7 +392,7 @@ export const getAnalysisRouter = (Galaxy) => }, show_collection_edit_attributes: function (collection_id) { - this._display_vue_helper(CollectionEditView, {collection_id: collection_id}); + this._display_vue_helper(CollectionEditView, { collection_id: collection_id }); }, show_dataset_error: function () { From 03eb992f68e788ebd088d8d62b061fd1959c97ab Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 19 Feb 2021 13:06:44 -0500 Subject: [PATCH 07/97] changing getuploadutils parts to a promise --- .../Collections/common/CollectionEditView.vue | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index a99de369934..5e761731073 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -70,18 +70,34 @@ Vue.use(BootstrapVue); export default { created() { this.apiCallToGetData(); - UploadUtils.getUploadDatatypes( - (extensions) => { + UploadUtils.getUploadDatatypes(true, UploadUtils.AUTO_EXTENSION) + .then((extensions) => { this.extensions = extensions; //this.extension = UploadUtils.DEFAULT_EXTENSION; - }, - true, - UploadUtils.AUTO_EXTENSION - ); - UploadUtils.getUploadGenomes((genomes) => { - this.genomes = genomes; - //this.genome = UploadUtils.DEFAULT_GENOME; - }, UploadUtils.DEFAULT_GENOME); + }) + .catch((err) => { + console.log("Error in RuleCollectionBuilder, unable to load datatypes", err); + }); + UploadUtils.getUploadGenomes(UploadUtils.DEFAULT_GENOME) + .then((genomes) => { + this.genomes = genomes; + //this.genome = UploadUtils.DEFAULT_GENOME; + }) + .catch((err) => { + console.log("Error in RuleCollectionBuilder, unable to load genomes", err); + }); + // UploadUtils.getUploadDatatypes( + // (extensions) => { + // this.extensions = extensions; + // //this.extension = UploadUtils.DEFAULT_EXTENSION; + // }, + // true, + // UploadUtils.AUTO_EXTENSION + // ); + // UploadUtils.getUploadGenomes((genomes) => { + // this.genomes = genomes; + // //this.genome = UploadUtils.DEFAULT_GENOME; + // }, UploadUtils.DEFAULT_GENOME); }, components: { Multiselect }, data: function () { From 8bab4f2fdb5e4228f3e54b5c9ac32f0760c2c562 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 19 Feb 2021 23:58:28 -0500 Subject: [PATCH 08/97] fixing error out of merge handling and fixing multiselect error --- .../components/Collections/common/CollectionEditView.vue | 6 +++--- .../History/ContentItem/DatasetCollection/DscMenu.vue | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 5e761731073..3e6f75dfc65 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -76,7 +76,7 @@ export default { //this.extension = UploadUtils.DEFAULT_EXTENSION; }) .catch((err) => { - console.log("Error in RuleCollectionBuilder, unable to load datatypes", err); + console.log("Error in CollectionEditor, unable to load datatypes", err); }); UploadUtils.getUploadGenomes(UploadUtils.DEFAULT_GENOME) .then((genomes) => { @@ -84,7 +84,7 @@ export default { //this.genome = UploadUtils.DEFAULT_GENOME; }) .catch((err) => { - console.log("Error in RuleCollectionBuilder, unable to load genomes", err); + console.log("Error in CollectionEditor, unable to load genomes", err); }); // UploadUtils.getUploadDatatypes( // (extensions) => { @@ -104,7 +104,7 @@ export default { return { collection_data: {}, //all data from the response extensions: {}, - genomes: {}, + genomes: [], }; }, props: { diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index 1b6d01ff38b..317130b82df 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -29,7 +29,7 @@ From c8cb2b70596a1f38927566c0178e45e42e22da2b Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 2 Mar 2021 16:18:12 -0500 Subject: [PATCH 12/97] dropdowns for genome & dbkey working; no errors --- .../Collections/common/CollectionEditView.vue | 84 ++++++++++--------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 0beb536854f..29d3ad66009 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -45,7 +45,23 @@ - {{ l("Datatype: ") }} {{ datatypesFromElements }} + {{ l("Datatype: ") }} + + {{ extension.text }} + {{ datatypesFromElements }} @@ -89,10 +105,12 @@ export default { data: function () { return { collection_data: {}, //all data from the response - extensions: {}, + extensions: [], genomes: [], - selectedGenome: null, + selectedGenome: "", + selectedExtension: "", databaseKeyFromElements: null, + datatypeFromElements: null, }; }, props: { @@ -126,53 +144,20 @@ export default { return this.collection_data.element_count; }, }, - // databaseKeyFromElements: { - // get() { - // const dbkeysInCollection = []; - // for (var index in this.collectionElements) { - // var element = this.collectionElements[index]; - // if (!dbkeysInCollection.includes(element.object.metadata_dbkey)) { - // dbkeysInCollection.push(element.object.metadata_dbkey); - // } - // } - // if (dbkeysInCollection.length == 1) { - // return dbkeysInCollection[0]; - // } else { - // return "?"; - // } - // }, - // }, genome: { get() { - // return this.genomes.find((element) => (element.id == this.databaseKeyFromElements)); return this.selectedGenome; }, set(element) { this.selectedGenome = element; }, - // set(element) { - // this.genome = element; - // }, - }, - datatypesFromElements: { - get() { - const datatypesInCollection = []; - for (var index in this.collectionElements) { - var element = this.collectionElements[index]; - if (!datatypesInCollection.includes(element.object.data_type)) { - datatypesInCollection.push(element.object.data_type); - } - } - if (datatypesInCollection.length == 1) { - return datatypesInCollection[0]; - } else { - return "?"; - } - }, }, extension: { get() { - return this.datatypesFromElements; + return this.selectedExtension; + }, + set(element) { + this.selectedExtension = element; }, }, }, @@ -187,6 +172,7 @@ export default { .then((response) => { this.collection_data = response.data; this.getDatabaseKeyFromElements(); + this.getExtensionFromElements(); console.log("collection_data", this.collection_data); }); @@ -205,7 +191,23 @@ export default { } else { this.databaseKeyFromElements = "?"; } - this.selectedGenome = this.genomes.find((element) => (element.id == this.databaseKeyFromElements)); + this.selectedGenome = this.genomes.find((element) => element.id == this.databaseKeyFromElements); + console.log(this.selectedGenome, "in getDBfromE"); + }, + getExtensionFromElements: function () { + const datatypesInCollection = []; + for (var index in this.collectionElements) { + var element = this.collectionElements[index]; + if (!datatypesInCollection.includes(element.object.file_ext)) { + datatypesInCollection.push(element.object.file_ext); + } + } + if (datatypesInCollection.length == 1) { + this.datatypeFromElements = datatypesInCollection[0]; + } else { + this.datatypeFromElements = UploadUtils.DEFAULT_EXTENSION.id; + } + this.selectedExtension = this.extensions.find((element) => element.id == this.datatypeFromElements); }, }, }; From 98f133d0a54cb7e5fd32a318d541fb3760b52b8b Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 3 Mar 2021 02:07:19 -0500 Subject: [PATCH 13/97] only render save button if user has changed input --- .../Collections/common/CollectionEditView.vue | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 29d3ad66009..fc31879602b 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -11,15 +11,29 @@ - {{ l("Name: ") }} {{ collectionName }}
- {{ l("Collection Type: ") }} {{ collectionType }}
+ {{ l("Name: ") }} {{ collectionName }} +
+ {{ l("Collection Type: ") }} {{ collectionType }} +
{{ l("Elements: ") }}
{{ element.element_identifier }}
+ {{ l("Database/Build: ") }} - {{ l("Datatype: ") }} {{ datatypesFromElements }} + {{ l("Datatype: ") }} {{ datatypeFromElements }} + {{ l("Datatype: ") }}
--> {{ datatypesFromElements }} + >original input: {{ datatypeFromElements }} @@ -107,8 +135,8 @@ export default { collection_data: {}, //all data from the response extensions: [], genomes: [], - selectedGenome: "", - selectedExtension: "", + selectedGenome: {}, + selectedExtension: {}, databaseKeyFromElements: null, datatypeFromElements: null, }; @@ -209,6 +237,9 @@ export default { } this.selectedExtension = this.extensions.find((element) => element.id == this.datatypeFromElements); }, + clickedSave: function () { + console.log("clicked save"); + }, }, }; From b7c0d8cf687aeece5f6700d04adbc20e02713fef Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 5 Mar 2021 01:56:33 -0500 Subject: [PATCH 14/97] WIP PUT endpoint --- .../Collections/common/CollectionEditView.vue | 21 ++++++++++++++--- lib/galaxy/managers/hdcas.py | 14 ++++++++++- .../webapps/galaxy/api/dataset_collections.py | 23 +++++++++++++++++++ lib/galaxy/webapps/galaxy/buildapp.py | 5 ++++ 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index fc31879602b..4f8525c9a1b 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -27,7 +27,7 @@
- - - {{ l("Name: ") }} {{ collectionName }} -
- {{ l("Collection Type: ") }} {{ collectionType }} -
- {{ l("Elements: ") }}
-
{{ element.element_identifier }}
-
- + @@ -72,7 +67,6 @@ import Vue from "vue"; import BootstrapVue from "bootstrap-vue"; import axios from "axios"; import { prependPath } from "utils/redirect"; -import UploadUtils from "mvc/upload/upload-utils"; import _l from "utils/localization"; import Multiselect from "vue-multiselect"; import { errorMessageAsString } from "utils/simple-error"; @@ -84,6 +78,7 @@ import { faTable } from "@fortawesome/free-solid-svg-icons"; import { faBars } from "@fortawesome/free-solid-svg-icons"; import { faUser } from "@fortawesome/free-solid-svg-icons"; import { faCog } from "@fortawesome/free-solid-svg-icons"; +import store from "../../../store/index"; //import VueObserveVisibility from "vue-observe-visibility"; @@ -97,22 +92,10 @@ library.add(faUser); Vue.use(BootstrapVue); export default { created() { - this.apiCallToGetData(); - this.apiCallToGetAttributes(); - UploadUtils.getUploadDatatypes(true, UploadUtils.AUTO_EXTENSION) - .then((extensions) => { - this.extensions = extensions; - }) - .catch((err) => { - console.log("Error in CollectionEditor, unable to load datatypes", err); - }); - UploadUtils.getUploadGenomes(UploadUtils.DEFAULT_GENOME) - .then((genomes) => { - this.genomes = genomes; - }) - .catch((err) => { - console.log("Error in CollectionEditor, unable to load genomes", err); - }); + // this.apiCallToGetData(); + // this.apiCallToGetAttributes(); + this.getDatatypesAndGenomes(); + this.getCollectionDataAndAttributes(); }, components: { Multiselect, DatabaseEditTab, FontAwesomeIcon }, data: function () { @@ -145,20 +128,11 @@ export default { // }, }, collectionType: { + // no setter; for display only get() { return this.collection_data.collection_type; }, }, - collectionElements: { - get() { - return this.collection_data.elements; - }, - }, - numberOfCollectionElements: { - get() { - return this.collection_data.element_count; - }, - }, extension: { get() { return this.selectedExtension; @@ -173,48 +147,65 @@ export default { // _l conflicts private methods of Vue internals, expose as l instead return _l(str); }, + getDatatypesAndGenomes: async function () { + let datatypes = store.getters.getUploadDatatypes(); + if (!datatypes || datatypes.length == 0) { + await store.dispatch("fetchUploadDatatypes"); + datatypes = store.getters.getUploadDatatypes(); + } + this.extensions = datatypes; + + let genomes = store.getters.getUploadGenomes(); + if (!genomes || genomes.length == 0) { + await store.dispatch("fetchUploadGenomes"); + genomes = store.getters.getUploadGenomes(); + } + this.genomes = genomes; + }, + getCollectionDataAndAttributes: async function () { + this.apiCallToGetData(); + + let attributesGet = store.getters.getCollectionAttributes(this.collection_id); + if (attributesGet == null) { + await store.dispatch("fetchCollectionAttributes", this.collection_id); + attributesGet = store.getters.getCollectionAttributes(this.collection_id); + } + this.attributes_data = attributesGet; + this.getDatabaseKeyFromElements(); + this.getExtensionFromElements(); + }, apiCallToGetData: function () { axios .get(prependPath("/api/dataset_collections/" + this.collection_id + "?instance_type=history")) .then((response) => { this.collection_data = response.data; - this.getDatabaseKeyFromElements(); - this.getExtensionFromElements(); }); //TODO error handling }, - apiCallToGetAttributes: function () { - axios - .get(prependPath("/api/dataset_collections/" + this.collection_id + "/attributes")) - .then((response) => { - this.attributes_data = response.data; - this.getDatabaseKeyFromElements(); - this.getExtensionFromElements(); - }); - //TODO error handling - }, getDatabaseKeyFromElements: function () { this.databaseKeyFromElements = this.attributes_data.dbkey; - // this.selectedGenome = this.genomes.find((element) => element.id == this.databaseKeyFromElements); }, getExtensionFromElements: function () { this.datatypeFromElements = this.attributes_data.extension; this.selectedExtension = this.extensions.find((element) => element.id == this.datatypeFromElements); }, clickedSave: function (attribute, newValue) { + console.log("user clicked Save.... genome is", newValue); const url = prependPath("/api/dataset_collections/" + this.collection_id); const data = {}; if (attribute == "dbkey") { - data.add({ dbkey: newValue.id }); + data["dbkey"] = newValue.id; } else if (attribute == "file_ext") { - data.add({ file_ext: newValue.id }); + data["file_ext"] = newValue.id; } axios .put(url, data) .then((response) => { this.apiCallToGetData(); + this.getDatabaseKeyFromElements(); + this.getExtensionFromElements(); }) .catch(this.handleError); }, diff --git a/client/src/components/Collections/common/DatabaseEditTab.vue b/client/src/components/Collections/common/DatabaseEditTab.vue index 6ec80e68245..928d5673fe4 100644 --- a/client/src/components/Collections/common/DatabaseEditTab.vue +++ b/client/src/components/Collections/common/DatabaseEditTab.vue @@ -6,7 +6,7 @@ @@ -28,12 +28,17 @@ diff --git a/client/src/components/WorkflowInvocationState/providers/storeProviders.js b/client/src/components/WorkflowInvocationState/providers/storeProviders.js index 4d7000a3784..9021168b34f 100644 --- a/client/src/components/WorkflowInvocationState/providers/storeProviders.js +++ b/client/src/components/WorkflowInvocationState/providers/storeProviders.js @@ -81,22 +81,26 @@ export const DatasetCollectionProvider = { }; export const GenomeProvider = { - mixins: [SimpleProviderMixin, StoreProviderMixin], + mixins: [SimpleProviderMixin], + async mounted() { + await this.load(); + }, methods: { ...mapCacheActions(["fetchUploadGenomes"]), async load() { this.loading = true; - this.item = await this.fetchUploadGenomes(); + let genomes = this.getUploadGenomes(); + if (genomes == null || genomes.length == 0) { + await this.fetchUploadGenomes(); + genomes = this.getUploadGenomes(); + } + this.item = genomes; this.loading = false; }, }, computed: { - ...mapGetters(["getUploadGenomes"]), - storeItem() { - const genomes = this.getUploadGenomes(); - return genomes ? genomes : []; - }, - }, + ...mapGetters(["getUploadGenomes"]) + } }; export const DatasetCollectionContentProvider = { From d2b397e28310edff15cde17253e9d1fc73dfa20f Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Mon, 24 May 2021 01:21:07 -0400 Subject: [PATCH 62/97] adding SuitableConvertersTab and SuitableConvertersProvider, code review comments, cleaning up dead code, fixing selenium test --- .../Collections/common/CollectionEditView.vue | 117 ++++-------------- .../Collections/common/DatabaseEditTab.vue | 34 ++--- .../common/SuitableConvertersTab.vue | 51 ++++++++ .../providers/index.js | 2 +- .../providers/storeProviders.js | 13 +- 5 files changed, 94 insertions(+), 123 deletions(-) create mode 100644 client/src/components/Collections/common/SuitableConvertersTab.vue diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index c3e1112081e..7e6a6a4457e 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -16,7 +16,7 @@
- - - - {{ l("Converter Tool: ") }} - - - + + + + + +
@@ -60,10 +40,10 @@ import BootstrapVue from "bootstrap-vue"; import axios from "axios"; import { prependPath } from "utils/redirect"; import _l from "utils/localization"; -import Multiselect from "vue-multiselect"; import { errorMessageAsString } from "utils/simple-error"; import DatabaseEditTab from "./DatabaseEditTab"; -import { GenomeProvider } from "../../WorkflowInvocationState/providers"; +import SuitableConvertersTab from "./SuitableConvertersTab"; +import { GenomeProvider, SuitableConvertersProvider } from "../../WorkflowInvocationState/providers"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { library } from "@fortawesome/fontawesome-svg-core"; import { faDatabase } from "@fortawesome/free-solid-svg-icons"; @@ -71,7 +51,6 @@ import { faTable } from "@fortawesome/free-solid-svg-icons"; import { faBars } from "@fortawesome/free-solid-svg-icons"; import { faUser } from "@fortawesome/free-solid-svg-icons"; import { faCog } from "@fortawesome/free-solid-svg-icons"; -import store from "../../../store/index"; library.add(faDatabase); library.add(faTable); @@ -82,21 +61,18 @@ library.add(faUser); Vue.use(BootstrapVue); export default { created() { - this.getDatatypesAndGenomes(); this.getCollectionDataAndAttributes(); - this.getConverterList(); }, - components: { Multiselect, DatabaseEditTab, FontAwesomeIcon, GenomeProvider }, + components: { + DatabaseEditTab, + SuitableConvertersTab, + FontAwesomeIcon, + GenomeProvider, + SuitableConvertersProvider, + }, data: function () { return { attributes_data: {}, - extensions: [], - genomes: [], - selectedExtension: {}, - chosenConverter: {}, - databaseKeyFromElements: null, - suitableConverters: [], - datatypeFromElements: null, errorMessage: null, jobError: null, }; @@ -108,16 +84,8 @@ export default { }, }, computed: { - extension: { - get() { - return this.selectedExtension; - }, - set(element) { - this.selectedExtension = element; - }, - }, - atleastOneSuitableConverter: function () { - return this.suitableConverters.length > 0; + databaseKeyFromElements: function () { + return this.attributes_data.dbkey; }, }, methods: { @@ -125,43 +93,13 @@ export default { // _l conflicts private methods of Vue internals, expose as l instead return _l(str); }, - getDatatypesAndGenomes: async function () { - let datatypes = store.getters.getUploadDatatypes(); - if (!datatypes || datatypes.length == 0) { - await store.dispatch("fetchUploadDatatypes"); - datatypes = store.getters.getUploadDatatypes(); - } - this.extensions = datatypes; - let genomes = store.getters.getUploadGenomes(); - if (!genomes || genomes.length == 0) { - await store.dispatch("fetchUploadGenomes"); - genomes = store.getters.getUploadGenomes(); - } - this.genomes = genomes; - }, getCollectionDataAndAttributes: async function () { - let attributesGet = store.getters.getCollectionAttributes(this.collection_id); + let attributesGet = this.$store.getters.getCollectionAttributes(this.collection_id); if (attributesGet == null) { - await store.dispatch("fetchCollectionAttributes", this.collection_id); - attributesGet = store.getters.getCollectionAttributes(this.collection_id); + await this.$store.dispatch("fetchCollectionAttributes", this.collection_id); + attributesGet = this.$store.getters.getCollectionAttributes(this.collection_id); } this.attributes_data = attributesGet; - this.getDatabaseKeyFromElements(); - this.getExtensionFromElements(); - }, - getDatabaseKeyFromElements: function () { - this.databaseKeyFromElements = this.attributes_data.dbkey; - }, - getExtensionFromElements: function () { - this.datatypeFromElements = this.attributes_data.extension; - this.selectedExtension = this.extensions.find((element) => element.id == this.datatypeFromElements); - }, - getConverterList: async function () { - axios - .get(prependPath("/api/dataset_collections/suitable_converters/" + this.collection_id)) - .then((response) => { - this.suitableConverters = response.data; - }); }, clickedSave: function (attribute, newValue) { const url = prependPath("/api/dataset_collections/" + this.collection_id); @@ -171,19 +109,12 @@ export default { } else if (attribute == "file_ext") { data["file_ext"] = newValue.id; } - axios - .put(url, data) - .then((response) => { - this.apiCallToGetData(); - this.getDatabaseKeyFromElements(); - this.getExtensionFromElements(); - }) - .catch(this.handleError); + axios.put(url, data).catch(this.handleError); }, - clickedConvert: function () { + clickedConvert: function (selectedConverter) { const url = prependPath("/api/tools/"); const data = { - tool_id: this.chosenConverter.tool_id, + tool_id: selectedConverter.tool_id, inputs: { input: { batch: true, values: [{ src: "hdca", id: this.collection_id }] } }, }; axios.post(url, data).catch(this.handleError); diff --git a/client/src/components/Collections/common/DatabaseEditTab.vue b/client/src/components/Collections/common/DatabaseEditTab.vue index f4ec6d82be9..dd9a9a5382f 100644 --- a/client/src/components/Collections/common/DatabaseEditTab.vue +++ b/client/src/components/Collections/common/DatabaseEditTab.vue @@ -6,7 +6,7 @@ @@ -14,7 +14,7 @@ {{ l("Database/Build") }}: - {{ genome.text }} + {{ selectedGenome.text }} @@ -30,6 +30,9 @@ import Multiselect from "vue-multiselect"; export default { + created() { + this.selectedGenome = this.genomes.find((element) => element.id == this.databaseKeyFromElements); + }, components: { Multiselect }, data: function () { return { @@ -48,32 +51,9 @@ export default { }, methods: { clickedSave: function () { - this.$emit("clicked-save", "dbkey", this.genome); + this.$emit("clicked-save", "dbkey", this.selectedGenome); this.selectedGenome = this.genomes.find((element) => element.id == this.databaseKeyFromElements); }, }, - computed: { - genome: { - get() { - return this.selectedGenome; - }, - set(element) { - this.selectedGenome = element; - }, - }, - }, - // watch: { - // //in order to have the dropdown populated with the correct genome, both databaseKeyFromElements and genomes have to be populated - // databaseKeyFromElements() { - // if (this.genomes && this.genomes.length > 0) { - // this.selectedGenome = this.genomes.find((element) => element.id == this.databaseKeyFromElements); - // } - // }, - // genomes() { - // console.log("GENOME2: ", this.genomes); - // // if (this.databaseKeyFromElements != null) { - // // this.selectedGenome = this.genomes.find((element) => element.id == this.databaseKeyFromElements); - // // } - // }, }; diff --git a/client/src/components/Collections/common/SuitableConvertersTab.vue b/client/src/components/Collections/common/SuitableConvertersTab.vue new file mode 100644 index 00000000000..e31ad5ca46f --- /dev/null +++ b/client/src/components/Collections/common/SuitableConvertersTab.vue @@ -0,0 +1,51 @@ + + + diff --git a/client/src/components/WorkflowInvocationState/providers/index.js b/client/src/components/WorkflowInvocationState/providers/index.js index 14c8953a4fc..eccc245799e 100644 --- a/client/src/components/WorkflowInvocationState/providers/index.js +++ b/client/src/components/WorkflowInvocationState/providers/index.js @@ -3,11 +3,11 @@ export { // DatasetProvider, DatasetCollectionContentProvider, GenomeProvider, + SuitableConvertersProvider, JobProvider, } from "./storeProviders"; // test provider export { default as DatasetProvider } from "./DatasetProvider"; export { default as DatasetCollectionProvider } from "./DatasetCollectionProvider"; -// export { default as GenomeProvider } from "./GenomeProvider"; export { default as InvocationStepProvider } from "./InvocationStepProvider"; diff --git a/client/src/components/WorkflowInvocationState/providers/storeProviders.js b/client/src/components/WorkflowInvocationState/providers/storeProviders.js index 9021168b34f..00f814bb3a3 100644 --- a/client/src/components/WorkflowInvocationState/providers/storeProviders.js +++ b/client/src/components/WorkflowInvocationState/providers/storeProviders.js @@ -99,8 +99,17 @@ export const GenomeProvider = { }, }, computed: { - ...mapGetters(["getUploadGenomes"]) - } + ...mapGetters(["getUploadGenomes"]), + }, +}; + +export const SuitableConvertersProvider = { + mixins: [SimpleProviderMixin], + computed: { + url() { + return prependPath(`/api/dataset_collections/suitable_converters/${this.id}`); + }, + }, }; export const DatasetCollectionContentProvider = { From a237bcd351ccc6057457a3676f6ce2d9540edeb1 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 8 Jun 2021 02:18:05 -0400 Subject: [PATCH 63/97] Update HDCA to take advantage of new nested collection query --- lib/galaxy/model/__init__.py | 24 ++---------------------- test/unit/data/test_galaxy_mapping.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 16c4f1d3fcb..6b9c16eb248 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -4598,30 +4598,10 @@ class HistoryDatasetCollectionAssociation(DatasetCollectionInstance, @property def dataset_dbkeys_and_extensions_summary(self): if not hasattr(self, '_dataset_dbkeys_and_extensions_summary'): - db_session = object_session(self) - - dc = alias(DatasetCollection.table) - de = alias(DatasetCollectionElement.table) - hda = alias(HistoryDatasetAssociation.table) - dataset = alias(Dataset.table) - - select_from = dc.outerjoin(de, de.c.dataset_collection_id == dc.c.id) - - depth_collection_type = self.collection.collection_type - while ":" in depth_collection_type: - child_collection = alias(DatasetCollection.table) - child_collection_element = alias(DatasetCollectionElement.table) - select_from = select_from.outerjoin(child_collection, child_collection.c.id == de.c.child_collection_id) - select_from = select_from.outerjoin(child_collection_element, child_collection_element.c.dataset_collection_id == child_collection.c.id) - - de = child_collection_element - depth_collection_type = depth_collection_type.split(":", 1)[1] - - select_from = select_from.outerjoin(hda, hda.c.id == de.c.hda_id).outerjoin(dataset, hda.c.dataset_id == dataset.c.id) - select_stmt = select([hda.c.extension, hda.c._metadata]).select_from(select_from).where(dc.c.id == self.collection.id).distinct() + rows = self.collection._get_nested_collection_attributes(hda_attributes=('_metadata', 'extension')) extensions = set() dbkeys = set() - for row in db_session.execute(select_stmt).fetchall(): + for row in rows: if row is not None: dbkey_field = row._metadata.get('dbkey') if isinstance(dbkey_field, list): diff --git a/test/unit/data/test_galaxy_mapping.py b/test/unit/data/test_galaxy_mapping.py index 1bdd4cd88a5..badc63e284c 100644 --- a/test/unit/data/test_galaxy_mapping.py +++ b/test/unit/data/test_galaxy_mapping.py @@ -356,6 +356,21 @@ class MappingTests(BaseModelTestCase): assert q.all() == [('outer_list', 'inner_list', 'forward'), ('outer_list', 'inner_list', 'reverse')] assert c4.dataset_elements == [dce1, dce2] + def test_dataset_dbkeys_and_extensions_summary(self): + model = self.model + u = model.User(email="mary2@example.com", password="password") + h1 = model.History(name="History 1", user=u) + d1 = model.HistoryDatasetAssociation(extension="bam", dbkey="hg19", history=h1, create_dataset=True, sa_session=model.session) + d2 = model.HistoryDatasetAssociation(extension="txt", dbkey="hg19", history=h1, create_dataset=True, sa_session=model.session) + c1 = model.DatasetCollection(collection_type='paired') + dce1 = model.DatasetCollectionElement(collection=c1, element=d1, element_identifier="forward", element_index=0) + dce2 = model.DatasetCollectionElement(collection=c1, element=d2, element_identifier="reverse", element_index=1) + hdca = model.HistoryDatasetCollectionAssociation(collection=c1, history=h1) + model.session.add_all([d1, d2, c1, dce1, dce2, hdca]) + model.session.flush() + assert hdca.dataset_dbkeys_and_extensions_summary[0] == {"hg19"} + assert hdca.dataset_dbkeys_and_extensions_summary[1] == {"bam", "txt"} + def test_default_disk_usage(self): model = self.model From 7c5dbe3bab8c789012659710a05110218fcd6447 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 30 Jul 2021 19:59:52 -0400 Subject: [PATCH 64/97] fixed issue with overwriting genome --- .../Collections/common/CollectionEditView.vue | 10 ++++- lib/galaxy/managers/collections.py | 8 +++- lib/galaxy/webapps/galaxy/api/tools.py | 40 +++++++++++++++++++ lib/galaxy/webapps/galaxy/buildapp.py | 6 +-- 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index 7e6a6a4457e..be855cec854 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -112,11 +112,17 @@ export default { axios.put(url, data).catch(this.handleError); }, clickedConvert: function (selectedConverter) { - const url = prependPath("/api/tools/"); + const url = prependPath("/api/tools/conversion/" + selectedConverter.tool_id); + console.log(selectedConverter); const data = { + collection_data: this.collection_id, + name: selectedConverter.name, + original_type: selectedConverter.original_type, + target_type: selectedConverter.target_type, tool_id: selectedConverter.tool_id, - inputs: { input: { batch: true, values: [{ src: "hdca", id: this.collection_id }] } }, }; + const data2 = JSON.stringify(this.selectedConverter); + console.log(data2) axios.post(url, data).catch(this.handleError); }, handleError: function (err) { diff --git a/lib/galaxy/managers/collections.py b/lib/galaxy/managers/collections.py index 6633411b3f3..483e0a027f0 100644 --- a/lib/galaxy/managers/collections.py +++ b/lib/galaxy/managers/collections.py @@ -1,4 +1,5 @@ import logging +import numpy as np from sqlalchemy.orm import joinedload, Query @@ -233,7 +234,10 @@ class DatasetCollectionManager: for datatype in dbkeys_and_extensions[1]: new_converters = {} new_converters = datatypes_registry.get_converters_by_datatype(datatype) - set_of_new_converters = set(new_converters.values()) + set_of_new_converters = set() + for tgt_type, tgt_val in new_converters.items(): + converter = (tgt_type, tgt_val, datatype) + set_of_new_converters.add(converter) if (first_extension is True): suitable_converters = set_of_new_converters first_extension = False @@ -241,7 +245,7 @@ class DatasetCollectionManager: suitable_converters = suitable_converters.intersection(set_of_new_converters) suitable_tool_ids = list() for tool in suitable_converters: - tool_info = {"tool_id": tool.id, "name": tool.name} + tool_info = {"tool_id": tool[1].id, "name": tool[1].name, "target_type": tool[0], "original_type": tool[2]} suitable_tool_ids.append(tool_info) return suitable_tool_ids diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index 5b65f247666..62f4aa9e3e7 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -4,6 +4,7 @@ from json import dumps, loads from typing import Any, cast, Dict, Optional from galaxy import exceptions, util, web +from galaxy.managers.collections import DatasetCollectionManager from galaxy.managers.collections_util import dictify_dataset_collection_instance from galaxy.managers.hdas import HDAManager from galaxy.managers.histories import HistoryManager @@ -36,6 +37,7 @@ class ToolsController(BaseGalaxyAPIController, UsesVisualizationMixin): """ history_manager: HistoryManager = depends(HistoryManager) hda_manager: HDAManager = depends(HDAManager) + hdca_manager: DatasetCollectionManager = depends(DatasetCollectionManager) @expose_api_anonymous_and_sessionless def index(self, trans: GalaxyWebTransaction, **kwds): @@ -422,6 +424,44 @@ class ToolsController(BaseGalaxyAPIController, UsesVisualizationMixin): rval.append(citation.to_dict('bibtex')) return rval + @expose_api + def conversion(self, trans:GalaxyWebTransaction, id, payload, **kwd): + converter = self._get_tool(id, user=trans.user) + target_type = payload.get("target_type") + original_type = payload.get("original_type") + original_collection = payload.get("collection_data") + collection_inst = self.hdca_manager.get_dataset_collection_instance(trans, id=original_collection, instance_type="history") + # List of string of dependencies + try: + deps = trans.app.datatypes_registry.converter_deps[original_type][target_type] + except KeyError: + deps = {} + # Generate parameter dictionary + params = {} + # determine input parameter name and add to params + input_name = 'input1' + for key, value in converter.inputs.items(): + if deps and value.name in deps: + params[value.name] = deps[value.name] + elif value.type == 'data': + input_name = key + + params[input_name] = { + "values": [ + { + "id": original_collection, + "hid": collection_inst.hid, + "src": "hdca", + "keep": False + } + ], + "batch": True + } + + # Make the target datatype available to the converter + params['__target_datatype__'] = target_type + converter.handle_input(trans, params) + @expose_api_anonymous_and_sessionless def xrefs(self, trans: GalaxyWebTransaction, id, **kwds): tool = self._get_tool(id, user=trans.user) diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index b3b8095b06b..6023c407fd4 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -419,6 +419,7 @@ def populate_api_routes(webapp, app): webapp.mapper.connect('/api/tools/{id:.+?}/test_data', action='test_data', controller="tools") webapp.mapper.connect('/api/tools/{id:.+?}/diagnostics', action='diagnostics', controller="tools") webapp.mapper.connect('/api/tools/{id:.+?}/citations', action='citations', controller="tools") + webapp.mapper.connect('/api/tools/conversion/{id:.+?}', action='conversion', controller="tools", conditions=dict(method=["POST"])) webapp.mapper.connect('/api/tools/{id:.+?}/xrefs', action='xrefs', controller="tools") webapp.mapper.connect('/api/tools/{id:.+?}/download', action='download', controller="tools") webapp.mapper.connect('/api/tools/{id:.+?}/requirements', action='requirements', controller="tools") @@ -544,11 +545,6 @@ def populate_api_routes(webapp, app): action='download_dataset_collection', conditions=dict(method=["GET"])) - # webapp.mapper.connect("/api/dataset_collections/{id}", - # controller='dataset_collections', - # action='update', - # conditions=dict(method=["PUT"])) - webapp.mapper.connect("/api/dataset_collections/{id}", controller='dataset_collections', action='update', From a9e8fec2492ad13d90651deaeb66d3ebec59bab4 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Mon, 2 Aug 2021 16:16:17 -0400 Subject: [PATCH 65/97] removing logs --- .../src/components/Collections/common/CollectionEditView.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index be855cec854..f9c030dfabe 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -113,7 +113,6 @@ export default { }, clickedConvert: function (selectedConverter) { const url = prependPath("/api/tools/conversion/" + selectedConverter.tool_id); - console.log(selectedConverter); const data = { collection_data: this.collection_id, name: selectedConverter.name, @@ -121,8 +120,6 @@ export default { target_type: selectedConverter.target_type, tool_id: selectedConverter.tool_id, }; - const data2 = JSON.stringify(this.selectedConverter); - console.log(data2) axios.post(url, data).catch(this.handleError); }, handleError: function (err) { From 196b2838fafcc9988d0bc5a3ac8035b6c63f84fc Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 10 Aug 2021 16:02:18 -0400 Subject: [PATCH 66/97] fixed issue with suitable collections for two compatible types --- lib/galaxy/managers/collections.py | 10 +++++++--- lib/galaxy/webapps/galaxy/api/tools.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/managers/collections.py b/lib/galaxy/managers/collections.py index 483e0a027f0..366cee5512c 100644 --- a/lib/galaxy/managers/collections.py +++ b/lib/galaxy/managers/collections.py @@ -1,5 +1,4 @@ import logging -import numpy as np from sqlalchemy.orm import joinedload, Query @@ -230,23 +229,28 @@ class DatasetCollectionManager: dbkeys_and_extensions = dataset_collection_instance.dataset_dbkeys_and_extensions_summary suitable_converters = set() first_extension = True + most_recent_datatype = None # TODO error checking for datatype in dbkeys_and_extensions[1]: new_converters = {} new_converters = datatypes_registry.get_converters_by_datatype(datatype) set_of_new_converters = set() for tgt_type, tgt_val in new_converters.items(): - converter = (tgt_type, tgt_val, datatype) + converter = (tgt_type, tgt_val) set_of_new_converters.add(converter) if (first_extension is True): suitable_converters = set_of_new_converters + most_recent_datatype = datatype first_extension = False else: suitable_converters = suitable_converters.intersection(set_of_new_converters) + if (suitable_converters.__len__ != 0): + most_recent_datatype = datatype suitable_tool_ids = list() for tool in suitable_converters: - tool_info = {"tool_id": tool[1].id, "name": tool[1].name, "target_type": tool[0], "original_type": tool[2]} + tool_info = {"tool_id": tool[1].id, "name": tool[1].name, "target_type": tool[0], "original_type": most_recent_datatype} suitable_tool_ids.append(tool_info) + print("SUITABLETOOLIDS >>>>>>>>>> " + str(suitable_tool_ids)) return suitable_tool_ids def _element_identifiers_to_elements(self, diff --git a/lib/galaxy/webapps/galaxy/api/tools.py b/lib/galaxy/webapps/galaxy/api/tools.py index 62f4aa9e3e7..b250ee7b02e 100644 --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -425,7 +425,7 @@ class ToolsController(BaseGalaxyAPIController, UsesVisualizationMixin): return rval @expose_api - def conversion(self, trans:GalaxyWebTransaction, id, payload, **kwd): + def conversion(self, trans: GalaxyWebTransaction, id, payload, **kwd): converter = self._get_tool(id, user=trans.user) target_type = payload.get("target_type") original_type = payload.get("original_type") @@ -457,7 +457,7 @@ class ToolsController(BaseGalaxyAPIController, UsesVisualizationMixin): ], "batch": True } - + # Make the target datatype available to the converter params['__target_datatype__'] = target_type converter.handle_input(trans, params) From c23d78c3ab11d4540be9b37df3f72a13a384d8b4 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 11 Aug 2021 11:39:54 -0400 Subject: [PATCH 67/97] prompting tests to run --- client/src/entry/analysis/AnalysisRouter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/entry/analysis/AnalysisRouter.js b/client/src/entry/analysis/AnalysisRouter.js index 48c7a19ccad..c006ab5f501 100644 --- a/client/src/entry/analysis/AnalysisRouter.js +++ b/client/src/entry/analysis/AnalysisRouter.js @@ -399,6 +399,7 @@ export const getAnalysisRouter = (Galaxy) => { this._display_vue_helper(DatasetError, { datasetId: datasetId }); }, + /** */ home: function (params) { // TODO: to router, remove Globals From 0eacc3d141fba4ea24f4eca8208efc6ff33bedd4 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 11 Aug 2021 17:34:15 -0400 Subject: [PATCH 68/97] fixing linting issues and Selenium test error --- client/src/entry/analysis/AnalysisRouter.js | 1 - lib/galaxy/selenium/navigation.yml | 4 ---- lib/galaxy_test/api/test_dataset_collections.py | 1 + 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/client/src/entry/analysis/AnalysisRouter.js b/client/src/entry/analysis/AnalysisRouter.js index c006ab5f501..48c7a19ccad 100644 --- a/client/src/entry/analysis/AnalysisRouter.js +++ b/client/src/entry/analysis/AnalysisRouter.js @@ -399,7 +399,6 @@ export const getAnalysisRouter = (Galaxy) => { this._display_vue_helper(DatasetError, { datasetId: datasetId }); }, - /** */ home: function (params) { // TODO: to router, remove Globals diff --git a/lib/galaxy/selenium/navigation.yml b/lib/galaxy/selenium/navigation.yml index ac6d3537636..465592c6b72 100644 --- a/lib/galaxy/selenium/navigation.yml +++ b/lib/galaxy/selenium/navigation.yml @@ -205,9 +205,6 @@ history_panel: type: xpath selector: '//a[contains(text(), "Show Structure")]' options_show_export_history_to_file: 'a[title="Export History to File"]' - options_use_beta_history: - type: xpath - selector: '//a[text()="Export History to File"]' options_use_beta_history: type: xpath selector: '//a[text()="Use Beta History Panel"]' @@ -219,7 +216,6 @@ history_panel: collection_menu_edit_attributes: type: xpath selector: '//button[@title="Edit attributes"]' - selector: '//a[text()="Use Beta History Panel"]' new_history_button: '.history-new-button' multi_view_button: '.history-view-multi-button' diff --git a/lib/galaxy_test/api/test_dataset_collections.py b/lib/galaxy_test/api/test_dataset_collections.py index 389609d0fbf..5238e0a216d 100644 --- a/lib/galaxy_test/api/test_dataset_collections.py +++ b/lib/galaxy_test/api/test_dataset_collections.py @@ -438,6 +438,7 @@ class DatasetCollectionApiTestCase(ApiTestCase): expected = Counter([]) actual = Counter([converter["tool_id"] for converter in converters.json()]) assert actual == expected + def test_collection_tools_tag_propagation(self): elements = [{"src": "files", "tags": ["name:element_tag"]}] targets = [{ From a23942544b1cd53fa04d95a66084bf2d58fabf7e Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 17 Aug 2021 17:06:33 -0400 Subject: [PATCH 69/97] updating based on review - changing suitable_converters endpoint and updating selenium test --- .../WorkflowInvocationState/providers/storeProviders.js | 2 +- lib/galaxy/webapps/galaxy/buildapp.py | 2 +- lib/galaxy_test/api/test_dataset_collections.py | 6 +++--- lib/galaxy_test/selenium/test_collection_edit.py | 8 ++------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/client/src/components/WorkflowInvocationState/providers/storeProviders.js b/client/src/components/WorkflowInvocationState/providers/storeProviders.js index 00f814bb3a3..ddf74c81608 100644 --- a/client/src/components/WorkflowInvocationState/providers/storeProviders.js +++ b/client/src/components/WorkflowInvocationState/providers/storeProviders.js @@ -107,7 +107,7 @@ export const SuitableConvertersProvider = { mixins: [SimpleProviderMixin], computed: { url() { - return prependPath(`/api/dataset_collections/suitable_converters/${this.id}`); + return prependPath(`/api/dataset_collections/${this.id}/suitable_converters`); }, }, }; diff --git a/lib/galaxy/webapps/galaxy/buildapp.py b/lib/galaxy/webapps/galaxy/buildapp.py index 6023c407fd4..db9e77aa29f 100644 --- a/lib/galaxy/webapps/galaxy/buildapp.py +++ b/lib/galaxy/webapps/galaxy/buildapp.py @@ -556,7 +556,7 @@ def populate_api_routes(webapp, app): conditions=dict(method=["GET"])) webapp.mapper.connect("api_suitable_converters", - "/api/dataset_collections/suitable_converters/{id}", + "/api/dataset_collections/{id}/suitable_converters", controller='dataset_collections', action='suitable_converters', conditions=dict(method=['GET'])) diff --git a/lib/galaxy_test/api/test_dataset_collections.py b/lib/galaxy_test/api/test_dataset_collections.py index 5238e0a216d..3ed6624f550 100644 --- a/lib/galaxy_test/api/test_dataset_collections.py +++ b/lib/galaxy_test/api/test_dataset_collections.py @@ -376,7 +376,7 @@ class DatasetCollectionApiTestCase(ApiTestCase): ]) self._assert_status_code_is(response, 200) hdca_list_id = response.json()["outputs"][0]["id"] - converters = self._get("dataset_collections/suitable_converters/" + hdca_list_id) + converters = self._get("dataset_collections/" + hdca_list_id + "/suitable_converters") expected = Counter([ 'CONVERTER_bed_to_fli_0', 'CONVERTER_interval_to_bed_0', @@ -410,7 +410,7 @@ class DatasetCollectionApiTestCase(ApiTestCase): ]) self._assert_status_code_is(response, 200) hdca_list_id = response.json()["outputs"][0]["id"] - converters = self._get("dataset_collections/suitable_converters/" + hdca_list_id) + converters = self._get("dataset_collections/" + hdca_list_id + "/suitable_converters") expected = Counter(['tabular_to_csv']) actual = Counter([converter["tool_id"] for converter in converters.json()]) assert actual == expected @@ -434,7 +434,7 @@ class DatasetCollectionApiTestCase(ApiTestCase): ]) self._assert_status_code_is(response, 200) hdca_list_id = response.json()["outputs"][0]["id"] - converters = self._get("dataset_collections/suitable_converters/" + hdca_list_id) + converters = self._get("dataset_collections/" + hdca_list_id + "/suitable_converters") expected = Counter([]) actual = Counter([converter["tool_id"] for converter in converters.json()]) assert actual == expected diff --git a/lib/galaxy_test/selenium/test_collection_edit.py b/lib/galaxy_test/selenium/test_collection_edit.py index f5caf6c6094..e3cc16b5b75 100644 --- a/lib/galaxy_test/selenium/test_collection_edit.py +++ b/lib/galaxy_test/selenium/test_collection_edit.py @@ -13,7 +13,7 @@ class CollectionEditTestCase(SeleniumTestCase): @selenium_test def test_change_dbkey_simple_list(self): self.create_simple_list_collection() - self.switch_to_beta_history() + self.use_beta_history() self.open_collection_edit_view() self.navigate_to_database_tab() dbkeyValue = "Additional" @@ -22,7 +22,7 @@ class CollectionEditTestCase(SeleniumTestCase): self.change_dbkey_value_and_click_submit(dbkeyValue, dbkeyNew) self.components.history_panel.options_use_legacy_history.wait_for_and_click() self.history_panel_wait_for_hid_ok(4) - self.switch_to_beta_history() + self.use_beta_history() self.open_collection_edit_view() self.navigate_to_database_tab() self.check_current_dbkey_value(dbkeyNew) @@ -40,10 +40,6 @@ class CollectionEditTestCase(SeleniumTestCase): self.collection_builder_create() self.history_panel_wait_for_hid_ok(2) - def switch_to_beta_history(self): - self.click_history_options() - self.components.history_panel.options_use_beta_history.wait_for_and_click() - def open_collection_edit_view(self): self.components.history_panel.collection_menu_edit_attributes.wait_for_and_click() From 8207d54e32a41dfcce7481dc4a6f1ee9f961e5e1 Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Wed, 18 Aug 2021 15:21:44 -0400 Subject: [PATCH 70/97] combining fontawesome imports into fewer lines --- .../Collections/common/CollectionEditView.vue | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/client/src/components/Collections/common/CollectionEditView.vue b/client/src/components/Collections/common/CollectionEditView.vue index f9c030dfabe..1e2ee38c7bf 100644 --- a/client/src/components/Collections/common/CollectionEditView.vue +++ b/client/src/components/Collections/common/CollectionEditView.vue @@ -46,17 +46,9 @@ import SuitableConvertersTab from "./SuitableConvertersTab"; import { GenomeProvider, SuitableConvertersProvider } from "../../WorkflowInvocationState/providers"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { library } from "@fortawesome/fontawesome-svg-core"; -import { faDatabase } from "@fortawesome/free-solid-svg-icons"; -import { faTable } from "@fortawesome/free-solid-svg-icons"; -import { faBars } from "@fortawesome/free-solid-svg-icons"; -import { faUser } from "@fortawesome/free-solid-svg-icons"; -import { faCog } from "@fortawesome/free-solid-svg-icons"; +import { faDatabase, faTable, faBars, faUser, faCog } from "@fortawesome/free-solid-svg-icons"; -library.add(faDatabase); -library.add(faTable); -library.add(faBars); -library.add(faCog); -library.add(faUser); +library.add(faDatabase, faTable, faBars, faUser, faCog); Vue.use(BootstrapVue); export default { From 1d32944aac212ee81e1507cc4f7c4115ab9dc90e Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Fri, 20 Aug 2021 03:19:51 -0400 Subject: [PATCH 71/97] fixing Selenium test and running prettier --- .../History/ContentItem/DatasetCollection/DscMenu.vue | 9 +-------- lib/galaxy_test/selenium/test_collection_edit.py | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue index c5412a9ee73..82af5d78d5c 100644 --- a/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue +++ b/client/src/components/History/ContentItem/DatasetCollection/DscMenu.vue @@ -10,14 +10,7 @@ variant="link" class="px-1 collection-edit-view" /> - +