mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Use dataset selector in rules input dialog.
This commit is contained in:
@@ -78,7 +78,7 @@ export default {
|
||||
},
|
||||
allowUpload: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -22,18 +22,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="upload-rule-dataset-option" class="upload-rule-option" v-if="selectionType == 'dataset'">
|
||||
<div class="upload-rule-option-title">{{ l("Select dataset to load") }}</div>
|
||||
<div class="dataset-selector">
|
||||
<select2
|
||||
v-model="selectedDatasetId"
|
||||
container-class="upload-footer-selection"
|
||||
placeholder="Select Dataset"
|
||||
>
|
||||
<option></option>
|
||||
<option v-for="dataset of datasets" :key="dataset.id" :value="dataset.id">
|
||||
{{ dataset.hid }}: {{ dataset.name }}</option
|
||||
>
|
||||
</select2>
|
||||
<div class="upload-rule-option-title">
|
||||
History dataset
|
||||
</div>
|
||||
<div>
|
||||
<b-link @click="onSelectDataset" v-if="selectedDatasetName == null">
|
||||
{{ l("Select") }}
|
||||
</b-link>
|
||||
<span v-else>
|
||||
{{ selectedDatasetName }} <font-awesome-icon icon="edit" @click="onSelectDataset" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
@@ -82,10 +80,15 @@ import UploadUtils from "mvc/upload/upload-utils";
|
||||
import axios from "axios";
|
||||
import { getAppRoot } from "onload/loadConfig";
|
||||
import { filesDialog } from "utils/data";
|
||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||
import { faEdit } from "@fortawesome/free-solid-svg-icons";
|
||||
library.add(faEdit);
|
||||
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
export default {
|
||||
components: { FontAwesomeIcon },
|
||||
mixins: [UploadBoxMixin],
|
||||
data() {
|
||||
return {
|
||||
@@ -93,12 +96,12 @@ export default {
|
||||
datasets: [],
|
||||
ftpFiles: [],
|
||||
uris: [],
|
||||
datasetsSet: false,
|
||||
topInfo: _l("Tabular source data to extract collection files and metadata from"),
|
||||
enableReset: false,
|
||||
enableBuild: false,
|
||||
dataType: "datasets",
|
||||
selectedDatasetId: null,
|
||||
selectedDatasetName: null,
|
||||
sourceContent: "",
|
||||
selectionType: "paste",
|
||||
btnBuildTitle: _l("Build"),
|
||||
@@ -113,17 +116,7 @@ export default {
|
||||
watch: {
|
||||
selectionType: function (selectionType) {
|
||||
if (selectionType == "dataset" && !this.datasetsSet) {
|
||||
const Galaxy = getGalaxyInstance();
|
||||
const history = Galaxy && Galaxy.currHistoryPanel && Galaxy.currHistoryPanel.model;
|
||||
const historyContentModels = history.contents.models;
|
||||
for (const historyContentModel of historyContentModels) {
|
||||
const attr = historyContentModel.attributes;
|
||||
if (attr.history_content_type !== "dataset") {
|
||||
continue;
|
||||
}
|
||||
this.datasets.push(attr);
|
||||
}
|
||||
this.datasetsSet = true;
|
||||
this.onSelectDataset();
|
||||
} else if (selectionType == "ftp") {
|
||||
UploadUtils.getRemoteFiles((ftp_files) => {
|
||||
this.sourceContent = ftp_files.map((file) => file["path"]).join("\n");
|
||||
@@ -170,6 +163,22 @@ export default {
|
||||
this._buildSelection(this.sourceContent);
|
||||
},
|
||||
|
||||
onSelectDataset: function () {
|
||||
const galaxy = getGalaxyInstance();
|
||||
galaxy.data.dialog(
|
||||
(response) => {
|
||||
this.selectedDatasetId = response.id;
|
||||
this.selectedDatasetName = response.name;
|
||||
},
|
||||
{
|
||||
multiple: false,
|
||||
library: false,
|
||||
format: null,
|
||||
allowUpload: false,
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
_buildSelection: function (content) {
|
||||
const selectionType = this.selectionType;
|
||||
const selection = {};
|
||||
|
||||
@@ -648,10 +648,10 @@ class NavigatesGalaxy(HasDriver):
|
||||
input_type_element = upload.rule_select_input_type.wait_for_visible()
|
||||
self.select2_set_value(input_type_element, input_description)
|
||||
|
||||
def upload_rule_set_dataset(self, dataset_description="1:"):
|
||||
def upload_rule_set_dataset(self, row=1):
|
||||
upload = self.components.upload
|
||||
rule_dataset_element = upload.rule_dataset_selector.wait_for_visible()
|
||||
self.select2_set_value(rule_dataset_element, dataset_description)
|
||||
upload.rule_dataset_selector.wait_for_visible()
|
||||
upload.rule_dataset_selector_row(rowindex=row).wait_for_and_click()
|
||||
|
||||
def rule_builder_set_collection_name(self, name):
|
||||
rule_builder = self.components.rule_builder
|
||||
|
||||
@@ -548,7 +548,10 @@ upload:
|
||||
rule_source_content: 'textarea.upload-rule-source-content'
|
||||
rule_select_data_type: '.rule-data-type'
|
||||
rule_select_input_type: '.rule-select-type'
|
||||
rule_dataset_selector: '.upload-rule-option .dataset-selector'
|
||||
rule_dataset_selector:
|
||||
selector: '.selection-dialog-modal'
|
||||
rule_dataset_selector_row:
|
||||
selector: '.selection-dialog-modal [aria-rowindex="${rowindex}"]'
|
||||
|
||||
rule_builder:
|
||||
selectors:
|
||||
|
||||
@@ -154,7 +154,7 @@ PRJDA60709 SAMD00016382 DRX000480 ftp.sra.ebi.ac.uk/vol1/fastq/DRR000/DRR0
|
||||
self.upload_rule_start()
|
||||
self.upload_rule_set_data_type("Collection")
|
||||
self.upload_rule_set_input_type("History Dataset")
|
||||
self.upload_rule_set_dataset("1:")
|
||||
self.upload_rule_set_dataset(1)
|
||||
self.screenshot("rules_example_2_1_inputs")
|
||||
self.upload_rule_build()
|
||||
rule_builder = self.components.rule_builder
|
||||
@@ -179,7 +179,7 @@ PRJDA60709 SAMD00016382 DRX000480 ftp.sra.ebi.ac.uk/vol1/fastq/DRR000/DRR0
|
||||
self.upload_rule_start()
|
||||
self.upload_rule_set_data_type("Collection")
|
||||
self.upload_rule_set_input_type("History Dataset")
|
||||
self.upload_rule_set_dataset("1:")
|
||||
self.upload_rule_set_dataset(1)
|
||||
self.screenshot("rules_example_3_1_inputs")
|
||||
self.upload_rule_build()
|
||||
rule_builder = self.components.rule_builder
|
||||
@@ -273,7 +273,7 @@ PRJDA60709 SAMD00016382 DRX000480 ftp.sra.ebi.ac.uk/vol1/fastq/DRR000/DRR0
|
||||
self.upload_rule_start()
|
||||
self.upload_rule_set_data_type("Collection")
|
||||
self.upload_rule_set_input_type("History Dataset")
|
||||
self.upload_rule_set_dataset("1:")
|
||||
self.upload_rule_set_dataset(1)
|
||||
self.screenshot("rules_example_6_1_paste")
|
||||
self.upload_rule_build()
|
||||
|
||||
@@ -316,7 +316,7 @@ PRJDA60709 SAMD00016382 DRX000480 ftp.sra.ebi.ac.uk/vol1/fastq/DRR000/DRR0
|
||||
self.upload_rule_start()
|
||||
self.upload_rule_set_data_type("Collection")
|
||||
self.upload_rule_set_input_type("History Dataset")
|
||||
self.upload_rule_set_dataset("1:")
|
||||
self.upload_rule_set_dataset(1)
|
||||
|
||||
# @selenium_test
|
||||
# def test_rules_example_5_matching_collections(self):
|
||||
|
||||
Reference in New Issue
Block a user