1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f94fbe948b7a/ Changeset: f94fbe948b7a User: guerler Date: 2014-10-07 17:52:53+00:00 Summary: ToolForm: Add download button, prepare for activation Affected #: 5 files diff -r a3cff55b129fcbf9b8e359ff0f71cb844a7e9277 -r f94fbe948b7a37b386ee8e3f5591ec7e70d94d16 client/galaxy/scripts/mvc/tools/tools-form.js --- a/client/galaxy/scripts/mvc/tools/tools-form.js +++ b/client/galaxy/scripts/mvc/tools/tools-form.js @@ -42,7 +42,8 @@ // load tool model this.model = new Model({ - id : options.id + id : options.id, + job_id : options.job_id }); // creates a tree/json structure from the input form @@ -93,7 +94,7 @@ } // log - console.debug('tools-form::refresh() - Recreated tree structure. Refresh.'); + console.debug('tools-form::refresh() - Recreated data structure. Refresh.'); }, // initialize tool form @@ -131,6 +132,26 @@ } }); + // default operations + var operations = { + button_question: button_question, + button_search: button_search, + button_share: button_share + } + + // add admin operations + if (Galaxy.currUser.get('is_admin')) { + // create download button + operations['button_download'] = new Ui.ButtonIcon({ + icon : 'fa-download', + title : 'Download', + tooltip : 'Download this tool', + onclick : function() { + window.location.href = galaxy_config.root + 'api/tools/' + self.options.id + '/download'; + } + }); + } + // fetch model and render form this.model.fetch({ error: function(response) { @@ -155,6 +176,7 @@ self.portlet = new Portlet.View({ icon : 'fa-wrench', title: '<b>' + self.model.get('name') + '</b> ' + self.model.get('description'), + operations: operations, buttons: { execute: new Ui.ButtonIcon({ icon : 'fa-check', @@ -165,11 +187,6 @@ self.job_handler.submit(); } }) - }, - operations: { - button_question: button_question, - button_search: button_search, - button_share: button_share } }); diff -r a3cff55b129fcbf9b8e359ff0f71cb844a7e9277 -r f94fbe948b7a37b386ee8e3f5591ec7e70d94d16 lib/galaxy/webapps/galaxy/controllers/tool_runner.py --- a/lib/galaxy/webapps/galaxy/controllers/tool_runner.py +++ b/lib/galaxy/webapps/galaxy/controllers/tool_runner.py @@ -264,6 +264,7 @@ toolbox=self.get_toolbox(), tool_version_select_field=tool_version_select_field, tool=tool, + job=job, util=galaxy.util, add_frame=add_frame, tool_id_version_message=tool_id_version_message, diff -r a3cff55b129fcbf9b8e359ff0f71cb844a7e9277 -r f94fbe948b7a37b386ee8e3f5591ec7e70d94d16 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -42,7 +42,8 @@ // load tool model this.model = new Model({ - id : options.id + id : options.id, + job_id : options.job_id }); // creates a tree/json structure from the input form @@ -93,7 +94,7 @@ } // log - console.debug('tools-form::refresh() - Recreated tree structure. Refresh.'); + console.debug('tools-form::refresh() - Recreated data structure. Refresh.'); }, // initialize tool form @@ -131,6 +132,26 @@ } }); + // default operations + var operations = { + button_question: button_question, + button_search: button_search, + button_share: button_share + } + + // add admin operations + if (Galaxy.currUser.get('is_admin')) { + // create download button + operations['button_download'] = new Ui.ButtonIcon({ + icon : 'fa-download', + title : 'Download', + tooltip : 'Download this tool', + onclick : function() { + window.location.href = galaxy_config.root + 'api/tools/' + self.options.id + '/download'; + } + }); + } + // fetch model and render form this.model.fetch({ error: function(response) { @@ -155,6 +176,7 @@ self.portlet = new Portlet.View({ icon : 'fa-wrench', title: '<b>' + self.model.get('name') + '</b> ' + self.model.get('description'), + operations: operations, buttons: { execute: new Ui.ButtonIcon({ icon : 'fa-check', @@ -165,11 +187,6 @@ self.job_handler.submit(); } }) - }, - operations: { - button_question: button_question, - button_search: button_search, - button_share: button_share } }); diff -r a3cff55b129fcbf9b8e359ff0f71cb844a7e9277 -r f94fbe948b7a37b386ee8e3f5591ec7e70d94d16 static/scripts/packed/mvc/tools/tools-form.js --- a/static/scripts/packed/mvc/tools/tools-form.js +++ b/static/scripts/packed/mvc/tools/tools-form.js @@ -1,1 +1,1 @@ -define(["mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-datasets","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(h,l,j,a,f,d,i,k,c,g){var e=Backbone.Model.extend({initialize:function(m){this.url=galaxy_config.root+"api/tools/"+m.id+"?io_details=true"}});var b=Backbone.View.extend({container:"body",initialize:function(n){var m=this;if(parent.Galaxy&&parent.Galaxy.modal){this.modal=parent.Galaxy.modal}else{this.modal=new l.Modal.View()}this.options=n;this.setElement("<div/>");$(this.container).append(this.$el);this.model=new e({id:n.id});this.tree=new c(this);this.job_handler=new g(this);this.field_list={};this.input_list={};this.element_list={};this.datasets=new i({history_id:this.options.history_id,success:function(){m._initializeToolForm()}})},message:function(m){$(this.container).empty();$(this.container).append(m)},reset:function(){for(var m in this.element_list){this.element_list[m].reset()}},refresh:function(){this.tree.refresh();for(var m in this.field_list){this.field_list[m].trigger("change")}console.debug("tools-form::refresh() - Recreated tree structure. Refresh.")},_initializeToolForm:function(){var n=this;var o=new l.ButtonIcon({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/p/new/post/")}});var p=new l.ButtonIcon({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/t/"+n.options.id+"/")}});var m=new l.ButtonIcon({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",galaxy_config.root+"root?tool_id="+n.options.id)}});this.model.fetch({error:function(q){console.debug("tools-form::_initializeToolForm() : Attempt to fetch tool model failed.")},success:function(){n.section=new k.View(n,{inputs:n.model.get("inputs"),cls:"ui-table-plain"});if(n.incompatible){n.$el.hide();$("#tool-form-classic").show();return}n.portlet=new h.View({icon:"fa-wrench",title:"<b>"+n.model.get("name")+"</b> "+n.model.get("description"),buttons:{execute:new l.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){n.job_handler.submit()}})},operations:{button_question:o,button_search:p,button_share:m}});if(!n.options.biostar_url){o.$el.hide();p.$el.hide()}n.$el.append(n.portlet.$el);if(n.options.help!=""){n.$el.append(d.help(n.options.help))}if(n.options.citations){n.$el.append(d.citations());var q=new j.ToolCitationCollection();q.tool_id=n.options.id;var r=new a.CitationListView({collection:q});r.render();q.fetch()}n.setElement(n.portlet.content());n.portlet.append(n.section.$el);n.refresh()}})}});return{View:b}}); \ No newline at end of file +define(["mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-datasets","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(h,l,j,a,f,d,i,k,c,g){var e=Backbone.Model.extend({initialize:function(m){this.url=galaxy_config.root+"api/tools/"+m.id+"?io_details=true"}});var b=Backbone.View.extend({container:"body",initialize:function(n){var m=this;if(parent.Galaxy&&parent.Galaxy.modal){this.modal=parent.Galaxy.modal}else{this.modal=new l.Modal.View()}this.options=n;this.setElement("<div/>");$(this.container).append(this.$el);this.model=new e({id:n.id,job_id:n.job_id});this.tree=new c(this);this.job_handler=new g(this);this.field_list={};this.input_list={};this.element_list={};this.datasets=new i({history_id:this.options.history_id,success:function(){m._initializeToolForm()}})},message:function(m){$(this.container).empty();$(this.container).append(m)},reset:function(){for(var m in this.element_list){this.element_list[m].reset()}},refresh:function(){this.tree.refresh();for(var m in this.field_list){this.field_list[m].trigger("change")}console.debug("tools-form::refresh() - Recreated data structure. Refresh.")},_initializeToolForm:function(){var n=this;var p=new l.ButtonIcon({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/p/new/post/")}});var q=new l.ButtonIcon({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/t/"+n.options.id+"/")}});var m=new l.ButtonIcon({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",galaxy_config.root+"root?tool_id="+n.options.id)}});var o={button_question:p,button_search:q,button_share:m};if(Galaxy.currUser.get("is_admin")){o.button_download=new l.ButtonIcon({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+n.options.id+"/download"}})}this.model.fetch({error:function(r){console.debug("tools-form::_initializeToolForm() : Attempt to fetch tool model failed.")},success:function(){n.section=new k.View(n,{inputs:n.model.get("inputs"),cls:"ui-table-plain"});if(n.incompatible){n.$el.hide();$("#tool-form-classic").show();return}n.portlet=new h.View({icon:"fa-wrench",title:"<b>"+n.model.get("name")+"</b> "+n.model.get("description"),operations:o,buttons:{execute:new l.ButtonIcon({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",floating:"clear",onclick:function(){n.job_handler.submit()}})}});if(!n.options.biostar_url){p.$el.hide();q.$el.hide()}n.$el.append(n.portlet.$el);if(n.options.help!=""){n.$el.append(d.help(n.options.help))}if(n.options.citations){n.$el.append(d.citations());var r=new j.ToolCitationCollection();r.tool_id=n.options.id;var s=new a.CitationListView({collection:r});s.render();r.fetch()}n.setElement(n.portlet.content());n.portlet.append(n.section.$el);n.refresh()}})}});return{View:b}}); \ No newline at end of file diff -r a3cff55b129fcbf9b8e359ff0f71cb844a7e9277 -r f94fbe948b7a37b386ee8e3f5591ec7e70d94d16 templates/webapps/galaxy/tool_form.api.mako --- a/templates/webapps/galaxy/tool_form.api.mako +++ b/templates/webapps/galaxy/tool_form.api.mako @@ -27,7 +27,8 @@ 'help' : tool_help, 'citations' : tool_citations, 'biostar_url' : trans.app.config.biostar_url, - 'history_id' : trans.security.encode_id( trans.history.id ) + 'history_id' : trans.security.encode_id( trans.history.id ), + 'job_id' : trans.security.encode_id( job.id ) if job else None } %> ${h.js("libs/bibtex", "libs/jquery/jquery-ui")} @@ -40,14 +41,6 @@ }); </script> -##%if tool.tool_shed_repository: -## <% tool_url = tool.tool_shed_repository.get_sharable_url( tool.app ) %> -## %if tool_url: -## <br/> -## ${ render_msg( 'This tool was installed from a ToolShed, you may be able to find additional information by following this link: <a href="%s" target="_blank">%s</a>' % ( tool_url, tool_url ), 'info' ) } -## %endif -##%endif - ## classic tool form <div id="tool-form-classic" style="display: none;"><%include file="tool_form.mako"/> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.