Skip to content

Commit

Permalink
Cleanup rule UI code, refactor toward use w/existing collections.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Apr 3, 2018
1 parent 553b718 commit 8b78c84
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
34 changes: 28 additions & 6 deletions client/galaxy/scripts/components/RuleCollectionBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,13 @@
{{ l("Hide original elements") }}:
<input type="checkbox" v-model="hideSourceItems" />
</label>
<label class="rule-option rule-option-extension" v-if="elementsType !== 'datasets' && !mappingAsDict.file_type">
<label class="rule-option rule-option-extension" v-if="showFileTypeSelector">
{{ l("Type") }}:
<select2 name="extension" style="width: 120px" v-model="extension" v-if="extension">
<option v-for="(col, index) in extensions" :value="col['id']"">{{ col["text"] }}</option>
</select2>
</label>
<label class="rule-option" v-if="elementsType !== 'datasets' && !mappingAsDict.dbkey">
<label class="rule-option" v-if="showGenomeSelector">
{{ l("Genome") }}:
<select2 id="genome-selector" style="width: 120px" v-model="genome" v-if="genome">
<option v-for="(col, index) in genomes" :value="col['id']"">{{ col["text"] }}</option>
Expand All @@ -338,8 +338,8 @@
<button @click="resetRulesAndState" :title="titleReset" class="creator-reset-btn btn rule-btn-reset">
{{ l("Reset") }}
</button>
<button @click="createCollection" class="create-collection btn btn-primary rule-btn-okay" v-bind:class="{ disabled: !validInput }">
{{ elementsType == "datasets" ? l("Create") : l("Upload") }}
<button @click="createCollection" :title="titleFinish" class="create-collection btn btn-primary rule-btn-okay" v-bind:class="{ disabled: !validInput }">
{{ finishButtonTitle }}
</button>
</option-buttons-div>
</div>
Expand Down Expand Up @@ -722,8 +722,6 @@ export default {
} else if(this.elementsType == "datasets") {
mapping = [{"type": "list_identifiers", "columns": [1]}];
} else {
// TODO: incorrect to ease testing, fix.
// mapping = [{"type": "url", "columns": [0]}, {"type": "list_identifiers", "columns": [1]}, {"type": "paired_identifier", "columns": [3]}, {"type": "collection_name", "columns": [5]}];
mapping = [];
}
return {
Expand Down Expand Up @@ -832,6 +830,30 @@ export default {
}
},
computed: {
exisistingDatasets() {
const elementsType = this.elementsType;
return elementsType === "datasets";
},
showFileTypeSelector() {
return !this.exisistingDatasets && !this.mappingAsDict.file_type;
},
showGenomeSelector() {
return !this.exisistingDatasets && !this.mappingAsDict.dbkey;
},
titleFinish() {
if(this.elementsType == "datasets") {
return _l("Create new collection from specified rules and datasets.");
} else {
return _l("Upload collection using specified rules.");
}
},
finishButtonTitle() {
if(this.elementsType == "datasets") {
return _l("Create");
} else {
return _l("Upload");
}
},
hasActiveMappingEdit() {
const has = _.any(_.values(this.mapping), (mapping) => mapping.editing);
return has;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,8 @@ var ruleBasedCollectionCreatorModal = function _ruleBasedCollectionCreatorModal(
importType,
options
) {
// importType in [datasets, collection]
// elementsType in [raw, ftp, datasets]
let title;
if (importType == "datasets") {
title = _l("Build Rules for Uploading Datasets");
Expand Down

0 comments on commit 8b78c84

Please sign in to comment.