commit/galaxy-central: guerler: ToolForm: Modify refresh cycle
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/23eaf8f01b59/ Changeset: 23eaf8f01b59 User: guerler Date: 2015-02-11 21:06:45+00:00 Summary: ToolForm: Modify refresh cycle Affected #: 10 files diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f client/galaxy/scripts/mvc/tools/tools-form-base.js --- a/client/galaxy/scripts/mvc/tools/tools-form-base.js +++ b/client/galaxy/scripts/mvc/tools/tools-form-base.js @@ -102,15 +102,15 @@ // add refresh listener this.on('refresh', function() { - var new_state = self.tree.finalize(); - if (!_.isEqual(new_state, current_state)) { - // backup current state - current_state = new_state; - - // by using/resetting the deferred ajax queue the number of redundant calls is reduced - self.deferred.reset(); - self.deferred.execute(function(){self._updateModel(current_state)}); - } + // by using/resetting the deferred ajax queue the number of redundant calls is reduced + self.deferred.reset(); + self.deferred.execute(function(){ + var new_state = self.tree.finalize(); + if (!_.isEqual(new_state, current_state)) { + current_state = new_state; + self._updateModel($.extend({}, current_state)); + } + }); }); // add reset listener @@ -119,9 +119,6 @@ this.element_list[i].reset(); } }); - - // refresh - this.trigger('refresh'); }, /** Shows the final message (usually upon successful job submission) diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f 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 @@ -98,25 +98,27 @@ /** Request a new model for an already created tool form and updates the form inputs */ - _updateModel: function() { + _updateModel: function(current_state) { // create the request dictionary var self = this; - var current_state = this.tree.finalize({ - data : function(dict) { - try { - if (dict && dict.values[0].src === 'hda') { - return self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded; - } - } catch (err) { - console.debug('tools-form::_updateModel - Invalid or empty data input value.'); + + // create the request dictionary + var current_state = { + tool_id : this.options.id, + tool_version : this.options.version, + inputs : current_state + } + + // patch data tool parameters + // TODO: This needs to be removed and handled in the api + for (var i in current_state.inputs) { + var dict = current_state.inputs[i]; + try { + if (dict && dict.values[0].src === 'hda') { + current_state.inputs[i] = self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded; } - return null; - } - }); - - // log tool state - console.debug('tools-form::_refreshForm() - Sending current state (see below).'); - console.debug(current_state); + } catch (err) {} + } // activates/disables spinner for dynamic fields to indicate that they are currently being updated function wait(active) { @@ -139,12 +141,16 @@ // register process var process_id = this.deferred.register(); + // log tool state + console.debug('tools-form::_refreshForm() - Sending current state (see below).'); + console.debug(current_state); + // build model url for request - var model_url = galaxy_config.root + 'api/tools/' + this.options.id + '/build?tool_version=' + this.options.version; + var model_url = galaxy_config.root + 'api/tools/' + this.options.id + '/build'; // post job Utils.request({ - type : 'GET', + type : 'POST', url : model_url, data : current_state, success : function(new_model) { @@ -184,12 +190,12 @@ // unset wait mode wait(false); - // process completed - self.deferred.done(process_id); - // log success console.debug('tools-form::_refreshForm() - Received new model (see below).'); console.debug(new_model); + + // process completed + self.deferred.done(process_id); }, error : function(response) { // process completed diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f client/galaxy/scripts/mvc/tools/tools-input.js --- a/client/galaxy/scripts/mvc/tools/tools-input.js +++ b/client/galaxy/scripts/mvc/tools/tools-input.js @@ -77,7 +77,6 @@ this.$field.fadeIn('fast'); this.$title_optional.html(this.text_disable); } else { - this.reset(); this.$field.hide(); this.$title_optional.html(this.text_enable); this.field.value && this.field.value(this.default_value); diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -76,9 +76,11 @@ GET /api/tools/{tool_id}/build Returns a tool model including dynamic parameters and updated values, repeats block etc. """ + if 'payload' in kwd: + kwd = kwd.get('payload') tool_version = kwd.get( 'tool_version', None ) tool = self._get_tool( id, tool_version=tool_version, user=trans.user ) - return tool.to_json(trans, kwd) + return tool.to_json(trans, kwd.get('inputs', kwd)) @_future_expose_api @web.require_admin diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f static/scripts/mvc/tools/tools-form-base.js --- a/static/scripts/mvc/tools/tools-form-base.js +++ b/static/scripts/mvc/tools/tools-form-base.js @@ -102,15 +102,15 @@ // add refresh listener this.on('refresh', function() { - var new_state = self.tree.finalize(); - if (!_.isEqual(new_state, current_state)) { - // backup current state - current_state = new_state; - - // by using/resetting the deferred ajax queue the number of redundant calls is reduced - self.deferred.reset(); - self.deferred.execute(function(){self._updateModel(current_state)}); - } + // by using/resetting the deferred ajax queue the number of redundant calls is reduced + self.deferred.reset(); + self.deferred.execute(function(){ + var new_state = self.tree.finalize(); + if (!_.isEqual(new_state, current_state)) { + current_state = new_state; + self._updateModel($.extend({}, current_state)); + } + }); }); // add reset listener @@ -119,9 +119,6 @@ this.element_list[i].reset(); } }); - - // refresh - this.trigger('refresh'); }, /** Shows the final message (usually upon successful job submission) diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f static/scripts/mvc/tools/tools-form.js --- a/static/scripts/mvc/tools/tools-form.js +++ b/static/scripts/mvc/tools/tools-form.js @@ -98,25 +98,27 @@ /** Request a new model for an already created tool form and updates the form inputs */ - _updateModel: function() { + _updateModel: function(current_state) { // create the request dictionary var self = this; - var current_state = this.tree.finalize({ - data : function(dict) { - try { - if (dict && dict.values[0].src === 'hda') { - return self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded; - } - } catch (err) { - console.debug('tools-form::_updateModel - Invalid or empty data input value.'); + + // create the request dictionary + var current_state = { + tool_id : this.options.id, + tool_version : this.options.version, + inputs : current_state + } + + // patch data tool parameters + // TODO: This needs to be removed and handled in the api + for (var i in current_state.inputs) { + var dict = current_state.inputs[i]; + try { + if (dict && dict.values[0].src === 'hda') { + current_state.inputs[i] = self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded; } - return null; - } - }); - - // log tool state - console.debug('tools-form::_refreshForm() - Sending current state (see below).'); - console.debug(current_state); + } catch (err) {} + } // activates/disables spinner for dynamic fields to indicate that they are currently being updated function wait(active) { @@ -139,12 +141,16 @@ // register process var process_id = this.deferred.register(); + // log tool state + console.debug('tools-form::_refreshForm() - Sending current state (see below).'); + console.debug(current_state); + // build model url for request - var model_url = galaxy_config.root + 'api/tools/' + this.options.id + '/build?tool_version=' + this.options.version; + var model_url = galaxy_config.root + 'api/tools/' + this.options.id + '/build'; // post job Utils.request({ - type : 'GET', + type : 'POST', url : model_url, data : current_state, success : function(new_model) { @@ -184,12 +190,12 @@ // unset wait mode wait(false); - // process completed - self.deferred.done(process_id); - // log success console.debug('tools-form::_refreshForm() - Received new model (see below).'); console.debug(new_model); + + // process completed + self.deferred.done(process_id); }, error : function(response) { // process completed diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f static/scripts/mvc/tools/tools-input.js --- a/static/scripts/mvc/tools/tools-input.js +++ b/static/scripts/mvc/tools/tools-input.js @@ -77,7 +77,6 @@ this.$field.fadeIn('fast'); this.$title_optional.html(this.text_disable); } else { - this.reset(); this.$field.hide(); this.$title_optional.html(this.text_enable); this.field.value && this.field.value(this.default_value); diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f static/scripts/packed/mvc/tools/tools-form-base.js --- a/static/scripts/packed/mvc/tools/tools-form-base.js +++ b/static/scripts/packed/mvc/tools/tools-form-base.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"],function(g,h,f,k,i,a,d,c,e,j,b){return Backbone.View.extend({initialize:function(l){this.optionsDefault={is_dynamic:true,narrow:false,initial_errors:false,cls_portlet:"ui-portlet-limited"};this.options=g.merge(l,this.optionsDefault);console.debug(this.options);var m=parent.Galaxy;if(m&&m.modal){this.modal=m.modal}else{this.modal=new k.Modal.View()}if(m&&m.currUser){this.is_admin=m.currUser.get("is_admin")}else{this.is_admin=false}this.container=this.options.container||"body";this.deferred=new h();this.setElement("<div/>");$(this.container).append(this.$el);this.build(this.options)},build:function(n){var l=this;this.off("refresh");this.off("reset");this.field_list={};this.input_list={};this.element_list={};this.tree=new b(this);this.content=new e(this);l.options.inputs=n&&n.inputs;this._renderForm(n);var m=this.tree.finalize();if(n.initial_errors){this._errors(n)}this.on("refresh",function(){var o=l.tree.finalize();if(!_.isEqual(o,m)){m=o;l.deferred.reset();l.deferred.execute(function(){l._updateModel(m)})}});this.on("reset",function(){for(var o in this.element_list){this.element_list[o].reset()}});this.trigger("refresh")},reciept:function(l){$(this.container).empty();$(this.container).append(l)},highlight:function(m,n,l){var o=this.element_list[m];if(o){o.error(n||"Please verify this parameter.");if(!l){$(this.container).animate({scrollTop:o.$el.offset().top-20},500)}}},_errors:function(n){this.trigger("reset");if(n&&n.errors){var o=this.tree.matchResponse(n.errors);for(var m in this.element_list){var l=this.element_list[m];if(o[m]){this.highlight(m,o[m],true)}}}},_renderForm:function(t){var s=this;this.message=new k.Message();var m=new k.ButtonMenu({icon:"fa-cubes",title:(!t.narrow&&"Versions")||null,tooltip:"Select another tool version"});if(t.versions&&t.versions.length>1){for(var o in t.versions){var q=t.versions[o];if(q!=t.version){m.addMenu({title:"Switch to "+q,version:q,icon:"fa-cube",onclick:function(){s.options.id=s.options.id.replace(s.options.version,this.version);s.options.version=this.version;s.deferred.reset();s.deferred.execute(function(){s._buildModel()})}})}}}else{m.$el.hide()}var p=new k.ButtonMenu({icon:"fa-caret-down",title:(!t.narrow&&"Options")||null,tooltip:"View available options"});if(t.biostar_url){p.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/p/new/post/")}});p.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/t/"+t.id+"/")}})}p.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="+t.id)}});if(this.is_admin){p.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+t.id+"/download"}})}if(t.requirements&&t.requirements.length>0){p.addMenu({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;s.message.update({persistent:true,message:c.requirements(t),status:"info"})}else{this.visible=false;s.message.update({message:""})}}})}if(this.options.sharable_url){p.addMenu({icon:"fa-external-link",title:"See in Tool Shed",tooltip:"Access the repository",onclick:function(){window.open(s.options.sharable_url)}})}this.section=new j.View(s,{inputs:t.inputs});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new f.View({icon:"fa-wrench",title:"<b>"+t.name+"</b> "+t.description+" (Galaxy Tool Version "+t.version+")",cls:this.options.cls_portlet,operations:{menu:p,versions:m},buttons:this.buttons});this.portlet.append(this.message.$el.addClass("ui-margin-top"));this.portlet.append(this.section.$el);this.$el.empty();this.$el.append(this.portlet.$el);if(t.help!=""){this.$el.append(c.help(t.help))}if(t.citations){var r=$("<div/>");var l=new i.ToolCitationCollection();l.tool_id=t.id;var n=new a.CitationListView({el:r,collection:l});n.render();l.fetch();this.$el.append(r)}if(t.message){this.message.update({persistent:true,status:"warning",message:t.message})}console.debug("tools-form-base::initialize() - Completed.")}})}); \ 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"],function(g,h,f,k,i,a,d,c,e,j,b){return Backbone.View.extend({initialize:function(l){this.optionsDefault={is_dynamic:true,narrow:false,initial_errors:false,cls_portlet:"ui-portlet-limited"};this.options=g.merge(l,this.optionsDefault);console.debug(this.options);var m=parent.Galaxy;if(m&&m.modal){this.modal=m.modal}else{this.modal=new k.Modal.View()}if(m&&m.currUser){this.is_admin=m.currUser.get("is_admin")}else{this.is_admin=false}this.container=this.options.container||"body";this.deferred=new h();this.setElement("<div/>");$(this.container).append(this.$el);this.build(this.options)},build:function(n){var l=this;this.off("refresh");this.off("reset");this.field_list={};this.input_list={};this.element_list={};this.tree=new b(this);this.content=new e(this);l.options.inputs=n&&n.inputs;this._renderForm(n);var m=this.tree.finalize();if(n.initial_errors){this._errors(n)}this.on("refresh",function(){l.deferred.reset();l.deferred.execute(function(){var o=l.tree.finalize();if(!_.isEqual(o,m)){m=o;l._updateModel($.extend({},m))}})});this.on("reset",function(){for(var o in this.element_list){this.element_list[o].reset()}})},reciept:function(l){$(this.container).empty();$(this.container).append(l)},highlight:function(m,n,l){var o=this.element_list[m];if(o){o.error(n||"Please verify this parameter.");if(!l){$(this.container).animate({scrollTop:o.$el.offset().top-20},500)}}},_errors:function(n){this.trigger("reset");if(n&&n.errors){var o=this.tree.matchResponse(n.errors);for(var m in this.element_list){var l=this.element_list[m];if(o[m]){this.highlight(m,o[m],true)}}}},_renderForm:function(t){var s=this;this.message=new k.Message();var m=new k.ButtonMenu({icon:"fa-cubes",title:(!t.narrow&&"Versions")||null,tooltip:"Select another tool version"});if(t.versions&&t.versions.length>1){for(var o in t.versions){var q=t.versions[o];if(q!=t.version){m.addMenu({title:"Switch to "+q,version:q,icon:"fa-cube",onclick:function(){s.options.id=s.options.id.replace(s.options.version,this.version);s.options.version=this.version;s.deferred.reset();s.deferred.execute(function(){s._buildModel()})}})}}}else{m.$el.hide()}var p=new k.ButtonMenu({icon:"fa-caret-down",title:(!t.narrow&&"Options")||null,tooltip:"View available options"});if(t.biostar_url){p.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/p/new/post/")}});p.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(t.biostar_url+"/t/"+t.id+"/")}})}p.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="+t.id)}});if(this.is_admin){p.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+t.id+"/download"}})}if(t.requirements&&t.requirements.length>0){p.addMenu({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){if(!this.visible){this.visible=true;s.message.update({persistent:true,message:c.requirements(t),status:"info"})}else{this.visible=false;s.message.update({message:""})}}})}if(this.options.sharable_url){p.addMenu({icon:"fa-external-link",title:"See in Tool Shed",tooltip:"Access the repository",onclick:function(){window.open(s.options.sharable_url)}})}this.section=new j.View(s,{inputs:t.inputs});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new f.View({icon:"fa-wrench",title:"<b>"+t.name+"</b> "+t.description+" (Galaxy Tool Version "+t.version+")",cls:this.options.cls_portlet,operations:{menu:p,versions:m},buttons:this.buttons});this.portlet.append(this.message.$el.addClass("ui-margin-top"));this.portlet.append(this.section.$el);this.$el.empty();this.$el.append(this.portlet.$el);if(t.help!=""){this.$el.append(c.help(t.help))}if(t.citations){var r=$("<div/>");var l=new i.ToolCitationCollection();l.tool_id=t.id;var n=new a.CitationListView({el:r,collection:l});n.render();l.fetch();this.$el.append(r)}if(t.message){this.message.update({persistent:true,status:"warning",message:t.message})}console.debug("tools-form-base::initialize() - Completed.")}})}); \ No newline at end of file diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f 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-misc","mvc/tools/tools-form-base","mvc/tools/tools-jobs"],function(c,e,b,a){var d=b.extend({initialize:function(g){var f=this;this.job_handler=new a(this);this.buttons={execute:new e.Button({icon:"fa-check",tooltip:"Execute: "+g.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){f.job_handler.submit()}})};b.prototype.initialize.call(this,g)},_buildModel:function(){var f=this;var g=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){g+="job_id="+this.options.job_id}else{if(this.options.dataset_id){g+="dataset_id="+this.options.dataset_id}else{g+="tool_version="+this.options.version+"&";var i=top.location.href;var j=i.indexOf("?");if(i.indexOf("tool_id=")!=-1&&j!==-1){g+=i.slice(j+1)}}}var h=this.deferred.register();c.request({type:"GET",url:g,success:function(k){f.build(k);f.message.update({status:"success",message:"Now you are using '"+f.options.name+"' version "+f.options.version+".",persistent:false});f.deferred.done(h);console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(k)},error:function(k){f.deferred.done(h);console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(k);var l=k.error||"Uncaught error.";f.modal.show({title:"Tool cannot be executed",body:l,buttons:{Close:function(){f.modal.hide()}}})}})},_updateModel:function(){var f=this;var g=this.tree.finalize({data:function(l){try{if(l&&l.values[0].src==="hda"){return f.content.get({id:l.values[0].id,src:"hda"}).id_uncoded}}catch(k){console.debug("tools-form::_updateModel - Invalid or empty data input value.")}return null}});console.debug("tools-form::_refreshForm() - Sending current state (see below).");console.debug(g);function j(n){for(var l in f.input_list){var m=f.field_list[l];var k=f.input_list[l];if(k.is_dynamic&&m.wait&&m.unwait){if(n){m.wait()}else{m.unwait()}}}}j(true);var i=this.deferred.register();var h=galaxy_config.root+"api/tools/"+this.options.id+"/build?tool_version="+this.options.version;c.request({type:"GET",url:h,data:g,success:function(k){f.tree.matchModel(k,function(m,q){var l=f.input_list[m];if(l&&l.options){if(!_.isEqual(l.options,q.options)){l.options=q.options;var r=f.field_list[m];if(r.update){var p=[];if((["data","data_collection","drill_down"]).indexOf(l.type)!=-1){p=l.options}else{for(var o in q.options){var n=q.options[o];if(n.length>2){p.push({label:n[0],value:n[1]})}}}r.update(p);r.trigger("change");console.debug("Updating options for "+m)}}}});j(false);f.deferred.done(i);console.debug("tools-form::_refreshForm() - Received new model (see below).");console.debug(k)},error:function(k){f.deferred.done(i);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(k)}})}});return{View:d}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-form-base","mvc/tools/tools-jobs"],function(c,e,b,a){var d=b.extend({initialize:function(g){var f=this;this.job_handler=new a(this);this.buttons={execute:new e.Button({icon:"fa-check",tooltip:"Execute: "+g.name,title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){f.job_handler.submit()}})};b.prototype.initialize.call(this,g)},_buildModel:function(){var f=this;var g=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){g+="job_id="+this.options.job_id}else{if(this.options.dataset_id){g+="dataset_id="+this.options.dataset_id}else{g+="tool_version="+this.options.version+"&";var i=top.location.href;var j=i.indexOf("?");if(i.indexOf("tool_id=")!=-1&&j!==-1){g+=i.slice(j+1)}}}var h=this.deferred.register();c.request({type:"GET",url:g,success:function(k){f.build(k);f.message.update({status:"success",message:"Now you are using '"+f.options.name+"' version "+f.options.version+".",persistent:false});f.deferred.done(h);console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(k)},error:function(k){f.deferred.done(h);console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(k);var l=k.error||"Uncaught error.";f.modal.show({title:"Tool cannot be executed",body:l,buttons:{Close:function(){f.modal.hide()}}})}})},_updateModel:function(g){var f=this;var g={tool_id:this.options.id,tool_version:this.options.version,inputs:g};for(var h in g.inputs){var n=g.inputs[h];try{if(n&&n.values[0].src==="hda"){g.inputs[h]=f.content.get({id:n.values[0].id,src:"hda"}).id_uncoded}}catch(k){}}function m(r){for(var p in f.input_list){var q=f.field_list[p];var o=f.input_list[p];if(o.is_dynamic&&q.wait&&q.unwait){if(r){q.wait()}else{q.unwait()}}}}m(true);var l=this.deferred.register();console.debug("tools-form::_refreshForm() - Sending current state (see below).");console.debug(g);var j=galaxy_config.root+"api/tools/"+this.options.id+"/build";c.request({type:"POST",url:j,data:g,success:function(i){f.tree.matchModel(i,function(p,t){var o=f.input_list[p];if(o&&o.options){if(!_.isEqual(o.options,t.options)){o.options=t.options;var u=f.field_list[p];if(u.update){var s=[];if((["data","data_collection","drill_down"]).indexOf(o.type)!=-1){s=o.options}else{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);u.trigger("change");console.debug("Updating options for "+p)}}}});m(false);console.debug("tools-form::_refreshForm() - Received new model (see below).");console.debug(i);f.deferred.done(l)},error:function(i){f.deferred.done(l);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(i)}})}});return{View:d}}); \ No newline at end of file diff -r 3947a92735506923a0f51abe36263bbc0aecfb79 -r 23eaf8f01b595a908e8b4203249286479a10893f static/scripts/packed/mvc/tools/tools-input.js --- a/static/scripts/packed/mvc/tools/tools-input.js +++ b/static/scripts/packed/mvc/tools/tools-input.js @@ -1,1 +1,1 @@ -define([],function(){return Backbone.View.extend({initialize:function(d,c){this.app=d;this.text_enable=d.options.text_enable||"Enable";this.text_disable=d.options.text_disable||"Disable";this.field=c.field;this.default_value=c.default_value;this.setElement(this._template(c));this.$field=this.$el.find(".ui-table-form-field");this.$title_optional=this.$el.find(".ui-table-form-title-optional");this.$error_text=this.$el.find(".ui-table-form-error-text");this.$error=this.$el.find(".ui-table-form-error");this.$field.prepend(this.field.$el);this.field.skip=false;var b=this.field.value&&this.field.value();this.field.skip=Boolean(c.optional&&(b===null||b==this.default_value||Number(b)==Number(this.default_value)||JSON.stringify(b)==JSON.stringify(this.default_value)));this._refresh();var a=this;this.$title_optional.on("click",function(){a.field.skip=!a.field.skip;a._refresh();a.app.trigger("refresh")})},error:function(a){this.$error_text.html(a);this.$error.show();this.$el.addClass("ui-error")},reset:function(){this.$error.hide();this.$el.removeClass("ui-error")},_refresh:function(){if(!this.field.skip){this.$field.fadeIn("fast");this.$title_optional.html(this.text_disable)}else{this.reset();this.$field.hide();this.$title_optional.html(this.text_enable);this.field.value&&this.field.value(this.default_value)}},_template:function(a){var b='<div class="ui-table-form-element"><div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"/></div><div class="ui-table-form-title-strong">';if(a.optional){b+=a.label+'<span> [<span class="ui-table-form-title-optional"/>]</span>'}else{b+=a.label}b+='</div><div class="ui-table-form-field">';if(a.help){b+='<div class="ui-table-form-info">'+a.help+"</div>"}b+="</div></div>";return b}})}); \ No newline at end of file +define([],function(){return Backbone.View.extend({initialize:function(d,c){this.app=d;this.text_enable=d.options.text_enable||"Enable";this.text_disable=d.options.text_disable||"Disable";this.field=c.field;this.default_value=c.default_value;this.setElement(this._template(c));this.$field=this.$el.find(".ui-table-form-field");this.$title_optional=this.$el.find(".ui-table-form-title-optional");this.$error_text=this.$el.find(".ui-table-form-error-text");this.$error=this.$el.find(".ui-table-form-error");this.$field.prepend(this.field.$el);this.field.skip=false;var b=this.field.value&&this.field.value();this.field.skip=Boolean(c.optional&&(b===null||b==this.default_value||Number(b)==Number(this.default_value)||JSON.stringify(b)==JSON.stringify(this.default_value)));this._refresh();var a=this;this.$title_optional.on("click",function(){a.field.skip=!a.field.skip;a._refresh();a.app.trigger("refresh")})},error:function(a){this.$error_text.html(a);this.$error.show();this.$el.addClass("ui-error")},reset:function(){this.$error.hide();this.$el.removeClass("ui-error")},_refresh:function(){if(!this.field.skip){this.$field.fadeIn("fast");this.$title_optional.html(this.text_disable)}else{this.$field.hide();this.$title_optional.html(this.text_enable);this.field.value&&this.field.value(this.default_value)}},_template:function(a){var b='<div class="ui-table-form-element"><div class="ui-table-form-error ui-error"><span class="fa fa-arrow-down"/><span class="ui-table-form-error-text"/></div><div class="ui-table-form-title-strong">';if(a.optional){b+=a.label+'<span> [<span class="ui-table-form-title-optional"/>]</span>'}else{b+=a.label}b+='</div><div class="ui-table-form-field">';if(a.help){b+='<div class="ui-table-form-info">'+a.help+"</div>"}b+="</div></div>";return 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