Skip to content

Commit

Permalink
Merge other recent rule PRs into apply_rules branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Apr 24, 2018
2 parents cf2f6d7 + 1d5d83f commit dbd8664
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
37 changes: 16 additions & 21 deletions client/galaxy/scripts/components/RuleCollectionBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Below is a raw JSON description of the rules to apply to the tabular data. This is an advanced setting.
</rule-modal-header>
<rule-modal-header v-else-if="elementsType == 'datasets' || elementsType == 'library_datasets'">
Use this form to describe rules for building a collection from the specified datasets.
Use this form to describe rules for building collection(s) from the specified datasets. <b>Be sure to specify at least one column as a list identifier</b> - specify more to created nested list structures. Specify a column to serve as "collection name" to group datasets into multiple collections.
</rule-modal-header>
<!-- This modality allows importing individual datasets, multiple collections,
and requires a data source - note that. -->
Expand Down Expand Up @@ -214,6 +214,7 @@
v-bind:index="target"
v-bind:key="target"
class="dropdown-item"
href="javascript:void(0)"
:class="'rule-add-mapping-' + target.replace(/_/g, '-')"
@click="addIdentifier(target)">
{{ mappingTargets()[target].label }}
Expand Down Expand Up @@ -250,7 +251,7 @@
v-on:mouseout.native="map.columns.forEach((col) => unhighlightColumn(col))"
:col-headers="colHeaders" />
<div v-if="mapping.length == 0">
One or more column definitions must be specified. These are required to specify how to build collections and datasets from rows and columns of the table. <a class="force-link-style" @click="displayRuleType = 'mapping'">Click here</a> to manage column definitions.
One or more column definitions must be specified. These are required to specify how to build collections and datasets from rows and columns of the table. <a href="javascript:void(0)" @click="displayRuleType = 'mapping'">Click here</a> to manage column definitions.
</div>
</ol>
<div class="rules-buttons">
Expand All @@ -263,7 +264,7 @@
<rule-target-component :builder="this" rule-type="remove_columns" />
<rule-target-component :builder="this" rule-type="split_columns" />
<rule-target-component :builder="this" rule-type="swap_columns" />
<a class="dropdown-item rule-link rule-link-mapping" @click="displayRuleType = 'mapping'">Add / Modify Column Definitions</a>
<a href="javascript:void(0)" class="dropdown-item rule-link rule-link-mapping" @click="displayRuleType = 'mapping'">Add / Modify Column Definitions</a>
</div>
</div>
<div class="btn-group dropup">
Expand Down Expand Up @@ -391,6 +392,7 @@
</state-div>
</template>
<script>
import AjaxQueue from "utils/ajax-queue";
import axios from "axios";
import _l from "utils/localization";
import HotTable from "@handsontable/vue";
Expand Down Expand Up @@ -704,7 +706,7 @@ const IdentifierDisplay = {
};
const RuleTargetComponent = {
template: `<a class="rule-link dropdown-item" :class="linkClassName" @click="builder.addNewRule(ruleType)">{{title}}</a>`,
template: `<a class="rule-link dropdown-item" href="javascript:void(0)" :class="linkClassName" @click="builder.addNewRule(ruleType)">{{title}}</a>`,
props: {
ruleType: {
type: String,
Expand Down Expand Up @@ -783,7 +785,7 @@ const RuleModalMiddle = {
}
const RuleModalFooter = {
template: `
template: `
<div class="rule-footer footer flex-row no-flex">
<slot name="inputs"></slot>
<div class="actions clear vertically-spaced">
Expand Down Expand Up @@ -962,7 +964,7 @@ export default {
computed: {
exisistingDatasets() {
const elementsType = this.elementsType;
return elementsType === "datasets" || elementsType === "collection_contents";
return elementsType === "datasets" || elementsType === "collection_contents" || elementsType === "library_datasets";
},
showFileTypeSelector() {
return !this.exisistingDatasets && !this.mappingAsDict.file_type;
Expand Down Expand Up @@ -1373,9 +1375,13 @@ export default {
if (this.elementsType == "datasets" || this.elementsType == "library_datasets") {
const elements = this.creationElementsFromDatasets();
if (this.state !== "error") {
const response = this.creationFn(elements, collectionType, name, this.hideSourceItems);
response.done(this.oncreate);
response.error(this.renderFetchError);
new AjaxQueue.AjaxQueue(
_.map(elements, (elements, name) => {
return () => {
const response = this.creationFn(elements, collectionType, name, this.hideSourceItems);
return response;
};
})).done(this.oncreate).fail(this.renderFetchError);
}
} else if (this.elementsType == "collection_contents") {
this.resetSource();
Expand Down Expand Up @@ -1549,13 +1555,7 @@ export default {
},
"element_identifiers"
);
// This modality only allows a single collection to be created currently.
if (elementsByCollectionName) {
return elementsByCollectionName[this.collectionName];
} else {
// state was set to error...
return;
}
return elementsByCollectionName;
},
creationElementsForFetch() {
// fetch elements for HDCA
Expand Down Expand Up @@ -1886,9 +1886,4 @@ export default {
.fa-wrench {
cursor: pointer;
}
/* Galaxy's drops underline on a without href, but I cannot use href="#" in this component
because it interferes with the library router. */
a.force-link-style {
text-decoration: underline !important;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,8 @@ var ruleBasedCollectionCreatorModal = function _ruleBasedCollectionCreatorModal(
title = _l("Build Rules for Uploading Datasets");
} else if (elementsType == "collection_contents") {
title = _l("Build Rules for Applying to Existing Collection");
} else if (elementsType == "datasets") {
title = _l("Build Rules for Creating Collection");
} else if (elementsType == "datasets" || elementsType == "library_datasets") {
title = _l("Build Rules for Creating Collection(s)");
} else {
title = _l("Build Rules for Uploading Collections");
}
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/rules/rule-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ const MAPPING_TARGETS = {
help: _l(
"If this is set, all rows with the same collection name will be joined into a collection and it is possible to create multiple collections at once."
),
modes: ["raw", "ftp"], // TODO: allow this in datasets mode & tool builder modes
modes: ["raw", "ftp", "datasets", "library_datasets"],
importType: "collections"
},
name: {
Expand Down

0 comments on commit dbd8664

Please sign in to comment.