-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infrastructure for writing to pluggable Galaxy file sources. #10152
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1c766ed
jmchilton dyslexia fix: schema -> scheme
jmchilton 1dc2ad8
Typo fix.
jmchilton 9fb3a49
Add infrastructure for writing to pluggable galaxy file sources.
jmchilton 4647549
Tests and error checking to harden galaxy.files posix backend for wri…
jmchilton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import Backbone from "backbone"; | ||
import { filesDialog } from "utils/data"; | ||
import _l from "utils/localization"; | ||
import Ui from "mvc/ui/ui-misc"; | ||
|
||
var View = Backbone.View.extend({ | ||
initialize: function (options) { | ||
this.model = new Backbone.Model(); | ||
this.target = options.target; | ||
const props = { | ||
mode: "directory", | ||
requireWritable: true, | ||
}; | ||
// create insert edit button | ||
this.browse_button = new Ui.Button({ | ||
title: _l("Select"), | ||
icon: "fa fa-edit", | ||
tooltip: _l("Select URI"), | ||
onclick: () => { | ||
filesDialog((uri) => { | ||
this._handleRemoteFilesUri(uri); | ||
}, props); | ||
}, | ||
}); | ||
|
||
// add change event. fires on trigger | ||
this.on("change", () => { | ||
if (options.onchange) { | ||
options.onchange(this.value()); | ||
} | ||
}); | ||
|
||
// create elements | ||
this.setElement(this._template(options)); | ||
this.$text = this.$(".ui-uri-preview"); | ||
this.$(".ui-file-select-button").append(this.browse_button.$el); | ||
this.listenTo(this.model, "change", this.render, this); | ||
this.render(); | ||
}, | ||
|
||
_handleRemoteFilesUri: function (uri) { | ||
this._setValue(uri); | ||
}, | ||
|
||
render: function () { | ||
const value = this._value; | ||
if (value) { | ||
if (value.url !== this.$text.text()) { | ||
this.$text.text(value.url); | ||
} | ||
} else { | ||
this.$text.text("select..."); | ||
} | ||
}, | ||
|
||
/** Main Template */ | ||
_template: function (options) { | ||
return ` | ||
<div class="ui-rules-edit clearfix"> | ||
<span class="ui-uri-preview" /> | ||
<span class="ui-file-select-button float-left" /> | ||
</div> | ||
`; | ||
}, | ||
|
||
/** Return/Set current value */ | ||
value: function (new_value) { | ||
if (new_value !== undefined) { | ||
this._setValue(new_value); | ||
} else { | ||
return this._getValue(); | ||
} | ||
}, | ||
|
||
/** Update input element options */ | ||
update: function (input_def) { | ||
this.target = input_def.target; | ||
}, | ||
|
||
/** Returns current value */ | ||
_getValue: function () { | ||
return this._value.url; | ||
}, | ||
|
||
/** Sets current value */ | ||
_setValue: function (new_value) { | ||
if (new_value) { | ||
if (typeof new_value == "string") { | ||
new_value = JSON.parse(new_value); | ||
} | ||
this._value = new_value; | ||
this.model.trigger("error", null); | ||
this.model.trigger("change"); | ||
} | ||
}, | ||
}); | ||
|
||
export default { | ||
View: View, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh this is super cool! However, currently, our standard FTP server is usually not configured to allow downloads. We would need a second server with a different directory that only allows downloads and no uploads - is that correct @natefoo? If so, is it time to introduce
ftp_download_*
options?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think that would be a very natural place to start dumping large files (history exports, collection zips, etc.), so I think swapping the default here to
True
makes sense. It can be overridden explicitly with the config file but it probably makes sense to have galaxy.yml options also.I guess for options we should make
ftp_upload_dir
an alias forftp_dir
anduser_library_dir
an alias foruser_library_import_dir
and then addftp_dir_writable
(default True) anduser_library_dir_writable
(default False)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes for sure. This is IMHO the easiest to set up globally and has the biggest impact.
But then I learned I can not download those datasets from the standard FTP directories :)
I'm not sure if this is enough. Would like to have @natefoo opinion here. Is it still recommended to make the upload-ftp upload-only? I don't think having two FTP servers running is a big deal. But maybe all of that is not necessary anymore?
Another aspect is that two different directories for up- and download might make also sense from the admin point of view.
We have cron jobs running cleaning old unused FTP uploads ... we probably want to handle "archives" (downloads) differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to get @natefoo's insights also. But I will just say none of this prevents you from configuring two FTP directories - the whole thing is configurable now. I just think that is an advanced configuration and shouldn't be the default assumed.
If we're going to make a push toward documenting more advanced configurations - I don't think we should take user library import dir, ftp dir, and add a new fixed named thing like ftp download dir. We should instead work toward just documenting how to configure any of these things you want in a galaxy files configuration - including other directories with other options, etc..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, you convinced me. If we can easily use a second FTP this is not a problem at all. But the default configuration should be secure imho.
Thanks for this PR!