mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Consolidate rules collection builder handling
This commit is contained in:
+1
-1
@@ -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") {
|
||||
|
||||
+11
-5
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user