Changed GenomeSpace token handling to use manual OpenID association only

This commit is contained in:
Nuwan Goonasekera
2018-03-01 15:03:12 -05:00
committed by Martin Cech
parent 2d132a45d9
commit 6b782ad16d
5 changed files with 41 additions and 61 deletions
@@ -25,16 +25,10 @@ var View = Backbone.View.extend({
// 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);
this.$(".ui-gs-browse-button").append(this.browse_button.$el);
this.$(".ui-gs-filename-textbox").append(this.filename_textbox.$el);
},
/** Browse GenomeSpace */
@@ -42,27 +36,25 @@ var View = Backbone.View.extend({
var self = this;
GenomespaceBrowser.openFileBrowser({
successCallback: function(data) {
self.value(data.destination + "^" + data.token);
self.value(`${data.destination}`);
}
});
},
/** 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 (
'<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>"
);
},
/** Return/Set currently selected genomespace filename/token */
value : function (new_value) {
/** Return/Set currently selected genomespace filename */
value: function(new_value) {
// check if new_value is defined
if (new_value !== undefined) {
this._setValue(new_value);
@@ -71,22 +63,19 @@ var View = Backbone.View.extend({
return this._getValue();
}
},
// get value
_getValue: function() {
return this.filename_textbox.value() +
"^" + this.token_textbox.value();
return `${this.filename_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]);
this.filename_textbox.value(new_value);
}
},
});
return {
+3 -13
View File
@@ -884,10 +884,6 @@
float: right;
width: ~'calc(100% - 76px)';
}
.ui-gs-token-textbox {
float: right;
width: ~'calc(100% - 76px)';
}
.ui-gs-browse-button {
float: left;
.ui-button-icon {
@@ -895,15 +891,9 @@
margin-right: 5px;
}
}
.ui-gs-token-label {
margin-top: 5px;
margin-left: 32px;
margin-right: 5px;
float: left;
}
.ui-gs-token-field {
clear: both;
padding-top: 5px;
.ui-gs-browse-field {
height: @input-height-base;
line-height: @line-height-base;
}
}
+5 -7
View File
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<tool name="GenomeSpace Exporter" id="genomespace_exporter" version="0.0.5">
<tool name="GenomeSpace Exporter" id="genomespace_exporter" require_login="True" version="0.0.6">
<description> - send data to GenomeSpace</description>
<environment_variables>
<environment_variable name="GS_TOKEN">
#set $token = $genomespace_browser.split('^')[1] or $__user__.preferences.get('genomespace_token', None)
#assert $token, Exception('Invalid token. You must be logged into GenomeSpace through OpenID or select a valid folder via the GenomeSpace browse dialog.')
#set $token = $__user__.preferences.get('genomespace_token', None)
#assert $token, Exception('Invalid token. You must be logged into GenomeSpace through OpenID.')
$token
</environment_variable>
</environment_variables>
@@ -31,11 +31,9 @@
<data format="auto" name="output_log" />
</outputs>
<help>
This Tool allows you to export data to GenomeSpace. Click the Browse button to select a file to export. The tool will automatically
fetch your GenomeSpace token when you select a file from the export dialog.
This Tool allows you to export data to GenomeSpace. Click the Browse button to select a file to export.
Alternatively, you can be logged in using your GenomeSpace OpenID, and the tool will use this ID if no token is entered.
This allows you to simply paste the filepath into the location box and leave the token empty.
To use this tool, you must have logged in using your GenomeSpace OpenID.
You can associate your OpenID credentials under the User Preferences panel.
Click here_ to refresh your GenomeSpace token.
+10 -7
View File
@@ -1,13 +1,18 @@
<?xml version="1.0"?>
<tool name="GenomeSpace Importer" id="genomespace_importer" require_login="False" version="0.0.5">
<tool name="GenomeSpace Importer" id="genomespace_importer" require_login="True" version="0.0.6">
<description> - receive data from GenomeSpace</description>
<environment_variables>
<environment_variable name="GS_TOKEN">
#set $token = $__user__.preferences.get('genomespace_token', None)
#assert $token, Exception('Invalid token. You must be logged into GenomeSpace through OpenID.')
$token
</environment_variable>
</environment_variables>
<command><![CDATA[
python $__tool_directory__/genomespace_importer.py
#set $input_file = $URL.split('^')[0] if '^' in $URL else $URL
#set $token = $URL.split('^')[1] if '^' in $URL and $URL.split('^')[1] else $__user__.preferences.get('genomespace_token', None)
#assert $input_file, Exception('You must select a valid input file.')
#assert $token, Exception('Invalid token. You must be logged into GenomeSpace through OpenID.')
--json_parameter_file '${output_file1}'
--galaxy_root $__root_dir__
--data_conf $__datatypes_config__
@@ -21,11 +26,9 @@
<data format="auto" name="output_file1" />
</outputs>
<help>
This tool allows you to import data from GenomeSpace. Click the Browse button to select a file to import. The tool will automatically
fetch your GenomeSpace token when you select a file from the import dialog.
This tool allows you to import data from GenomeSpace. Click the Browse button to select a file to import.
Alternatively, you can be logged in using your GenomeSpace OpenID, and the tool will use this ID if no token is entered.
This allows you to simply paste the filepath into the location box and leave the token empty.
To use this tool, you must have logged in using your GenomeSpace OpenID.
You can associate your OpenID credentials under the User Preferences panel.
Click here_ to refresh your GenomeSpace token.
+3 -3
View File
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<tool name="GenomeSpace Push" id="genomespace_push" tool_type="data_source" force_history_refresh="True" hidden="True" display_interface="False" require_login="True" version="0.0.1">
<tool name="GenomeSpace Push" id="genomespace_push" tool_type="data_source" force_history_refresh="True" hidden="True" display_interface="False" require_login="True" version="0.0.6">
<description> - Push data from GenomeSpace to Galaxy</description>
<environment_variables>
<environment_variable name="GS_TOKEN">
#set $token = $__user__.preferences.get( 'genomespace_token', None )
#assert $token, Exception('Invalid token. You must be logged into GenomeSpace through OpenID or select a valid file via the GenomeSpace browse dialog.' )
#set $token = $__user__.preferences.get('genomespace_token', None)
#assert $token, Exception('Invalid token. You must be logged into GenomeSpace through OpenID.')
$token
</environment_variable>
</environment_variables>