commit/galaxy-central: guerler: ToolForm: Minor UI adjustments
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1210ec537026/ Changeset: 1210ec537026 User: guerler Date: 2014-12-16 18:24:42+00:00 Summary: ToolForm: Minor UI adjustments Affected #: 6 files diff -r 17933aef1d3527d22211ff7bf0e47bbbac66c4ac -r 1210ec53702661e4c04d4b741d90d0d49d44bba7 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 @@ -321,23 +321,6 @@ // create message view this.message = new Ui.Message(); - // construct tool requirements message content - var requirements_message = 'This tool requires '; - for (var i in options.requirements) { - var req = options.requirements[i]; - requirements_message += req.name; - if (req.version) { - requirements_message += ' (Version ' + req.version + ')'; - } - if (i < options.requirements.length - 2) { - requirements_message += ', '; - } - if (i == options.requirements.length - 2) { - requirements_message += ' and '; - } - } - requirements_message += '.'; - // button for version selection var requirements_button = new Ui.ButtonIcon({ icon : 'fa-info-circle', @@ -348,8 +331,8 @@ this.visible = true; self.message.update({ persistent : true, - message : requirements_message, - status : 'warning' + message : ToolTemplate.requirements(options), + status : 'info' }); } else { this.visible = false; @@ -395,7 +378,7 @@ // button menu var menu_button = new Ui.ButtonMenu({ - icon : 'fa-gear', + icon : 'fa-caret-down', title : 'Options', tooltip : 'View available options' }); @@ -462,7 +445,7 @@ // create portlet this.portlet = new Portlet.View({ icon : 'fa-wrench', - title : '<b>' + options.name + '</b> ' + options.description + ' (Version ' + options.version + ')', + title : '<b>' + options.name + '</b> ' + options.description + ' (Galaxy Tool Version ' + options.version + ')', cls : 'ui-portlet-slim', operations: { requirements : requirements_button, diff -r 17933aef1d3527d22211ff7bf0e47bbbac66c4ac -r 1210ec53702661e4c04d4b741d90d0d49d44bba7 client/galaxy/scripts/mvc/tools/tools-template.js --- a/client/galaxy/scripts/mvc/tools/tools-template.js +++ b/client/galaxy/scripts/mvc/tools/tools-template.js @@ -58,6 +58,24 @@ '<i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>' + 'This is a batch mode input field. A separate job will be triggered for each dataset.' + '</div>'; + }, + + requirements: function(options) { + var requirements_message = 'This tool requires '; + for (var i in options.requirements) { + var req = options.requirements[i]; + requirements_message += req.name; + if (req.version) { + requirements_message += ' (Version ' + req.version + ')'; + } + if (i < options.requirements.length - 2) { + requirements_message += ', '; + } + if (i == options.requirements.length - 2) { + requirements_message += ' and '; + } + } + return requirements_message + '. Click <a target="_blank" href="https://wiki.galaxyproject.org/Tools/Requirements">here</a> for more information.'; } }; diff -r 17933aef1d3527d22211ff7bf0e47bbbac66c4ac -r 1210ec53702661e4c04d4b741d90d0d49d44bba7 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -321,23 +321,6 @@ // create message view this.message = new Ui.Message(); - // construct tool requirements message content - var requirements_message = 'This tool requires '; - for (var i in options.requirements) { - var req = options.requirements[i]; - requirements_message += req.name; - if (req.version) { - requirements_message += ' (Version ' + req.version + ')'; - } - if (i < options.requirements.length - 2) { - requirements_message += ', '; - } - if (i == options.requirements.length - 2) { - requirements_message += ' and '; - } - } - requirements_message += '.'; - // button for version selection var requirements_button = new Ui.ButtonIcon({ icon : 'fa-info-circle', @@ -348,8 +331,8 @@ this.visible = true; self.message.update({ persistent : true, - message : requirements_message, - status : 'warning' + message : ToolTemplate.requirements(options), + status : 'info' }); } else { this.visible = false; @@ -395,7 +378,7 @@ // button menu var menu_button = new Ui.ButtonMenu({ - icon : 'fa-gear', + icon : 'fa-caret-down', title : 'Options', tooltip : 'View available options' }); @@ -462,7 +445,7 @@ // create portlet this.portlet = new Portlet.View({ icon : 'fa-wrench', - title : '<b>' + options.name + '</b> ' + options.description + ' (Version ' + options.version + ')', + title : '<b>' + options.name + '</b> ' + options.description + ' (Galaxy Tool Version ' + options.version + ')', cls : 'ui-portlet-slim', operations: { requirements : requirements_button, diff -r 17933aef1d3527d22211ff7bf0e47bbbac66c4ac -r 1210ec53702661e4c04d4b741d90d0d49d44bba7 static/scripts/mvc/tools/tools-template.js --- a/static/scripts/mvc/tools/tools-template.js +++ b/static/scripts/mvc/tools/tools-template.js @@ -58,6 +58,24 @@ '<i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>' + 'This is a batch mode input field. A separate job will be triggered for each dataset.' + '</div>'; + }, + + requirements: function(options) { + var requirements_message = 'This tool requires '; + for (var i in options.requirements) { + var req = options.requirements[i]; + requirements_message += req.name; + if (req.version) { + requirements_message += ' (Version ' + req.version + ')'; + } + if (i < options.requirements.length - 2) { + requirements_message += ', '; + } + if (i == options.requirements.length - 2) { + requirements_message += ' and '; + } + } + return requirements_message + '. Click <a target="_blank" href="https://wiki.galaxyproject.org/Tools/Requirements">here</a> for more information.'; } }; diff -r 17933aef1d3527d22211ff7bf0e47bbbac66c4ac -r 1210ec53702661e4c04d4b741d90d0d49d44bba7 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(n){console.debug(n);var o=parent.Galaxy;if(o&&o.modal){this.modal=o.modal}else{this.modal=new m.Modal.View()}if(o&&o.currUser){this.is_admin=o.currUser.get("is_admin")}else{this.is_admin=false}this.options=n;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(n){$(this.container).empty();$(this.container).append(n)},highlight:function(o,p,n){var q=this.element_list[o];if(q){q.error(p||"Please verify this parameter.");if(!n){$(this.container).animate({scrollTop:q.$el.offset().top-20},500)}}},_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.tree.matchModel(s,function(u,y){var t=n.input_list[u];if(t&&t.options){if(!_.isEqual(t.options,y.options)){t.options=y.options;var z=n.field_list[u];if(z.update){var x=[];if((["data","data_collection","drill_down"]).indexOf(t.type)!=-1){x=t.options}else{for(var w in y.options){var v=y.options[w];if(v.length>2){x.push({label:v[0],value:v[1]})}}}z.update(x);z.trigger("change");console.debug("Updating options for "+u)}}}});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)}})},_buildForm:function(){var n=this;this.off("refresh");this.off("reset");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 p=this.options;this._renderForm(p);this.tree.finalize();if(p.errors){var q=this.tree.matchResponse(p.errors);for(var o in q){this.highlight(o,q[o],true)}}this.on("refresh",function(){n.deferred.reset();n.deferred.execute(function(){n._updateModel()})});this.on("reset",function(){for(var r in this.element_list){this.element_list[r].reset()}})},_renderForm:function(y){var x=this;this.message=new m.Message();var n="This tool requires ";for(var r in y.requirements){var w=y.requirements[r];n+=w.name;if(w.version){n+=" (Version "+w.version+")"}if(r<y.requirements.length-2){n+=", "}if(r==y.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;x.message.update({persistent:true,message:n,status:"warning"})}else{this.visible=false;x.message.update({message:""})}}});if(!y.requirements||y.requirements.length==0){t.$el.hide()}var p=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Select another tool version"});if(y.versions&&y.versions.length>1){for(var r in y.versions){var u=y.versions[r];if(u!=y.version){p.addMenu({title:"Switch to "+u,version:u,icon:"fa-cube",onclick:function(){y.id=y.id.replace(y.version,this.version);y.version=this.version;x.deferred.reset();x.deferred.execute(function(){x._buildModel()})}})}}}else{p.$el.hide()}var s=new m.ButtonMenu({icon:"fa-gear",title:"Options",tooltip:"View available options"});if(y.biostar_url){s.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(y.biostar_url+"/p/new/post/")}});s.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(y.biostar_url+"/t/"+y.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="+y.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/"+y.id+"/download"}})}this.section=new l.View(x,{inputs:y.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>"+y.name+"</b> "+y.description+" (Version "+y.version+")",cls:"ui-portlet-slim",operations:{requirements:t,menu:s,versions:p},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+y.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){x.job_handler.submit()}})}});this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.$el.empty();this.$el.append(this.portlet.$el);if(y.help!=""){this.$el.append(d.help(y.help))}if(y.citations){var v=$("<div/>");var o=new k.ToolCitationCollection();o.tool_id=y.id;var q=new a.CitationListView({el:v,collection:o});q.render();o.fetch();this.$el.append(v)}if(y.message){this.message.update({persistent:true,status:"warning",message:y.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(n){console.debug(n);var o=parent.Galaxy;if(o&&o.modal){this.modal=o.modal}else{this.modal=new m.Modal.View()}if(o&&o.currUser){this.is_admin=o.currUser.get("is_admin")}else{this.is_admin=false}this.options=n;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this._buildForm()},reciept:function(n){$(this.container).empty();$(this.container).append(n)},highlight:function(o,p,n){var q=this.element_list[o];if(q){q.error(p||"Please verify this parameter.");if(!n){$(this.container).animate({scrollTop:q.$el.offset().top-20},500)}}},_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.tree.matchModel(s,function(u,y){var t=n.input_list[u];if(t&&t.options){if(!_.isEqual(t.options,y.options)){t.options=y.options;var z=n.field_list[u];if(z.update){var x=[];if((["data","data_collection","drill_down"]).indexOf(t.type)!=-1){x=t.options}else{for(var w in y.options){var v=y.options[w];if(v.length>2){x.push({label:v[0],value:v[1]})}}}z.update(x);z.trigger("change");console.debug("Updating options for "+u)}}}});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)}})},_buildForm:function(){var n=this;this.off("refresh");this.off("reset");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 p=this.options;this._renderForm(p);this.tree.finalize();if(p.errors){var q=this.tree.matchResponse(p.errors);for(var o in q){this.highlight(o,q[o],true)}}this.on("refresh",function(){n.deferred.reset();n.deferred.execute(function(){n._updateModel()})});this.on("reset",function(){for(var r in this.element_list){this.element_list[r].reset()}})},_renderForm:function(w){var v=this;this.message=new m.Message();var s=new m.ButtonIcon({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;v.message.update({persistent:true,message:d.requirements(w),status:"info"})}else{this.visible=false;v.message.update({message:""})}}});if(!w.requirements||w.requirements.length==0){s.$el.hide()}var o=new m.ButtonMenu({icon:"fa-cubes",title:"Versions",tooltip:"Select another tool version"});if(w.versions&&w.versions.length>1){for(var q in w.versions){var t=w.versions[q];if(t!=w.version){o.addMenu({title:"Switch to "+t,version:t,icon:"fa-cube",onclick:function(){w.id=w.id.replace(w.version,this.version);w.version=this.version;v.deferred.reset();v.deferred.execute(function(){v._buildModel()})}})}}}else{o.$el.hide()}var r=new m.ButtonMenu({icon:"fa-caret-down",title:"Options",tooltip:"View available options"});if(w.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(w.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(w.biostar_url+"/t/"+w.id+"/")}})}r.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="+w.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+w.id+"/download"}})}this.section=new l.View(v,{inputs:w.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>"+w.name+"</b> "+w.description+" (Galaxy Tool Version "+w.version+")",cls:"ui-portlet-slim",operations:{requirements:s,menu:r,versions:o},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute: "+w.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){v.job_handler.submit()}})}});this.portlet.append(this.message.$el,true);this.portlet.append(this.section.$el);this.$el.empty();this.$el.append(this.portlet.$el);if(w.help!=""){this.$el.append(d.help(w.help))}if(w.citations){var u=$("<div/>");var n=new k.ToolCitationCollection();n.tool_id=w.id;var p=new a.CitationListView({el:u,collection:n});p.render();n.fetch();this.$el.append(u)}if(w.message){this.message.update({persistent:true,status:"warning",message:w.message})}}});return{View:b}}); \ No newline at end of file diff -r 17933aef1d3527d22211ff7bf0e47bbbac66c4ac -r 1210ec53702661e4c04d4b741d90d0d49d44bba7 static/scripts/packed/mvc/tools/tools-template.js --- a/static/scripts/packed/mvc/tools/tools-template.js +++ b/static/scripts/packed/mvc/tools/tools-template.js @@ -1,1 +1,1 @@ -define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},success:function(c){if(!c.jobs||!c.jobs.length){console.debug("tools-template::success() - Failed jobs.");return}var a=c.jobs.length;var d="";if(a==1){d="1 job has"}else{d=a+" jobs have"}var b='<div class="donemessagelarge"><p>'+d+" been successfully added to the queue - resulting in the following datasets:</p>";for(var e in c.outputs){b+='<p style="padding: 10px 20px;"><b>'+(parseInt(e)+1)+": "+c.outputs[e].name+"</b></p>"}b+="<p>You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.</p></div>";return b},error:function(a){return'<div><p>The server could not complete the request. Please contact the Galaxy Team if this error persists.</p><textarea class="ui-textarea" disabled style="color: black;" rows="6">'+JSON.stringify(a,undefined,4)+"</textarea></div>"},batchMode:function(){return'<div class="ui-table-form-info"><i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>This is a batch mode input field. A separate job will be triggered for each dataset.</div>'}}}); \ No newline at end of file +define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},success:function(c){if(!c.jobs||!c.jobs.length){console.debug("tools-template::success() - Failed jobs.");return}var a=c.jobs.length;var d="";if(a==1){d="1 job has"}else{d=a+" jobs have"}var b='<div class="donemessagelarge"><p>'+d+" been successfully added to the queue - resulting in the following datasets:</p>";for(var e in c.outputs){b+='<p style="padding: 10px 20px;"><b>'+(parseInt(e)+1)+": "+c.outputs[e].name+"</b></p>"}b+="<p>You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.</p></div>";return b},error:function(a){return'<div><p>The server could not complete the request. Please contact the Galaxy Team if this error persists.</p><textarea class="ui-textarea" disabled style="color: black;" rows="6">'+JSON.stringify(a,undefined,4)+"</textarea></div>"},batchMode:function(){return'<div class="ui-table-form-info"><i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>This is a batch mode input field. A separate job will be triggered for each dataset.</div>'},requirements:function(a){var d="This tool requires ";for(var b in a.requirements){var c=a.requirements[b];d+=c.name;if(c.version){d+=" (Version "+c.version+")"}if(b<a.requirements.length-2){d+=", "}if(b==a.requirements.length-2){d+=" and "}}return d+'. Click <a target="_blank" href="https://wiki.galaxyproject.org/Tools/Requirements">here</a> for more information.'}}}); \ 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