Skip to content

Commit

Permalink
Consolidate rules collection builder handling
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Sep 17, 2022
1 parent 05066ac commit 1cd60fe
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export default {
await this.buildNewCollection("rules");
},
async buildNewCollection(collectionType) {
const modalResult = await buildCollectionModal(collectionType, this.history.id, this.contentSelection);
const modalResult = await buildCollectionModal(collectionType, this.contentSelection, this.history.id);
await createDatasetCollection(this.history, modalResult);
// have to hide the source items if that was requested
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/History/adapters/HistoryPanelProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ export class HistoryPanelProxy {
this.model.id = historyId;
store.dispatch("history/setCurrentHistory", historyId);
}
async buildCollection(collectionType, historyId, selection, fromRulesInput = false) {
async buildCollection(collectionType, selection, historyId = null, fromRulesInput = false) {
let selectionContent = null;
historyId = historyId || this.model.id;
if (fromRulesInput) {
if (collectionType == "rules") {
selectionContent = selection;
} else {
selectionContent = new Map();
selection.models.forEach((obj) => {
selectionContent.set(obj.id, obj);
});
}
const modalResult = await buildCollectionModal(collectionType, historyId, selectionContent, fromRulesInput);
const modalResult = await buildCollectionModal(collectionType, selectionContent, historyId, fromRulesInput);
if (modalResult) {
console.debug("Submitting collection build request.", modalResult);
await createDatasetCollection({ id: historyId }, modalResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import LIST_OF_PAIRS_COLLECTION_CREATOR from "components/Collections/PairedListC
import RULE_BASED_COLLECTION_CREATOR from "components/Collections/RuleBasedCollectionCreatorModal";

// stand-in for buildCollection from history-view-edit.js
export async function buildCollectionModal(collectionType, historyId, selectedContent, fromRulesInput = false) {
export async function buildCollectionModal(collectionType, selectedContent, historyId, fromRulesInput = false) {
// select legacy function
let createFunc;
if (collectionType == "list") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,18 @@ var ImportCollectionModal = Backbone.View.extend({
}
},
collectionImport: function (collectionElements, historyId) {
this.collectionType = this.modal.$el.find("#library-collection-type-select").val();
const selection = {
models: collectionElements,
};
const collectionType = this.modal.$el.find("#library-collection-type-select").val();
let selection = null;
if (collectionType == "rules") {
selection = collectionElements;
selection.selectionType = "library_datasets";
} else {
selection = {
models: collectionElements,
};
}
const Galaxy = getGalaxyInstance();
Galaxy.currHistoryPanel.buildCollection(this.collectionType, historyId, selection);
Galaxy.currHistoryPanel.buildCollection(collectionType, selection, historyId);
},
templateCollectionSelectModal: function () {
return _.template(
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export default {
models: Object.values(models),
historyId: Galaxy.currHistoryPanel.model.id,
};
Galaxy.currHistoryPanel.buildCollection(this.collectionType, null, selection);
Galaxy.currHistoryPanel.buildCollection(this.collectionType, selection);
this.counterRunning = 0;
this._updateStateForCounters();
this._eventReset();
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/RulesInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default {
selection.elements = this.uris;
}
selection.dataType = this.dataType;
Galaxy.currHistoryPanel.buildCollection("rules", null, selection, true);
Galaxy.currHistoryPanel.buildCollection("rules", selection, null, true);
this.$emit("dismiss");
},
},
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy_test/selenium/test_histories_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_history_view(self):
self._login()
self.navigate_to_histories_page()
self.click_grid_popup_option(self.history2_name, "View")
history_name = self.wait_for_selector(".name.editable-text")
history_name = self.wait_for_selector("[data-description='name display']")
self.assertEqual(history_name.text, self.history2_name)

@selenium_test
Expand Down

0 comments on commit 1cd60fe

Please sign in to comment.