commit/galaxy-central: guerler: Upload: Enable click on filename for ftp files, ToolForm: Fixes and adjustments
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e7708503e1aa/ Changeset: e7708503e1aa User: guerler Date: 2014-10-03 19:31:27+00:00 Summary: Upload: Enable click on filename for ftp files, ToolForm: Fixes and adjustments Affected #: 13 files diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 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 @@ -137,9 +137,20 @@ console.debug('tools-form::_initializeToolForm() : Attempt to fetch tool model failed.'); }, success: function() { - // inputs - self.inputs = self.model.get('inputs'); - + // create tool form section + self.section = new ToolSection.View(self, { + inputs : self.model.get('inputs'), + cls : 'ui-table-plain' + }); + + // TEMPORARY SWITCH + // switch to classic tool form mako if the form definition is incompatible + if (self.incompatible) { + self.$el.hide(); + $('#tool-form-classic').show(); + return; + } + // create portlet self.portlet = new Portlet.View({ icon : 'fa-wrench', @@ -192,12 +203,6 @@ // configure portlet and form table self.setElement(self.portlet.content()); - // create tool form section - self.section = new ToolSection.View(self, { - inputs : self.model.get('inputs'), - cls : 'ui-table-plain' - }); - // append tool section self.portlet.append(self.section.$el); diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 client/galaxy/scripts/mvc/tools/tools-section.js --- a/client/galaxy/scripts/mvc/tools/tools-section.js +++ b/client/galaxy/scripts/mvc/tools/tools-section.js @@ -260,62 +260,70 @@ switch(field_type) { // text input field case 'text' : - field = this._field_text(input_def); + field = this._fieldText(input_def); break; // select field case 'select' : - field = this._field_select(input_def); + field = this._fieldSelect(input_def); break; // dataset case 'data': - field = this._field_data(input_def); + field = this._fieldData(input_def); break; // dataset column case 'data_column': - field = this._field_select(input_def); + field = this._fieldSelect(input_def); break; // conditional select field case 'conditional': - field = this._field_conditional(input_def); + field = this._fieldConditional(input_def); break; // hidden field case 'hidden': - field = this._field_hidden(input_def); + field = this._fieldHidden(input_def); break; // integer field case 'integer': - field = this._field_slider(input_def); + field = this._fieldSlider(input_def); break; // float field case 'float': - field = this._field_slider(input_def); + field = this._fieldSlider(input_def); break; // boolean field case 'boolean': - field = this._field_boolean(input_def); + field = this._fieldBoolean(input_def); break; - } - - // pick a generic field if specific mapping failed - if (!field) { - if (input_def.options) { - // assign select field - field = this._field_select(input_def); - } else { - // assign text field - field = this._field_text(input_def); - } - - // log - console.debug('tools-form::_addRow() : Auto matched field type (' + field_type + ').'); + + // genome field + case 'genomebuild': + field = this._fieldSelect(input_def); + break; + + // flag as incompatible + default: + // flag + this.app.incompatible = true; + + // with or without options + if (input_def.options) { + // assign select field + field = this._fieldSelect(input_def); + } else { + // assign text field + field = this._fieldText(input_def); + } + + // log + console.debug('tools-form::_addRow() : Auto matched field type (' + field_type + ').'); } // set field value @@ -348,7 +356,7 @@ /** Conditional input field selector */ - _field_conditional : function(input_def) { + _fieldConditional : function(input_def) { // link this var self = this; @@ -401,7 +409,7 @@ /** Data input field */ - _field_data : function(input_def) { + _fieldData : function(input_def) { // link this var self = this; @@ -505,7 +513,7 @@ /** Select/Checkbox/Radio options field */ - _field_select : function (input_def) { + _fieldSelect : function (input_def) { // configure options fields var options = []; for (var i in input_def.options) { @@ -537,7 +545,7 @@ /** Text input field */ - _field_text : function(input_def) { + _fieldText : function(input_def) { return new Ui.Input({ id : 'field-' + input_def.id, area : input_def.area @@ -546,7 +554,7 @@ /** Slider field */ - _field_slider: function(input_def) { + _fieldSlider: function(input_def) { // set min/max input_def.min = input_def.min || 0; input_def.max = input_def.max || 100000; @@ -568,7 +576,7 @@ /** Hidden field */ - _field_hidden : function(input_def) { + _fieldHidden : function(input_def) { return new Ui.Hidden({ id : 'field-' + input_def.id }); @@ -576,7 +584,7 @@ /** Boolean field */ - _field_boolean : function(input_def) { + _fieldBoolean : function(input_def) { return new Ui.RadioButton.View({ id : 'field-' + input_def.id, data : [ { label : 'Yes', value : 'true' }, diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 client/galaxy/scripts/mvc/ui/ui-slider.js --- a/client/galaxy/scripts/mvc/ui/ui-slider.js +++ b/client/galaxy/scripts/mvc/ui/ui-slider.js @@ -39,7 +39,8 @@ // add text field event this.$text.on('keydown', function (event) { var v = event.which; - if (!(v == 13 || v == 8 || v == 37 || v == 39 || v == 189 || (v >= 48 && v <= 57) + console.log(v); + if (!(v == 8 || v == 9 || v == 13 || v == 37 || v == 39 || v == 189 || (v >= 48 && v <= 57) || (self.options.step != 1 && $(this).val().indexOf('.') == -1) && v == 190)) { event.preventDefault(); } diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 client/galaxy/scripts/mvc/upload/upload-ftp.js --- a/client/galaxy/scripts/mvc/upload/upload-ftp.js +++ b/client/galaxy/scripts/mvc/upload/upload-ftp.js @@ -59,9 +59,15 @@ // add add: function(ftp_file) { + // link this + var self = this; + // create new item var $it = $(this._templateRow(ftp_file)); + // identify icon + var $icon = $it.find('.icon'); + // append to table $(this.el).find('tbody').append($it); @@ -72,16 +78,17 @@ } else { icon_class = this.options.class_add; } - $it.find('#upload-ftp-add').addClass(icon_class); + + // add icon class + $icon.addClass(icon_class); // click to add ftp files - var self = this; - $it.find('#upload-ftp-add').on('click', function() { + $it.on('click', function() { // find model var model_index = self._find(ftp_file); // update icon - $(this).removeClass(); + $icon.removeClass(); // add model if (!model_index) { @@ -94,13 +101,13 @@ }]); // add new icon class - $(this).addClass(self.options.class_remove); + $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); // add new icon class - $(this).addClass(self.options.class_add); + $icon.addClass(self.options.class_add); } }); }, @@ -121,8 +128,8 @@ // template row _templateRow: function(options) { - return '<tr>' + - '<td><div id="upload-ftp-add"/></td>' + + return '<tr class="upload-ftp-row" style="cursor: pointer;">' + + '<td><div class="icon"/></td>' + '<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' + '<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' + '<td style="white-space: nowrap;">' + options.ctime + '</td>' + diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -137,9 +137,20 @@ console.debug('tools-form::_initializeToolForm() : Attempt to fetch tool model failed.'); }, success: function() { - // inputs - self.inputs = self.model.get('inputs'); - + // create tool form section + self.section = new ToolSection.View(self, { + inputs : self.model.get('inputs'), + cls : 'ui-table-plain' + }); + + // TEMPORARY SWITCH + // switch to classic tool form mako if the form definition is incompatible + if (self.incompatible) { + self.$el.hide(); + $('#tool-form-classic').show(); + return; + } + // create portlet self.portlet = new Portlet.View({ icon : 'fa-wrench', @@ -192,12 +203,6 @@ // configure portlet and form table self.setElement(self.portlet.content()); - // create tool form section - self.section = new ToolSection.View(self, { - inputs : self.model.get('inputs'), - cls : 'ui-table-plain' - }); - // append tool section self.portlet.append(self.section.$el); diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -260,62 +260,70 @@ switch(field_type) { // text input field case 'text' : - field = this._field_text(input_def); + field = this._fieldText(input_def); break; // select field case 'select' : - field = this._field_select(input_def); + field = this._fieldSelect(input_def); break; // dataset case 'data': - field = this._field_data(input_def); + field = this._fieldData(input_def); break; // dataset column case 'data_column': - field = this._field_select(input_def); + field = this._fieldSelect(input_def); break; // conditional select field case 'conditional': - field = this._field_conditional(input_def); + field = this._fieldConditional(input_def); break; // hidden field case 'hidden': - field = this._field_hidden(input_def); + field = this._fieldHidden(input_def); break; // integer field case 'integer': - field = this._field_slider(input_def); + field = this._fieldSlider(input_def); break; // float field case 'float': - field = this._field_slider(input_def); + field = this._fieldSlider(input_def); break; // boolean field case 'boolean': - field = this._field_boolean(input_def); + field = this._fieldBoolean(input_def); break; - } - - // pick a generic field if specific mapping failed - if (!field) { - if (input_def.options) { - // assign select field - field = this._field_select(input_def); - } else { - // assign text field - field = this._field_text(input_def); - } - - // log - console.debug('tools-form::_addRow() : Auto matched field type (' + field_type + ').'); + + // genome field + case 'genomebuild': + field = this._fieldSelect(input_def); + break; + + // flag as incompatible + default: + // flag + this.app.incompatible = true; + + // with or without options + if (input_def.options) { + // assign select field + field = this._fieldSelect(input_def); + } else { + // assign text field + field = this._fieldText(input_def); + } + + // log + console.debug('tools-form::_addRow() : Auto matched field type (' + field_type + ').'); } // set field value @@ -348,7 +356,7 @@ /** Conditional input field selector */ - _field_conditional : function(input_def) { + _fieldConditional : function(input_def) { // link this var self = this; @@ -401,7 +409,7 @@ /** Data input field */ - _field_data : function(input_def) { + _fieldData : function(input_def) { // link this var self = this; @@ -505,7 +513,7 @@ /** Select/Checkbox/Radio options field */ - _field_select : function (input_def) { + _fieldSelect : function (input_def) { // configure options fields var options = []; for (var i in input_def.options) { @@ -537,7 +545,7 @@ /** Text input field */ - _field_text : function(input_def) { + _fieldText : function(input_def) { return new Ui.Input({ id : 'field-' + input_def.id, area : input_def.area @@ -546,7 +554,7 @@ /** Slider field */ - _field_slider: function(input_def) { + _fieldSlider: function(input_def) { // set min/max input_def.min = input_def.min || 0; input_def.max = input_def.max || 100000; @@ -568,7 +576,7 @@ /** Hidden field */ - _field_hidden : function(input_def) { + _fieldHidden : function(input_def) { return new Ui.Hidden({ id : 'field-' + input_def.id }); @@ -576,7 +584,7 @@ /** Boolean field */ - _field_boolean : function(input_def) { + _fieldBoolean : function(input_def) { return new Ui.RadioButton.View({ id : 'field-' + input_def.id, data : [ { label : 'Yes', value : 'true' }, diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/mvc/ui/ui-slider.js --- a/static/scripts/mvc/ui/ui-slider.js +++ b/static/scripts/mvc/ui/ui-slider.js @@ -39,7 +39,8 @@ // add text field event this.$text.on('keydown', function (event) { var v = event.which; - if (!(v == 13 || v == 8 || v == 37 || v == 39 || v == 189 || (v >= 48 && v <= 57) + console.log(v); + if (!(v == 8 || v == 9 || v == 13 || v == 37 || v == 39 || v == 189 || (v >= 48 && v <= 57) || (self.options.step != 1 && $(this).val().indexOf('.') == -1) && v == 190)) { event.preventDefault(); } diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/mvc/upload/upload-ftp.js --- a/static/scripts/mvc/upload/upload-ftp.js +++ b/static/scripts/mvc/upload/upload-ftp.js @@ -59,9 +59,15 @@ // add add: function(ftp_file) { + // link this + var self = this; + // create new item var $it = $(this._templateRow(ftp_file)); + // identify icon + var $icon = $it.find('.icon'); + // append to table $(this.el).find('tbody').append($it); @@ -72,16 +78,17 @@ } else { icon_class = this.options.class_add; } - $it.find('#upload-ftp-add').addClass(icon_class); + + // add icon class + $icon.addClass(icon_class); // click to add ftp files - var self = this; - $it.find('#upload-ftp-add').on('click', function() { + $it.on('click', function() { // find model var model_index = self._find(ftp_file); // update icon - $(this).removeClass(); + $icon.removeClass(); // add model if (!model_index) { @@ -94,13 +101,13 @@ }]); // add new icon class - $(this).addClass(self.options.class_remove); + $icon.addClass(self.options.class_remove); } else { // remove self.app.collection.remove(model_index); // add new icon class - $(this).addClass(self.options.class_add); + $icon.addClass(self.options.class_add); } }); }, @@ -121,8 +128,8 @@ // template row _templateRow: function(options) { - return '<tr>' + - '<td><div id="upload-ftp-add"/></td>' + + return '<tr class="upload-ftp-row" style="cursor: pointer;">' + + '<td><div class="icon"/></td>' + '<td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">' + options.path + '</p></td>' + '<td style="white-space: nowrap;">' + Utils.bytesToString(options.size) + '</td>' + '<td style="white-space: nowrap;">' + options.ctime + '</td>' + diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 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.inputs=n.model.get("inputs");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.section=new k.View(n,{inputs:n.model.get("inputs"),cls:"ui-table-plain"});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});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 diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/packed/mvc/tools/tools-section.js --- a/static/scripts/packed/mvc/tools/tools-section.js +++ b/static/scripts/packed/mvc/tools/tools-section.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-dataset"],function(d,a,g,c,b){var e=Backbone.View.extend({initialize:function(h){this.setElement(this._template(h))},error:function(h){this.$el.find(".ui-table-form-error-text").html(h);this.$el.find(".ui-table-form-error").fadeIn();this.$el.addClass("ui-error")},reset:function(){this.$el.find(".ui-table-form-error").hide();this.$el.removeClass("ui-error")},_template:function(h){var i=$('<div class="ui-table-element"/>');i.append('<div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>');if(h.label){i.append('<div class="ui-table-form-title-strong">'+h.label+"</div>")}i.append(h.$el);if(h.help){i.append('<div class="ui-table-form-info">'+h.help+"</div>")}return i}});var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new a.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(k,h)}},_addConditional:function(h){h.label=h.test_param.label;h.value=h.test_param.value;var j=this._addRow("conditional",h);for(var l in h.cases){var k=h.id+"-section-"+l;var m=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});m.$el.addClass("ui-table-form-section");this.table.add(m.$el);this.table.append(k)}},_addRepeat:function(h){var j=this;var n=0;var m=new c.View({title_new:h.title,max:h.max,onnew:function(){var i=h.id+"-section-"+(n++);var q=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:i,title:h.title,$el:q.$el,ondel:function(){m.del(i);m.retitle(h.title);j.app.refresh()}});m.retitle(h.title);j.app.refresh()}});for(var l=0;l<h.min;l++){var k=h.id+"-section-"+(n++);var p=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:k,title:h.title,$el:p.$el})}m.retitle(h.title);var o=new e({label:h.title,help:h.help,$el:m.$el});o.$el.addClass("ui-table-form-section");this.table.add(o.$el);this.table.append(h.id)},_addRow:function(j,h){var l=h.id;var i=null;switch(j){case"text":i=this._field_text(h);break;case"select":i=this._field_select(h);break;case"data":i=this._field_data(h);break;case"data_column":i=this._field_select(h);break;case"conditional":i=this._field_conditional(h);break;case"hidden":i=this._field_hidden(h);break;case"integer":i=this._field_slider(h);break;case"float":i=this._field_slider(h);break;case"boolean":i=this._field_boolean(h);break}if(!i){if(h.options){i=this._field_select(h)}else{i=this._field_text(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+j+").")}if(h.value!==undefined){i.value(h.value)}this.app.field_list[l]=i;var k=new e({label:h.label,help:h.help,$el:i.$el});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);return this.table.get(l)},_field_conditional:function(h){var j=this;var k=[];for(var l in h.test_param.options){var m=h.test_param.options[l];k.push({label:m[0],value:m[1]})}return new g.Select.View({id:"field-"+h.id,data:k,onchange:function(u){for(var s in h.cases){var o=h.cases[s];var r=h.id+"-section-"+s;var n=j.table.get(r);var q=false;for(var p in o.inputs){var t=o.inputs[p].type;if(t&&t!=="hidden"){q=true;break}}if(o.value==u&&q){n.fadeIn("fast")}else{n.hide()}}}})},_field_data:function(h){var i=this;var j=h.id;return new b.View(this.app,{id:"field-"+j,extensions:h.extensions,multiple:h.multiple,onchange:function(o){var n=o.values[0].id;var l=i.app.tree.references(j,"data_column");if(l.length<=0){console.debug("tool-form::field_data() - Data column parameters unavailable.");return}for(var m in l){var k=i.app.field_list[l[m]];k.wait&&k.wait()}i.app.datasets.getDetails(n,function(r){var z=null;if(r){console.debug("tool-form::field_data() - Selected dataset "+n+".");z=r.metadata_column_types;if(!z){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+n+".")}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+n+".")}for(var t in l){var v=i.app.input_list[l[t]];var w=i.app.field_list[l[t]];if(!v||!w){console.debug("tool-form::field_data() - FAILED: Column not found.")}var s=v.numerical;var q=[];for(var y in z){var x=z[y];var p=(parseInt(y)+1);var u="Text";if(x=="int"||x=="float"){u="Number"}if(x=="int"||x=="float"||!s){q.push({label:"Column: "+p+" ["+u+"]",value:p})}}if(w){w.update(q);if(!w.exists(w.value())){w.value(w.first())}w.show()}}})}})},_field_select:function(h){var j=[];for(var k in h.options){var l=h.options[k];j.push({label:l[0],value:l[1]})}var m=g.Select;switch(h.display){case"checkboxes":m=g.Checkbox;break;case"radio":m=g.Radio;break}return new m.View({id:"field-"+h.id,data:j,multiple:h.multiple})},_field_text:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_field_slider:function(h){h.min=h.min||0;h.max=h.max||100000;var i=1;if(h.type=="float"){i=(h.max-h.min)/10000}return new g.Slider.View({id:"field-"+h.id,min:h.min,max:h.max,step:i})},_field_hidden:function(h){return new g.Hidden({id:"field-"+h.id})},_field_boolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-dataset"],function(d,a,g,c,b){var e=Backbone.View.extend({initialize:function(h){this.setElement(this._template(h))},error:function(h){this.$el.find(".ui-table-form-error-text").html(h);this.$el.find(".ui-table-form-error").fadeIn();this.$el.addClass("ui-error")},reset:function(){this.$el.find(".ui-table-form-error").hide();this.$el.removeClass("ui-error")},_template:function(h){var i=$('<div class="ui-table-element"/>');i.append('<div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"></div>');if(h.label){i.append('<div class="ui-table-form-title-strong">'+h.label+"</div>")}i.append(h.$el);if(h.help){i.append('<div class="ui-table-form-info">'+h.help+"</div>")}return i}});var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new a.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(k,h)}},_addConditional:function(h){h.label=h.test_param.label;h.value=h.test_param.value;var j=this._addRow("conditional",h);for(var l in h.cases){var k=h.id+"-section-"+l;var m=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});m.$el.addClass("ui-table-form-section");this.table.add(m.$el);this.table.append(k)}},_addRepeat:function(h){var j=this;var n=0;var m=new c.View({title_new:h.title,max:h.max,onnew:function(){var i=h.id+"-section-"+(n++);var q=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:i,title:h.title,$el:q.$el,ondel:function(){m.del(i);m.retitle(h.title);j.app.refresh()}});m.retitle(h.title);j.app.refresh()}});for(var l=0;l<h.min;l++){var k=h.id+"-section-"+(n++);var p=new f(j.app,{inputs:h.inputs,cls:"ui-table-plain"});m.add({id:k,title:h.title,$el:p.$el})}m.retitle(h.title);var o=new e({label:h.title,help:h.help,$el:m.$el});o.$el.addClass("ui-table-form-section");this.table.add(o.$el);this.table.append(h.id)},_addRow:function(j,h){var l=h.id;var i=null;switch(j){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"conditional":i=this._fieldConditional(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+j+").")}if(h.value!==undefined){i.value(h.value)}this.app.field_list[l]=i;var k=new e({label:h.label,help:h.help,$el:i.$el});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);return this.table.get(l)},_fieldConditional:function(h){var j=this;var k=[];for(var l in h.test_param.options){var m=h.test_param.options[l];k.push({label:m[0],value:m[1]})}return new g.Select.View({id:"field-"+h.id,data:k,onchange:function(u){for(var s in h.cases){var o=h.cases[s];var r=h.id+"-section-"+s;var n=j.table.get(r);var q=false;for(var p in o.inputs){var t=o.inputs[p].type;if(t&&t!=="hidden"){q=true;break}}if(o.value==u&&q){n.fadeIn("fast")}else{n.hide()}}}})},_fieldData:function(h){var i=this;var j=h.id;return new b.View(this.app,{id:"field-"+j,extensions:h.extensions,multiple:h.multiple,onchange:function(o){var n=o.values[0].id;var l=i.app.tree.references(j,"data_column");if(l.length<=0){console.debug("tool-form::field_data() - Data column parameters unavailable.");return}for(var m in l){var k=i.app.field_list[l[m]];k.wait&&k.wait()}i.app.datasets.getDetails(n,function(r){var z=null;if(r){console.debug("tool-form::field_data() - Selected dataset "+n+".");z=r.metadata_column_types;if(!z){console.debug("tool-form::field_data() - FAILED: Could not find metadata for dataset "+n+".")}}else{console.debug("tool-form::field_data() - FAILED: Could not find dataset "+n+".")}for(var t in l){var v=i.app.input_list[l[t]];var w=i.app.field_list[l[t]];if(!v||!w){console.debug("tool-form::field_data() - FAILED: Column not found.")}var s=v.numerical;var q=[];for(var y in z){var x=z[y];var p=(parseInt(y)+1);var u="Text";if(x=="int"||x=="float"){u="Number"}if(x=="int"||x=="float"||!s){q.push({label:"Column: "+p+" ["+u+"]",value:p})}}if(w){w.update(q);if(!w.exists(w.value())){w.value(w.first())}w.show()}}})}})},_fieldSelect:function(h){var j=[];for(var k in h.options){var l=h.options[k];j.push({label:l[0],value:l[1]})}var m=g.Select;switch(h.display){case"checkboxes":m=g.Checkbox;break;case"radio":m=g.Radio;break}return new m.View({id:"field-"+h.id,data:j,multiple:h.multiple})},_fieldText:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_fieldSlider:function(h){h.min=h.min||0;h.max=h.max||100000;var i=1;if(h.type=="float"){i=(h.max-h.min)/10000}return new g.Slider.View({id:"field-"+h.id,min:h.min,max:h.max,step:i})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}}); \ No newline at end of file diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/packed/mvc/ui/ui-slider.js --- a/static/scripts/packed/mvc/ui/ui-slider.js +++ b/static/scripts/packed/mvc/ui/ui-slider.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{value:"",min:1,max:100,step:1},initialize:function(d){var c=this;this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$slider=this.$el.find("#slider");this.$text=this.$el.find("#text");this.$slider.slider(this.options);this.$text.on("change",function(){c.value($(this).val())});this.$text.on("keydown",function(f){var e=f.which;if(!(e==13||e==8||e==37||e==39||e==189||(e>=48&&e<=57)||(c.options.step!=1&&$(this).val().indexOf(".")==-1)&&e==190)){f.preventDefault()}});this.$slider.on("slide",function(e,f){c.value(f.value)})},value:function(c){if(c!==undefined){c=Math.max(Math.min(c,this.options.max),this.options.min);if(this.options.onchange){this.options.onchange(c)}this.$slider.slider("value",c);this.$text.val(c)}return this.$text.val()},_template:function(c){return'<div id="'+c.id+'" class="ui-form-slider"><input id="text" type="text" class="ui-form-slider-text"/><div id="slider" class="ui-form-slider-element"/></div>'}});return{View:b}}); \ No newline at end of file +define(["utils/utils"],function(a){var b=Backbone.View.extend({optionsDefault:{value:"",min:1,max:100,step:1},initialize:function(d){var c=this;this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.$slider=this.$el.find("#slider");this.$text=this.$el.find("#text");this.$slider.slider(this.options);this.$text.on("change",function(){c.value($(this).val())});this.$text.on("keydown",function(f){var e=f.which;console.log(e);if(!(e==8||e==9||e==13||e==37||e==39||e==189||(e>=48&&e<=57)||(c.options.step!=1&&$(this).val().indexOf(".")==-1)&&e==190)){f.preventDefault()}});this.$slider.on("slide",function(e,f){c.value(f.value)})},value:function(c){if(c!==undefined){c=Math.max(Math.min(c,this.options.max),this.options.min);if(this.options.onchange){this.options.onchange(c)}this.$slider.slider("value",c);this.$text.val(c)}return this.$text.val()},_template:function(c){return'<div id="'+c.id+'" class="ui-form-slider"><input id="text" type="text" class="ui-form-slider-text"/><div id="slider" class="ui-form-slider-element"/></div>'}});return{View:b}}); \ No newline at end of file diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 static/scripts/packed/mvc/upload/upload-ftp.js --- a/static/scripts/packed/mvc/upload/upload-ftp.js +++ b/static/scripts/packed/mvc/upload/upload-ftp.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(e){var d=$(this._templateRow(e));$(this.el).find("tbody").append(d);var c="";if(this._find(e)){c=this.options.class_remove}else{c=this.options.class_add}d.find("#upload-ftp-add").addClass(c);var b=this;d.find("#upload-ftp-add").on("click",function(){var f=b._find(e);$(this).removeClass();if(!f){b.app.uploadbox.add([{mode:"ftp",name:e.path,size:e.size,path:e.path}]);$(this).addClass(b.options.class_remove)}else{b.app.collection.remove(f);$(this).addClass(b.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr><td><div id="upload-ftp-add"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.View.extend({options:{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o"},initialize:function(c){this.app=c;var b=this;this.setElement(this._template());a.get({url:galaxy_config.root+"api/ftp_files",success:function(d){b._fill(d)}})},events:{mousedown:function(b){b.preventDefault()}},_fill:function(c){if(c.length>0){this.$el.find("#upload-ftp-content").html($(this._templateTable()));var b=0;for(key in c){this.add(c[key]);b+=c[key].size}this.$el.find("#upload-ftp-number").html(c.length+" files");this.$el.find("#upload-ftp-disk").html(a.bytesToString(b,true))}else{this.$el.find("#upload-ftp-content").html($(this._templateInfo()))}this.$el.find("#upload-ftp-wait").hide()},add:function(f){var d=this;var e=$(this._templateRow(f));var b=e.find(".icon");$(this.el).find("tbody").append(e);var c="";if(this._find(f)){c=this.options.class_remove}else{c=this.options.class_add}b.addClass(c);e.on("click",function(){var g=d._find(f);b.removeClass();if(!g){d.app.uploadbox.add([{mode:"ftp",name:f.path,size:f.size,path:f.path}]);b.addClass(d.options.class_remove)}else{d.app.collection.remove(g);b.addClass(d.options.class_add)}})},_find:function(f){var c=this.app.collection.where({file_path:f.path});var b=null;for(var d in c){var e=c[d];if(e.get("status")=="init"&&e.get("file_mode")=="ftp"){b=e.get("id")}}return b},_templateRow:function(b){return'<tr class="upload-ftp-row" style="cursor: pointer;"><td><div class="icon"/></td><td style="width: 200px"><p style="width: inherit; word-wrap: break-word;">'+b.path+'</p></td><td style="white-space: nowrap;">'+a.bytesToString(b.size)+'</td><td style="white-space: nowrap;">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span id="upload-ftp-number"/> <span class="upload-icon fa fa-hdd-o"/><span id="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody></tbody></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div id="upload-ftp-wait" class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.app.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div id="upload-ftp-content"></div><div>'}})}); \ No newline at end of file diff -r c8ee56c25ce0f9c3c701650b5ddde120d2473c52 -r e7708503e1aacf07dfbbd3fa116de5bd54353b17 templates/webapps/galaxy/tool_form.api.mako --- a/templates/webapps/galaxy/tool_form.api.mako +++ b/templates/webapps/galaxy/tool_form.api.mako @@ -1,5 +1,4 @@ <%inherit file="/base.mako"/> - <% # load tool help tool_help = '' @@ -31,8 +30,8 @@ 'history_id' : trans.security.encode_id( trans.history.id ) } %> -${h.js( "libs/bibtex", "libs/jquery/jquery-ui" )} -${h.css( 'base', 'jquery-ui/smoothness/jquery-ui')} +${h.js("libs/bibtex", "libs/jquery/jquery-ui")} +${h.css('base', 'jquery-ui/smoothness/jquery-ui')} <script> require(['mvc/tools/tools-form'], function(ToolsForm){ $(function(){ @@ -41,10 +40,15 @@ }); </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 +##%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"/> +</div> \ 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