diff --git a/client/galaxy/scripts/components/FilesDialog/FilesDialog.vue b/client/galaxy/scripts/components/FilesDialog/FilesDialog.vue index 677412b7245b..642eb3f32816 100644 --- a/client/galaxy/scripts/components/FilesDialog/FilesDialog.vue +++ b/client/galaxy/scripts/components/FilesDialog/FilesDialog.vue @@ -16,7 +16,9 @@ :filter="filter" :showDetails="showDetails" :showTime="showTime" + :showNavigate="mode == 'directory'" @clicked="clicked" + @open="open" @load="load" /> @@ -53,6 +55,11 @@ export default { type: Boolean, default: false, }, + mode: { + type: String, + default: "file", + validator: (prop) => ["file", "directory"].includes(prop), + }, }, data() { return { @@ -73,12 +80,17 @@ export default { this.model = new Model({ multiple: this.multiple }); this.load(); }, + computed: { + fileMode() { + return this.mode == "file"; + }, + }, methods: { /** Add highlighting for record variations, i.e. datasets vs. libraries/collections **/ formatRows() { for (const item of this.items) { let _rowVariant = "active"; - if (item.isLeaf) { + if (item.isLeaf || !this.fileMode) { _rowVariant = this.model.exists(item.id) ? "success" : "default"; } Vue.set(item, "_rowVariant", _rowVariant); @@ -86,7 +98,7 @@ export default { }, /** Collects selected datasets in value array **/ clicked: function (record) { - if (record.isLeaf) { + if (record.isLeaf || !this.fileMode) { this.model.add(record); this.hasValue = this.model.count() > 0; if (this.multiple) { @@ -95,9 +107,12 @@ export default { this.finalize(); } } else { - this.load(record.url); + this.open(record); } }, + open: function (record) { + this.load(record.url); + }, /** Called when selection is complete, values are formatted and parsed to external callback **/ finalize: function () { const results = this.model.finalize(); @@ -136,18 +151,35 @@ export default { this.services .list(url) .then((items) => { - this.items = items.map((item) => { - const itemClass = item.class; - return { - id: item.uri, - label: item.name, - time: item.ctime, - isLeaf: itemClass == "File", - size: item.size, - url: item.uri, - labelTitle: item.uri, - }; - }); + if (this.fileMode) { + items = items.map((item) => { + const itemClass = item.class; + return { + id: item.uri, + label: item.name, + time: item.ctime, + isLeaf: itemClass == "File", + size: item.size, + url: item.uri, + labelTitle: item.uri, + }; + }); + } else { + items = items + .filter((item) => item.class == "Directory") + .map((item) => { + return { + id: item.uri, + label: item.name, + time: item.ctime, + isLeaf: false, + size: item.size, + url: item.uri, + labelTitle: item.uri, + }; + }); + } + this.items = items; this.formatRows(); this.optionsShow = true; this.showTime = true; diff --git a/client/galaxy/scripts/components/FilesDialog/model.js b/client/galaxy/scripts/components/FilesDialog/model.js index a04329d4efe6..4f4f1ff3ee09 100644 --- a/client/galaxy/scripts/components/FilesDialog/model.js +++ b/client/galaxy/scripts/components/FilesDialog/model.js @@ -38,8 +38,7 @@ export class Model { finalize() { let results = []; Object.values(this.values).forEach((v) => { - let value = v; - results.push(value); + results.push(v); }); if (results.length > 0 && !this.multiple) { results = results[0]; diff --git a/client/galaxy/scripts/components/RuleCollectionBuilder.vue b/client/galaxy/scripts/components/RuleCollectionBuilder.vue index 6f56e5ccc2f9..fc90ace0352d 100644 --- a/client/galaxy/scripts/components/RuleCollectionBuilder.vue +++ b/client/galaxy/scripts/components/RuleCollectionBuilder.vue @@ -629,6 +629,8 @@ export default { } else { if (this.elementsType == "ftp") { mapping = [{ type: "ftp_path", columns: [0] }]; + } else if (this.elementsType == "remote_files") { + mapping = [{ type: "url", columns: [0] }]; } else if (this.elementsType == "datasets") { mapping = [{ type: "list_identifiers", columns: [1] }]; } else { @@ -674,6 +676,11 @@ export default { type: "add_column_metadata", value: "path", }); + } else if (this.elementsType == "remote_files") { + rules.push({ + type: "add_column_metadata", + value: "uri", + }); } } return { @@ -961,6 +968,9 @@ export default { metadataOptions["tags"] = _l("Tags"); } else if (this.elementsType == "ftp") { metadataOptions["path"] = _l("Path"); + } else if (this.elementsType == "remote_files") { + // IS THIS NEEDED? + metadataOptions["url"] = _l("URL"); } else if (this.elementsType == "library_datasets") { metadataOptions["name"] = _l("Name"); } else if (this.elementsType == "datasets") { @@ -1007,7 +1017,8 @@ export default { valid = false; } - const requiresSourceColumn = this.elementsType == "ftp" || this.elementsType == "raw"; + const requiresSourceColumn = + this.elementsType == "ftp" || this.elementsType == "raw" || this.elementsType == "remote_files"; if (requiresSourceColumn && !mappingAsDict.ftp_path && !mappingAsDict.url) { valid = false; } @@ -1029,7 +1040,8 @@ export default { if ( this.elementsType == "datasets" || this.elementsType == "library_datasets" || - this.elementsType == "ftp" + this.elementsType == "ftp" || + this.elementsType == "remote_files" ) { sources = this.initialElements.slice(); data = sources.map((el) => []); diff --git a/client/galaxy/scripts/components/SelectionDialog/DataDialogTable.vue b/client/galaxy/scripts/components/SelectionDialog/DataDialogTable.vue index b7bad9904bb9..997a17ed4e5e 100644 --- a/client/galaxy/scripts/components/SelectionDialog/DataDialogTable.vue +++ b/client/galaxy/scripts/components/SelectionDialog/DataDialogTable.vue @@ -21,6 +21,9 @@ {{ data.value ? data.value : "-" }} + + +