commit/galaxy-central: guerler: ToolForm: Show labels for menu bar buttons
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/a8aa8c67fe53/ Changeset: a8aa8c67fe53 User: guerler Date: 2014-12-10 15:16:04+00:00 Summary: ToolForm: Show labels for menu bar buttons Affected #: 3 files diff -r 3e068b37bca33448451682275b0bbb27d594ba41 -r a8aa8c67fe5335df93e3195bb46beb62783325bd 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 @@ -312,6 +312,7 @@ // button for version selection var requirements_button = new Ui.ButtonIcon({ icon : 'fa-info-circle', + title : 'Requirements', tooltip : 'Display tool requirements', onclick : function() { if (!this.visible) { @@ -342,12 +343,13 @@ if (options.versions && options.versions.length > 1) { for (var i in options.versions) { versions_button.addMenu({ - title : options.versions[i], + title : 'Switch to ' + options.versions[i], + version : options.versions[i], icon : 'fa-cube', onclick : function() { // here we update the tool version (some tools encode the version also in the id) - options.id = options.id.replace(options.version, this.title); - options.version = this.title; + options.id = options.id.replace(options.version, this.version); + options.version = this.version; // rebuild the model and form self.deferred.reset(); @@ -362,6 +364,7 @@ // button menu var menu_button = new Ui.ButtonMenu({ icon : 'fa-gear', + title : 'Options', tooltip : 'View available options' }); diff -r 3e068b37bca33448451682275b0bbb27d594ba41 -r a8aa8c67fe5335df93e3195bb46beb62783325bd static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -312,6 +312,7 @@ // button for version selection var requirements_button = new Ui.ButtonIcon({ icon : 'fa-info-circle', + title : 'Requirements', tooltip : 'Display tool requirements', onclick : function() { if (!this.visible) { @@ -342,12 +343,13 @@ if (options.versions && options.versions.length > 1) { for (var i in options.versions) { versions_button.addMenu({ - title : options.versions[i], + title : 'Switch to ' + options.versions[i], + version : options.versions[i], icon : 'fa-cube', onclick : function() { // here we update the tool version (some tools encode the version also in the id) - options.id = options.id.replace(options.version, this.title); - options.version = this.title; + options.id = options.id.replace(options.version, this.version); + options.version = this.version; // rebuild the model and form self.deferred.reset(); @@ -362,6 +364,7 @@ // button menu var menu_button = new Ui.ButtonMenu({ icon : 'fa-gear', + title : 'Options', tooltip : 'View available options' }); diff -r 3e068b37bca33448451682275b0bbb27d594ba41 -r a8aa8c67fe5335df93e3195bb46beb62783325bd 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(["utils/utils","utils/deferred","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-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(this.is_dynamic){var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})}},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{o+="tool_version="+this.options.version+"&";var q=top.location.href;var r=q.indexOf("?");if(q.indexOf("tool_id=")!=-1&&r!==-1){o+=q.slice(r+1)}}}var p=this.deferred.register();i.request({type:"GET",url:o,success:function(s){n.options=s;n._buildForm();n.message.update({status:"success",message:"Now you are using '"+n.options.name+"' version "+n.options.version+".",persistent:false});n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(s)},error:function(s){n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(s);var t=s.error||"Uncaught error.";n.modal.show({title:"Tool cannot be executed",body:t,buttons:{Close:function(){n.modal.hide()}}})}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(s){if(s.values.length>0&&s.values[0]&&s.values[0].src==="hda"){return n.content.get({id:s.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function r(v){for(var t in n.input_list){var u=n.field_list[t];var s=n.input_list[t];if(s.is_dynamic&&u.wait&&u.unwait){if(v){u.wait()}else{u.unwait()}}}}r(true);var q=this.deferred.register();var p=galaxy_config.root+"api/tools/"+this.options.id+"/build?tool_version="+this.options.version;i.request({type:"GET",url:p,data:o,success:function(s){n._updateForm(s);r(false);n.deferred.done(q);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(s)},error:function(s){n.deferred.done(q);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(s)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(!_.isEqual(p.options,u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];if((["data","data_collection","drill_down"]).indexOf(p.type)!=-1){t=p.options}else{for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(){var w=this;this.field_list={};this.input_list={};this.element_list={};this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);var x=this.options;this.message=new m.Message();var n="This tool requires ";for(var r in x.requirements){var v=x.requirements[r];n+=v.name;if(v.version){n+=" (Version "+v.version+")"}if(r<x.requirements.length-2){n+=", "}if(r==x.requirements.length-2){n+=" and "}}n+=".";var t=new m.ButtonIcon({icon:"fa-info-circle",tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;w.message.update({persistent:true,message:n,status:"warning"})}else{this.visible=false;w.message.update({message:""})}}});if(!x.requirements||x.requirements.length==0){t.$el.hide()}var p=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Select another tool version"});if(x.versions&&x.versions.length>1){for(var r in x.versions){p.addMenu({title:x.versions[r],icon:"fa-cube",onclick:function(){x.id=x.id.replace(x.version,this.title);x.version=this.title;w.deferred.reset();w.deferred.execute(function(){w._buildModel()})}})}}else{p.$el.hide()}var s=new m.ButtonMenu({icon:"fa-gear",tooltip:"View available options"});if(x.biostar_url){s.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/p/new/post/")}});s.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/t/"+x.id+"/")}})}s.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+x.id)}});if(this.is_admin){s.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+x.id+"/download"}})}this.section=new l.View(w,{inputs:x.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+x.name+"</b> "+x.description+" (Version "+x.version+")",cls:"ui-portlet-slim",operations:{requirements:t,menu:s,versions:p},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+x.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){w.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(x.help!=""){this.$el.append(d.help(x.help))}if(x.citations){var u=$("<div/>");var o=new k.ToolCitationCollection();o.tool_id=x.id;var q=new a.CitationListView({el:u,collection:o});q.render();o.fetch();this.$el.append(u)}this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.rebuild();if(x.message){this.message.update({persistent:true,status:"warning",message:x.message})}}});return{View:b}}); \ No newline at end of file +define(["utils/utils","utils/deferred","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-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(this.is_dynamic){var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})}},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{o+="tool_version="+this.options.version+"&";var q=top.location.href;var r=q.indexOf("?");if(q.indexOf("tool_id=")!=-1&&r!==-1){o+=q.slice(r+1)}}}var p=this.deferred.register();i.request({type:"GET",url:o,success:function(s){n.options=s;n._buildForm();n.message.update({status:"success",message:"Now you are using '"+n.options.name+"' version "+n.options.version+".",persistent:false});n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(s)},error:function(s){n.deferred.done(p);console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(s);var t=s.error||"Uncaught error.";n.modal.show({title:"Tool cannot be executed",body:t,buttons:{Close:function(){n.modal.hide()}}})}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(s){if(s.values.length>0&&s.values[0]&&s.values[0].src==="hda"){return n.content.get({id:s.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function r(v){for(var t in n.input_list){var u=n.field_list[t];var s=n.input_list[t];if(s.is_dynamic&&u.wait&&u.unwait){if(v){u.wait()}else{u.unwait()}}}}r(true);var q=this.deferred.register();var p=galaxy_config.root+"api/tools/"+this.options.id+"/build?tool_version="+this.options.version;i.request({type:"GET",url:p,data:o,success:function(s){n._updateForm(s);r(false);n.deferred.done(q);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(s)},error:function(s){n.deferred.done(q);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(s)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(!_.isEqual(p.options,u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];if((["data","data_collection","drill_down"]).indexOf(p.type)!=-1){t=p.options}else{for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(){var w=this;this.field_list={};this.input_list={};this.element_list={};this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);var x=this.options;this.message=new m.Message();var n="This tool requires ";for(var r in x.requirements){var v=x.requirements[r];n+=v.name;if(v.version){n+=" (Version "+v.version+")"}if(r<x.requirements.length-2){n+=", "}if(r==x.requirements.length-2){n+=" and "}}n+=".";var t=new m.ButtonIcon({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;w.message.update({persistent:true,message:n,status:"warning"})}else{this.visible=false;w.message.update({message:""})}}});if(!x.requirements||x.requirements.length==0){t.$el.hide()}var p=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Select another tool version"});if(x.versions&&x.versions.length>1){for(var r in x.versions){p.addMenu({title:"Switch to "+x.versions[r],version:x.versions[r],icon:"fa-cube",onclick:function(){x.id=x.id.replace(x.version,this.version);x.version=this.version;w.deferred.reset();w.deferred.execute(function(){w._buildModel()})}})}}else{p.$el.hide()}var s=new m.ButtonMenu({icon:"fa-gear",title:"Options",tooltip:"View available options"});if(x.biostar_url){s.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/p/new/post/")}});s.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(x.biostar_url+"/t/"+x.id+"/")}})}s.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+x.id)}});if(this.is_admin){s.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+x.id+"/download"}})}this.section=new l.View(w,{inputs:x.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+x.name+"</b> "+x.description+" (Version "+x.version+")",cls:"ui-portlet-slim",operations:{requirements:t,menu:s,versions:p},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+x.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){w.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(x.help!=""){this.$el.append(d.help(x.help))}if(x.citations){var u=$("<div/>");var o=new k.ToolCitationCollection();o.tool_id=x.id;var q=new a.CitationListView({el:u,collection:o});q.render();o.fetch();this.$el.append(u)}this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.rebuild();if(x.message){this.message.update({persistent:true,status:"warning",message:x.message})}}});return{View:b}}); \ No newline at end of file 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.
participants (1)
-
commits-noreply@bitbucket.org