Skip to content

Commit

Permalink
Allow using the rule based collection builders right from libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Apr 19, 2018
1 parent 43c4180 commit d90eeb3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
19 changes: 12 additions & 7 deletions client/galaxy/scripts/components/RuleCollectionBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="header flex-row no-flex" v-if="ruleView == 'source'">
The is an advanced setting, below is a raw JSON description of the rules to apply to the tabular data used. The alternative graphical editor is recommended for most usages.
</div>
<div class="header flex-row no-flex" v-else-if="elementsType == 'datasets'">
<div class="header flex-row no-flex" v-else-if="elementsType == 'datasets' || elementsType == 'library_datasets'">
Use this form to describe rules for building a collection from the specified datasets.
</div>
<!-- This modality allows importing individual datasets, multiple collections,
Expand Down Expand Up @@ -859,14 +859,14 @@ export default {
return this.importType == "collections" && !this.mappingAsDict.collection_name;
},
titleFinish() {
if (this.elementsType == "datasets") {
if (this.elementsType == "datasets" || this.elementsType == "library_datasets") {
return _l("Create new collection from specified rules and datasets.");
} else {
return _l("Upload collection using specified rules.");
}
},
finishButtonTitle() {
if (this.elementsType == "datasets") {
if (this.elementsType == "datasets" || this.elementsType == "library_datasets") {
return _l("Create");
} else {
return _l("Upload");
Expand Down Expand Up @@ -925,6 +925,9 @@ export default {
if (this.elementsType == "datasets") {
data = this.initialElements.map(el => [el["hid"], el["name"]]);
sources = this.initialElements.slice();
} else if (this.elementsType == "library_datasets") {
data = this.initialElements.map(el => [el["name"]]);
sources = this.initialElements.slice();
} else {
data = this.initialElements.slice();
sources = data.map(el => null);
Expand Down Expand Up @@ -1027,7 +1030,8 @@ export default {
// raw tabular variant can build stand-alone datasets without identifier
// columns for the collection builder for existing datasets cannot do this.
if (this.elementsType == "datasets" && identifierColumns.length == 0) {
const fromDatasets = this.elementsType == "datasets" || this.elementsType == "library_datasets";
if (fromDatasets && identifierColumns.length == 0) {
valid = false;
}
return valid;
Expand Down Expand Up @@ -1212,9 +1216,9 @@ export default {
this.state = "wait";
const name = this.collectionName;
const collectionType = this.collectionType;
if (this.elementsType == "datasets") {
if (this.elementsType == "datasets" || this.elementsType == "library_datasets") {
const elements = this.creationElementsFromDatasets();
const response = this.creationFn(elements, collectionType, name);
const response = this.creationFn(elements, collectionType, name, this.hideSourceItems);
response.done(this.oncreate);
response.error(this.renderFetchError);
} else {
Expand Down Expand Up @@ -1361,7 +1365,8 @@ export default {
const elementsByCollectionName = this.buildRequestElements(
(dataIndex, identifier) => {
const source = sources[dataIndex];
return { id: source["id"], name: identifier, src: "hda" };
const src = this.elementsType == "datasets" ? "hda" : "ldda";
return { id: source["id"], name: identifier, src: src };
},
identifier => {
return { name: identifier, src: "new_collection" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,5 +1170,6 @@ export default {
collectionCreatorModal: collectionCreatorModal,
listCollectionCreatorModal: listCollectionCreatorModal,
createListCollection: createListCollection,
createCollectionViaRules: createCollectionViaRules
createCollectionViaRules: createCollectionViaRules,
ruleBasedCollectionCreatorModal: ruleBasedCollectionCreatorModal
};
14 changes: 13 additions & 1 deletion client/galaxy/scripts/mvc/library/library-foldertoolbar-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,8 @@ var FolderToolbarView = Backbone.View.extend({
data: [
{ id: "list", text: "List" },
{ id: "paired", text: "Paired" },
{ id: "list:paired", text: "List of Pairs" }
{ id: "list:paired", text: "List of Pairs" },
{ id: "rules", text: "From Rules" }
],
value: "list",
onchange: collectionType => {
Expand Down Expand Up @@ -1353,6 +1354,14 @@ var FolderToolbarView = Backbone.View.extend({
title: modal_title,
defaultHideSourceItems: true
});
} else if (this.collectionType === "rules") {
const creationFn = (elements, collectionType, name, hideSourceItems) => {
return this.createHDCA(elements, collectionType, name, hideSourceItems, history_id);
};
LIST_CREATOR.ruleBasedCollectionCreatorModal(collection_elements, "library_datasets", "collections", {
creationFn: creationFn,
defaultHideSourceItems: true
});
}
},

Expand Down Expand Up @@ -1845,6 +1854,9 @@ var FolderToolbarView = Backbone.View.extend({
"<li>",
"List of Pairs: Advanced collection containing any number of Pairs; imagine as Pair-type collections inside of a List-type collection.",
"</li>",
"<li>",
"From Rules: Use Galaxy's rule builder to describe collections. This is more of an advanced feature that allows building any number of collections or any type.",
"</li>",
"</ul>",
"</div>",
// history selection/creation
Expand Down

0 comments on commit d90eeb3

Please sign in to comment.