1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/08d0cdb2a351/ Changeset: 08d0cdb2a351 User: guerler Date: 2014-10-30 18:17:51+00:00 Summary: ToolForm: Reduce number of refreshing events Affected #: 6 files diff -r 713526cf328d41f0248ce85860e1d33db779482f -r 08d0cdb2a3514cf3c1782e1195d2b85a4dbffa17 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 @@ -64,18 +64,55 @@ } }, - // refresh + // rebuild underlying data structure representation for the tool form + // this happens i.e. when repeat blocks are added or removed and on initialization + rebuild: function() { + this.tree.refresh(); + console.debug('tools-form::refresh() - Refreshed form structure.'); + }, + + // refreshes input states i.e. for dynamic parameters refresh: function() { - // recreate tree structure - this.tree.refresh(); + // link this + var self = this; - // trigger change - for (var id in this.field_list) { - this.field_list[id].trigger('change'); + // only refresh the state if the form contains dynamic parameters + if (!this.is_dynamic) { + return; } - // log - console.debug('tools-form::refresh() - Recreated data structure. Refresh.'); + // finalize data + var current_state = this.tree.finalize({ + data : function(dict) { + if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') { + return self.content.get({id: dict.values[0].id}).dataset_id; + } + return null; + } + }); + + // log tool state + console.debug('tools-form::_refreshForm() - Refreshing states.'); + console.debug(current_state); + + // post job + Utils.request({ + type : 'GET', + url : galaxy_config.root + 'api/tools/' + this.options.id + '/build', + data : current_state, + success : function(response) { + // rebuild form + self._rebuildForm(response); + + // log success + console.debug('tools-form::_refreshForm() - States refreshed.'); + console.debug(response); + }, + error : function(response) { + console.debug('tools-form::_refreshForm() - Refresh request failed.'); + console.debug(response); + } + }); }, // build tool model through api call @@ -123,50 +160,6 @@ }); }, - // refresh form data - rebuild: function() { - // link this - var self = this; - - // only refresh the state if the form contains dynamic parameters - if (!this.is_dynamic) { - return; - } - - // finalize data - var current_state = this.tree.finalize({ - data : function(dict) { - if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') { - return self.content.get({id: dict.values[0].id}).dataset_id; - } - return null; - } - }); - - // log tool state - console.debug('tools-form::_refreshForm() - Refreshing states.'); - console.debug(current_state); - - // post job - Utils.request({ - type : 'GET', - url : galaxy_config.root + 'api/tools/' + this.options.id + '/build', - data : current_state, - success : function(response) { - // rebuild form - self._rebuildForm(response); - - // log success - console.debug('tools-form::_refreshForm() - States refreshed.'); - console.debug(response); - }, - error : function(response) { - console.debug('tools-form::_refreshForm() - Refresh request failed.'); - console.debug(response); - } - }); - }, - // rebuild the form elements _rebuildForm: function(new_model) { var self = this; @@ -177,7 +170,7 @@ // backup new options input.options = node.options; - // get/update field (currently only done for select fields) + // get/update field var field = self.field_list[input_id]; if (field.update && input.type != 'data') { var new_options = []; @@ -296,7 +289,6 @@ cls : 'btn btn-primary', floating : 'clear', onclick : function() { - //self.rebuild(); self.job_handler.submit(); } }) @@ -328,8 +320,8 @@ // append tool section this.portlet.append(this.section.$el); - // trigger refresh - this.refresh(); + // rebuild the underlying data structure + this.rebuild(); } }); diff -r 713526cf328d41f0248ce85860e1d33db779482f -r 08d0cdb2a3514cf3c1782e1195d2b85a4dbffa17 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 @@ -131,6 +131,7 @@ repeat.retitle(input_def.title); // trigger refresh + self.app.rebuild(); self.app.refresh(); } } @@ -164,6 +165,7 @@ create(input_def.inputs, true); // trigger refresh + self.app.rebuild(); self.app.refresh(); } }); @@ -366,6 +368,9 @@ section_row.hide(); } } + + // refresh form inputs + self.app.refresh(); } }); }, @@ -378,8 +383,8 @@ id : 'field-' + input_def.id, extensions : input_def.extensions, multiple : input_def.multiple, - onchange : function(dict) { - self.app.rebuild(); + onchange : function() { + self.app.refresh(); } }); }, @@ -415,7 +420,7 @@ data : options, multiple: input_def.multiple, onchange: function() { - self.app.rebuild(); + self.app.refresh(); } }); }, diff -r 713526cf328d41f0248ce85860e1d33db779482f -r 08d0cdb2a3514cf3c1782e1195d2b85a4dbffa17 static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -64,18 +64,55 @@ } }, - // refresh + // rebuild underlying data structure representation for the tool form + // this happens i.e. when repeat blocks are added or removed and on initialization + rebuild: function() { + this.tree.refresh(); + console.debug('tools-form::refresh() - Refreshed form structure.'); + }, + + // refreshes input states i.e. for dynamic parameters refresh: function() { - // recreate tree structure - this.tree.refresh(); + // link this + var self = this; - // trigger change - for (var id in this.field_list) { - this.field_list[id].trigger('change'); + // only refresh the state if the form contains dynamic parameters + if (!this.is_dynamic) { + return; } - // log - console.debug('tools-form::refresh() - Recreated data structure. Refresh.'); + // finalize data + var current_state = this.tree.finalize({ + data : function(dict) { + if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') { + return self.content.get({id: dict.values[0].id}).dataset_id; + } + return null; + } + }); + + // log tool state + console.debug('tools-form::_refreshForm() - Refreshing states.'); + console.debug(current_state); + + // post job + Utils.request({ + type : 'GET', + url : galaxy_config.root + 'api/tools/' + this.options.id + '/build', + data : current_state, + success : function(response) { + // rebuild form + self._rebuildForm(response); + + // log success + console.debug('tools-form::_refreshForm() - States refreshed.'); + console.debug(response); + }, + error : function(response) { + console.debug('tools-form::_refreshForm() - Refresh request failed.'); + console.debug(response); + } + }); }, // build tool model through api call @@ -123,50 +160,6 @@ }); }, - // refresh form data - rebuild: function() { - // link this - var self = this; - - // only refresh the state if the form contains dynamic parameters - if (!this.is_dynamic) { - return; - } - - // finalize data - var current_state = this.tree.finalize({ - data : function(dict) { - if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') { - return self.content.get({id: dict.values[0].id}).dataset_id; - } - return null; - } - }); - - // log tool state - console.debug('tools-form::_refreshForm() - Refreshing states.'); - console.debug(current_state); - - // post job - Utils.request({ - type : 'GET', - url : galaxy_config.root + 'api/tools/' + this.options.id + '/build', - data : current_state, - success : function(response) { - // rebuild form - self._rebuildForm(response); - - // log success - console.debug('tools-form::_refreshForm() - States refreshed.'); - console.debug(response); - }, - error : function(response) { - console.debug('tools-form::_refreshForm() - Refresh request failed.'); - console.debug(response); - } - }); - }, - // rebuild the form elements _rebuildForm: function(new_model) { var self = this; @@ -177,7 +170,7 @@ // backup new options input.options = node.options; - // get/update field (currently only done for select fields) + // get/update field var field = self.field_list[input_id]; if (field.update && input.type != 'data') { var new_options = []; @@ -296,7 +289,6 @@ cls : 'btn btn-primary', floating : 'clear', onclick : function() { - //self.rebuild(); self.job_handler.submit(); } }) @@ -328,8 +320,8 @@ // append tool section this.portlet.append(this.section.$el); - // trigger refresh - this.refresh(); + // rebuild the underlying data structure + this.rebuild(); } }); diff -r 713526cf328d41f0248ce85860e1d33db779482f -r 08d0cdb2a3514cf3c1782e1195d2b85a4dbffa17 static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -131,6 +131,7 @@ repeat.retitle(input_def.title); // trigger refresh + self.app.rebuild(); self.app.refresh(); } } @@ -164,6 +165,7 @@ create(input_def.inputs, true); // trigger refresh + self.app.rebuild(); self.app.refresh(); } }); @@ -366,6 +368,9 @@ section_row.hide(); } } + + // refresh form inputs + self.app.refresh(); } }); }, @@ -378,8 +383,8 @@ id : 'field-' + input_def.id, extensions : input_def.extensions, multiple : input_def.multiple, - onchange : function(dict) { - self.app.rebuild(); + onchange : function() { + self.app.refresh(); } }); }, @@ -415,7 +420,7 @@ data : options, multiple: input_def.multiple, onchange: function() { - self.app.rebuild(); + self.app.refresh(); } }); }, diff -r 713526cf328d41f0248ce85860e1d33db779482f -r 08d0cdb2a3514cf3c1782e1195d2b85a4dbffa17 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","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,h,l,j,a,e,d,f,k,c,g){var b=Backbone.View.extend({container:"body",initialize:function(n){console.debug(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.tree=new c(this);this.job_handler=new g(this);this.content=new f({history_id:m.options.history_id,success:function(){m._buildForm(m.options)}})},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.")},_buildModel:function(){var m=this;var n=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){n+="job_id="+this.options.job_id}else{if(this.options.dataset_id){n+="dataset_id="+this.options.dataset_id}else{var o=top.location.href;var p=o.indexOf("?");if(o.indexOf("tool_id=")!=-1&&p!==-1){n+=o.slice(p+1)}}}i.request({type:"GET",url:n,success:function(q){m.options=$.extend(m.options,q);m.model=q;m.inputs=q.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(q);m._buildForm()},error:function(q){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(q)}})},rebuild:function(){var m=this;if(!this.is_dynamic){return}var n=this.tree.finalize({data:function(o){if(o.values.length>0&&o.values[0]&&o.values[0].src==="hda"){return m.content.get({id:o.values[0].id}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(n);i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:n,success:function(o){m._rebuildForm(o);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(o)},error:function(o){console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(o)}})},_rebuildForm:function(m){var n=this;this.tree.matchModel(m,function(p,t){var o=n.input_list[p];if(o&&o.options){if(JSON.stringify(o.options)!=JSON.stringify(t.options)){o.options=t.options;var u=n.field_list[p];if(u.update&&o.type!="data"){var s=[];for(var r in t.options){var q=t.options[r];if(q.length>2){s.push({label:q[0],value:q[1]})}}u.update(s);console.debug("Updating options for "+p)}}}})},_buildForm:function(o){var n=this;this.field_list={};this.input_list={};this.element_list={};this.model=o;this.inputs=o.inputs;var q=new l.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(o.biostar_url){q.addMenu({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/")}});q.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/t/"+n.options.id+"/")}})}q.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="+n.options.id)}});if(Galaxy.currUser.get("is_admin")){q.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+n.options.id+"/download"}})}this.section=new k.View(n,{inputs:this.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>"+this.model.name+"</b> "+this.model.description,operations:{menu:q},buttons:{execute:new l.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){n.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(o.help!=""){this.$el.append(d.help(o.help))}if(o.citations){var m=new j.ToolCitationCollection();m.tool_id=o.id;var p=new a.CitationListView({collection:m});p.render();m.fetch();this.$el.append(p.$el)}this.portlet.append(this.section.$el);this.refresh()}});return{View:b}}); \ No newline at end of file +define(["utils/utils","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,h,l,j,a,e,d,f,k,c,g){var b=Backbone.View.extend({container:"body",initialize:function(n){console.debug(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.tree=new c(this);this.job_handler=new g(this);this.content=new f({history_id:m.options.history_id,success:function(){m._buildForm(m.options)}})},message:function(m){$(this.container).empty();$(this.container).append(m)},reset:function(){for(var m in this.element_list){this.element_list[m].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::refresh() - Refreshed form structure.")},refresh:function(){var m=this;if(!this.is_dynamic){return}var n=this.tree.finalize({data:function(o){if(o.values.length>0&&o.values[0]&&o.values[0].src==="hda"){return m.content.get({id:o.values[0].id}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(n);i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:n,success:function(o){m._rebuildForm(o);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(o)},error:function(o){console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(o)}})},_buildModel:function(){var m=this;var n=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){n+="job_id="+this.options.job_id}else{if(this.options.dataset_id){n+="dataset_id="+this.options.dataset_id}else{var o=top.location.href;var p=o.indexOf("?");if(o.indexOf("tool_id=")!=-1&&p!==-1){n+=o.slice(p+1)}}}i.request({type:"GET",url:n,success:function(q){m.options=$.extend(m.options,q);m.model=q;m.inputs=q.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(q);m._buildForm()},error:function(q){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(q)}})},_rebuildForm:function(m){var n=this;this.tree.matchModel(m,function(p,t){var o=n.input_list[p];if(o&&o.options){if(JSON.stringify(o.options)!=JSON.stringify(t.options)){o.options=t.options;var u=n.field_list[p];if(u.update&&o.type!="data"){var s=[];for(var r in t.options){var q=t.options[r];if(q.length>2){s.push({label:q[0],value:q[1]})}}u.update(s);console.debug("Updating options for "+p)}}}})},_buildForm:function(o){var n=this;this.field_list={};this.input_list={};this.element_list={};this.model=o;this.inputs=o.inputs;var q=new l.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(o.biostar_url){q.addMenu({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/")}});q.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(n.options.biostar_url+"/t/"+n.options.id+"/")}})}q.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="+n.options.id)}});if(Galaxy.currUser.get("is_admin")){q.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+n.options.id+"/download"}})}this.section=new k.View(n,{inputs:this.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>"+this.model.name+"</b> "+this.model.description,operations:{menu:q},buttons:{execute:new l.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){n.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(o.help!=""){this.$el.append(d.help(o.help))}if(o.citations){var m=new j.ToolCitationCollection();m.tool_id=o.id;var p=new a.CitationListView({collection:m});p.render();m.fetch();this.$el.append(p.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}}); \ No newline at end of file diff -r 713526cf328d41f0248ce85860e1d33db779482f -r 08d0cdb2a3514cf3c1782e1195d2b85a4dbffa17 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-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.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=j.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(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e({label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.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.is_dynamic){this.app.is_dynamic=true}if(h.value!==undefined){i.value(h.value)}this.app.field_list[l]=i;var k=new e({label:h.label,optional:h.optional,help:h.help,field:i});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;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,onchange:function(j){i.app.rebuild()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.rebuild()}})},_fieldText:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_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 +define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.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=j.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(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e({label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.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.is_dynamic){this.app.is_dynamic=true}if(h.value!==undefined){i.value(h.value)}this.app.field_list[l]=i;var k=new e({label:h.label,optional:h.optional,help:h.help,field:i});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()}}j.app.refresh()}})},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){return new g.Input({id:"field-"+h.id,area:h.area})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_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 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.