Consolidate rules collection builder handling

This commit is contained in:
guerler
2022-09-18 15:23:08 -04:00
parent d1e6908948
commit 2b17a34400
7 changed files with 18 additions and 12 deletions
@@ -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
@@ -61,7 +61,7 @@ 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) {
@@ -72,7 +72,7 @@ export class HistoryPanelProxy {
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);
@@ -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") {
@@ -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(
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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");
},
},
@@ -31,7 +31,7 @@ class SavedHistoriesTestCase(SharedStateSeleniumTestCase):
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