mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge remote-tracking branch 'upstream/release_18.05' into dev
This commit is contained in:
@@ -285,7 +285,7 @@
|
||||
</button>
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<rule-target-component :builder="this" rule-type="add_column_basename" />
|
||||
<rule-target-component :builder="this" rule-type="add_column_metadata" v-if="elementsType == 'collection_contents'"/>
|
||||
<rule-target-component :builder="this" rule-type="add_column_metadata" v-if="metadataOptions"/>
|
||||
<rule-target-component :builder="this" rule-type="add_column_regex" />
|
||||
<rule-target-component :builder="this" rule-type="add_column_concatenate" />
|
||||
<rule-target-component :builder="this" rule-type="add_column_rownum" />
|
||||
@@ -364,8 +364,11 @@
|
||||
</rule-modal-footer>
|
||||
</state-div>
|
||||
<state-div v-else-if="state == 'wait'">
|
||||
<rule-modal-header>
|
||||
{{ l("Galaxy is waiting for collection creation, this dialog will close when this is complete.") }}
|
||||
<rule-modal-header v-if="importType == 'datasets'">
|
||||
{{ l("Datasets submitted to Galaxy for creation, this dialog will close when dataset creation is complete. You may close this dialog at any time, but you will not be informed of errors with dataset creation and you may have to refresh your history manually to view new datasets once complete.") }}
|
||||
</rule-modal-header>
|
||||
<rule-modal-header v-else-if="importType == 'collections'">
|
||||
{{ l("Galaxy is waiting for collection creation, this dialog will close when this is complete. You may close this dialog at any time, but you will not be informed of errors with collection creation and you may have to refresh your history manually to view new collections once complete.") }}
|
||||
</rule-modal-header>
|
||||
<rule-modal-footer>
|
||||
<b-button @click="cancel" class="creator-cancel-btn" tabindex="-1">
|
||||
@@ -830,6 +833,27 @@ export default {
|
||||
value: "identifier0"
|
||||
});
|
||||
}
|
||||
} else if (this.elementsType == "datasets") {
|
||||
rules.push(
|
||||
{
|
||||
type: "add_column_metadata",
|
||||
value: "hid"
|
||||
},
|
||||
{
|
||||
type: "add_column_metadata",
|
||||
value: "name"
|
||||
}
|
||||
);
|
||||
} else if (this.elementsType == "library_datasets") {
|
||||
rules.push({
|
||||
type: "add_column_metadata",
|
||||
value: "name"
|
||||
});
|
||||
} else if (this.elementsType == "ftp") {
|
||||
rules.push({
|
||||
type: "add_column_metadata",
|
||||
value: "path"
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
@@ -1058,14 +1082,14 @@ export default {
|
||||
},
|
||||
hotData() {
|
||||
let data, sources, columns;
|
||||
if (this.elementsType == "datasets") {
|
||||
data = this.initialElements.map(el => [el["hid"], el["name"]]);
|
||||
if (
|
||||
this.elementsType == "datasets" ||
|
||||
this.elementsType == "library_datasets" ||
|
||||
this.elementsType == "ftp"
|
||||
) {
|
||||
data = this.initialElements.map(el => []);
|
||||
sources = this.initialElements.slice();
|
||||
columns = ["new", "new"];
|
||||
} else if (this.elementsType == "library_datasets") {
|
||||
data = this.initialElements.map(el => [el["name"]]);
|
||||
sources = this.initialElements.slice();
|
||||
columns = ["new"];
|
||||
columns = [];
|
||||
} else if (this.elementsType == "collection_contents") {
|
||||
const collection = this.initialElements;
|
||||
if (collection) {
|
||||
@@ -1131,7 +1155,7 @@ export default {
|
||||
return asDict;
|
||||
},
|
||||
metadataOptions() {
|
||||
const metadataOptions = {};
|
||||
let metadataOptions = {};
|
||||
if (this.elementsType == "collection_contents") {
|
||||
let collectionType;
|
||||
if (this.initialElements) {
|
||||
@@ -1150,6 +1174,15 @@ export default {
|
||||
metadataOptions["identifier" + index] = _l("Paired Identifier");
|
||||
}
|
||||
}
|
||||
} else if ( this.elementsType == "ftp" ) {
|
||||
metadataOptions["path"] = _l("Path");
|
||||
} else if ( this.elementsType == "library_datasets" ) {
|
||||
metadataOptions["name"] = _l("Name");
|
||||
} else if ( this.elementsType == "datasets" ) {
|
||||
metadataOptions["hid"] = _l("History ID (hid)");
|
||||
metadataOptions["name"] = _l("Name");
|
||||
} else {
|
||||
metadataOptions = null;
|
||||
}
|
||||
return metadataOptions;
|
||||
},
|
||||
@@ -1171,10 +1204,12 @@ export default {
|
||||
validInput() {
|
||||
const identifierColumns = this.identifierColumns();
|
||||
const mappingAsDict = this.mappingAsDict;
|
||||
const buildingCollection = identifierColumns.length > 0 && this.elementsType != "collection_contents";
|
||||
const buildingCollection = this.importType == "collections";
|
||||
const requiresName =
|
||||
buildingCollection && this.elementsType != "collection_contents" && !mappingAsDict.collection_name;
|
||||
|
||||
let valid = true;
|
||||
if (buildingCollection && !mappingAsDict.collection_name) {
|
||||
if (requiresName) {
|
||||
valid = this.collectionName.length > 0;
|
||||
}
|
||||
|
||||
@@ -1183,16 +1218,17 @@ export default {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
const requiresSourceColumn = this.elementsType == "ftp" || this.elementsType == "raw";
|
||||
if (requiresSourceColumn && !mappingAsDict.ftp_path && !mappingAsDict.url) {
|
||||
valid = false;
|
||||
}
|
||||
for (var rule of this.rules) {
|
||||
if (rule.error) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// raw tabular variant can build stand-alone datasets without identifier
|
||||
// columns for the collection builder for existing datasets cannot do this.
|
||||
const fromDatasets = this.elementsType == "datasets" || this.elementsType == "library_datasets";
|
||||
if (fromDatasets && identifierColumns.length == 0) {
|
||||
if (buildingCollection && identifierColumns.length == 0) {
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
|
||||
@@ -1138,6 +1138,10 @@ function createCollectionViaRules(selection, defaultHideSourceItems) {
|
||||
elements = selection.toJSON();
|
||||
elementsType = "datasets";
|
||||
importType = "collections";
|
||||
} else if (selection.elements) {
|
||||
elementsType = selection.selectionType;
|
||||
importType = selection.dataType || "collections";
|
||||
elements = selection.elements;
|
||||
} else {
|
||||
const hasNonWhitespaceChars = RegExp(/[^\s]/);
|
||||
// Have pasted data, data from a history dataset, or FTP list.
|
||||
|
||||
@@ -166,11 +166,22 @@ const RULES = {
|
||||
},
|
||||
apply: (rule, data, sources, columns) => {
|
||||
const ruleValue = rule.value;
|
||||
const identifierIndex = parseInt(ruleValue.substring("identifier".length));
|
||||
function newRow(row, index) {
|
||||
const newRow = row.slice();
|
||||
newRow.push(sources[index]["identifiers"][identifierIndex]);
|
||||
return newRow;
|
||||
let newRow;
|
||||
if (ruleValue.startsWith("identifier")) {
|
||||
const identifierIndex = parseInt(ruleValue.substring("identifier".length));
|
||||
newRow = (row, index) => {
|
||||
const newRow = row.slice();
|
||||
newRow.push(sources[index]["identifiers"][identifierIndex]);
|
||||
return newRow;
|
||||
};
|
||||
} else if (ruleValue == "hid" || ruleValue == "name" || ruleValue == "path") {
|
||||
newRow = (row, index) => {
|
||||
const newRow = row.slice();
|
||||
newRow.push(sources[index][ruleValue]);
|
||||
return newRow;
|
||||
};
|
||||
} else {
|
||||
return { error: `Unknown metadata type [${ruleValue}}]` };
|
||||
}
|
||||
data = data.map(newRow);
|
||||
columns.push(NEW_COLUMN);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// dependencies
|
||||
import * as Backbone from "backbone";
|
||||
import * as _ from "underscore";
|
||||
import Utils from "utils/utils";
|
||||
/**
|
||||
* A plugin for initializing select2 input items.
|
||||
@@ -15,6 +16,7 @@ var View = Backbone.View.extend({
|
||||
value: null,
|
||||
multiple: false,
|
||||
minimumInputLength: 0,
|
||||
maximumTextLength: 100,
|
||||
// example format of initial data: "id:name,55:anotherrole@role.com,27:role@role.com"
|
||||
initialData: ""
|
||||
},
|
||||
@@ -146,10 +148,22 @@ var View = Backbone.View.extend({
|
||||
|
||||
// refresh
|
||||
_refresh: function() {
|
||||
let select_opt;
|
||||
// add select2 data based on type of input
|
||||
if (!this.options.multiple) {
|
||||
if (this.select_data) {
|
||||
this.select_data.map(value => {
|
||||
let mx = this.options.maximumTextLength + 3;
|
||||
if (value.text && value.text.length > mx) {
|
||||
let pos = value.text.indexOf(`(${value.id})`);
|
||||
pos = pos != -1 && pos < mx ? pos : mx;
|
||||
let sub = value.text.substring(0, pos).replace(/[\ \.]*$/, "");
|
||||
value.text = `${sub}...(${value.id})`;
|
||||
}
|
||||
});
|
||||
}
|
||||
var selected = this._getValue();
|
||||
var select_opt = {
|
||||
select_opt = {
|
||||
data: this.select_data,
|
||||
containerCssClass: this.options.css,
|
||||
placeholder: this.options.placeholder,
|
||||
@@ -159,7 +173,7 @@ var View = Backbone.View.extend({
|
||||
// select previous value (if exists)
|
||||
this._setValue(selected);
|
||||
} else {
|
||||
var select_opt = {
|
||||
select_opt = {
|
||||
multiple: this.options.multiple,
|
||||
containerCssClass: this.options.css,
|
||||
placeholder: this.options.placeholder,
|
||||
|
||||
@@ -8,6 +8,7 @@ export default Backbone.View.extend({
|
||||
initialize: function(app) {
|
||||
this.app = app;
|
||||
this.options = app.options;
|
||||
this.ftpFiles = [];
|
||||
this.ftpUploadSite = app.currentFtp();
|
||||
this.setElement(this._template());
|
||||
this.btnBuild = new Ui.Button({
|
||||
@@ -100,6 +101,7 @@ export default Backbone.View.extend({
|
||||
} else if (selectionType == "ftp") {
|
||||
UploadUtils.getRemoteFiles(ftp_files => {
|
||||
this._setPreview(ftp_files.map(file => file["path"]).join("\n"));
|
||||
this.ftpFiles = ftp_files;
|
||||
});
|
||||
}
|
||||
this._updateScreen();
|
||||
@@ -137,13 +139,15 @@ export default Backbone.View.extend({
|
||||
|
||||
_buildSelection: function(content) {
|
||||
const selectionType = this.selectionType;
|
||||
const selection = { content: content };
|
||||
const selection = {};
|
||||
if (selectionType == "dataset" || selectionType == "paste") {
|
||||
selection.selectionType = "raw";
|
||||
selection.content = content;
|
||||
} else if (selectionType == "ftp") {
|
||||
selection.selectionType = "ftp";
|
||||
selection.elements = this.ftpFiles;
|
||||
selection.ftpUploadSite = this.ftpUploadSite;
|
||||
}
|
||||
selection.ftpUploadSite = this.ftpUploadSite;
|
||||
selection.dataType = this.dataType;
|
||||
Galaxy.currHistoryPanel.buildCollection("rules", selection, true);
|
||||
this.app.modal.hide();
|
||||
|
||||
Reference in New Issue
Block a user