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
Galaxy Workflow support for GenomeSpace #1814
Changes from all commits
1342c2b
e39901e
ad1b613
b04ccbe
cb1b086
46c04dc
678d575
ae6ae8f
517fd23
b73e21b
b995e55
46dc4a2
3e8bf3c
52b26f4
3240197
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Provides support for interacting with the GenomeSpace File Browser popup dialogue | ||
define([], function() { | ||
|
||
// tool form templates | ||
return { | ||
openFileBrowser: function( options ) { | ||
var GS_UI_URL = window.Galaxy.config.genomespace_ui_url; | ||
var GS_UPLOAD_URL = GS_UI_URL + 'upload/loadUrlToGenomespace.html?getLocation=true' | ||
|
||
var newWin = window.open(GS_UPLOAD_URL, "GenomeSpace File Browser", "height=360px,width=600px"); | ||
|
||
successCalBack = options['successCallback']; | ||
window.addEventListener( "message", function (e) { | ||
successCalBack(e.data); | ||
}, false); | ||
|
||
newWin.focus(); | ||
|
||
if (options['errorCallback'] != null) newWin.setCallbackOnGSUploadError = config['errorCallback']; | ||
} | ||
|
||
}; | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// dependencies | ||
define(['utils/utils', 'mvc/ui/ui-misc', 'mvc/tool/tool-genomespace'], | ||
function(Utils, Ui, GenomespaceBrowser) { | ||
|
||
/** | ||
* GenomeSpace file selector | ||
*/ | ||
var View = Backbone.View.extend({ | ||
// initialize | ||
initialize : function(options) { | ||
|
||
// link this | ||
var self = this; | ||
|
||
// create insert new list element button | ||
this.browse_button = new Ui.ButtonIcon({ | ||
title : 'Browse', | ||
icon : 'fa fa-sign-in', | ||
tooltip : 'Browse GenomeSpace', | ||
onclick : function() { | ||
self.browseGenomeSpace(); | ||
} | ||
}); | ||
|
||
// create genomespace filepath textbox | ||
this.filename_textbox = new Ui.Input(); | ||
|
||
// create genomespace token textbox | ||
this.token_textbox = new Ui.Input({ | ||
type : 'password' | ||
}); | ||
|
||
// create elements | ||
this.setElement(this._template(options)); | ||
this.$('.ui-gs-browse-button').append(this.browse_button.$el); | ||
this.$('.ui-gs-filename-textbox').append(this.filename_textbox.$el); | ||
this.$('.ui-gs-token-textbox').append(this.token_textbox.$el); | ||
}, | ||
|
||
/** Browse GenomeSpace */ | ||
browseGenomeSpace: function(options) { | ||
var self = this; | ||
GenomespaceBrowser.openFileBrowser({ | ||
successCallback: function(data) { | ||
self.value(data.destination + "^" + data.token); | ||
} | ||
}); | ||
}, | ||
|
||
/** Main Template */ | ||
_template: function(options) { | ||
return '<div class="ui-gs-select-file">' + | ||
'<div class="ui-gs-browse-field">' + | ||
'<span class="ui-gs-browse-button" />' + | ||
'<span class="ui-gs-filename-textbox" />' + | ||
'</div>' + | ||
'<div class="ui-gs-token-field">' + | ||
'<span class=ui-gs-label"><div class="ui-gs-token-label">Token</div></span>' + | ||
'<span class="ui-gs-token-textbox" />' + | ||
'</div>' + | ||
'</div>'; | ||
}, | ||
|
||
/** Return/Set currently selected genomespace filename/token */ | ||
value : function (new_value) { | ||
// check if new_value is defined | ||
if (new_value !== undefined) { | ||
this._setValue(new_value); | ||
} | ||
else { | ||
return this._getValue(); | ||
} | ||
}, | ||
|
||
// get value | ||
_getValue: function() { | ||
return this.filename_textbox.value() + | ||
"^" + this.token_textbox.value(); | ||
}, | ||
|
||
// set value | ||
_setValue: function(new_value) { | ||
if (new_value) { | ||
values = new_value.split("^"); | ||
this.filename_textbox.value(values[0]); | ||
this.token_textbox.value(values[1]); | ||
} | ||
}, | ||
|
||
}); | ||
|
||
return { | ||
View: View | ||
} | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,27 @@ def get_html(self, prefix=""): | |
return unicodify('<input type="file" name="%s%s"%s%s>' % (prefix, self.name, ajax_text, value_text)) | ||
|
||
|
||
class GenomespaceFileField(BaseField): | ||
""" | ||
A genomspace file browser field. | ||
""" | ||
def __init__(self, name, value=None): | ||
self.name = name | ||
self.value = value or "" | ||
|
||
def get_html(self, prefix=""): | ||
return unicodify('<script src="https://gsui.genomespace.org/jsui/upload/gsuploadwindow.js"></script>' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we originally started working on this, the tool parameters were still being rendered on the server side. Since it's now being rendered on the client-side, we've added a backbone component for it, but also left this bit as is since workflows don't fully support client-side rendering yet. Once that conversion is done, I hope that this bit can be nuked, preferably from orbit :-) |
||
'<input type="text" name="{0}{1}" value="{2}"> ' | ||
'<a href="javascript:gsLocationByGet({{ successCallback: function(config)' | ||
' {{ selector_name = \'{0}{1}\'; selector = \'input[name=\' + selector_name.replace(\'|\', \'\\\\|\') + \']\';' | ||
' $(selector).val(config.destination + \'^\' + config.token); }} }});">' | ||
'Browse</a>'.format(prefix, self.name, escape(str(self.value), quote=True))) | ||
|
||
def to_dict(self): | ||
return dict(name=self.name, | ||
token_field=self.token_field) | ||
|
||
|
||
class HiddenField(BaseField): | ||
""" | ||
A hidden field. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Not sure whether this folder is the best location for this support module.