commit/galaxy-central: guerler: Workflow: Revise action form
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e0441a0f8530/ Changeset: e0441a0f8530 User: guerler Date: 2015-01-29 15:56:15+00:00 Summary: Workflow: Revise action form Affected #: 9 files diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 client/galaxy/scripts/mvc/tools/tools-form-workflow.js --- a/client/galaxy/scripts/mvc/tools/tools-form-workflow.js +++ b/client/galaxy/scripts/mvc/tools/tools-form-workflow.js @@ -9,27 +9,29 @@ initialize: function(options) { // link with node representation in workflow module this.node = workflow.active_node; - if (!this.node) { console.debug('FAILED - tools-form-workflow:initialize() - Node not found in workflow.'); return; } - + + // link actions + this.post_job_actions = this.node.post_job_actions || {}; + // initialize parameters this.options = options; - + // set labels this.options.text_enable = 'In Advance'; this.options.text_disable = 'At Runtime'; this.options.use_defaults = true; - + // declare fields as optional Utils.deepeach(options.inputs, function(item) { if (item.type) { item.optional = (['data', 'data_hidden', 'hidden', 'drill_down', 'repeat', 'conditional']).indexOf(item.type) == -1; } }); - + // declare conditional fields as not optional Utils.deepeach(options.inputs, function(item) { if (item.type) { @@ -51,32 +53,53 @@ } }); }, - + /** Builds all sub sections */ _makeSections: function(inputs){ // for annotation inputs[Utils.uuid()] = { - label : 'Edit Step Attributes', - type : 'section', - expand : this.node.annotation, - inputs : [{ - label : 'Annotation / Notes', - name : 'annotation', - type : 'text', - area : true, - help : 'Add an annotation or notes to this step; annotations are available when a workflow is viewed.', - value : this.node.annotation - }] + label : 'Annotation / Notes', + name : 'annotation', + type : 'text', + area : true, + help : 'Add an annotation or note for this step. It will be shown with the workflow.', + value : this.node.annotation } - - // for actions - this.post_job_actions = this.node.post_job_actions; - for (var i in this.node.output_terminals) { - inputs[Utils.uuid()] = this._makeSection(i); + + // get first output id + var output_id = this.node.output_terminals && Object.keys(this.node.output_terminals)[0]; + if (output_id) { + // send email on job completion + inputs[Utils.uuid()] = { + name : 'pja__' + output_id + '__EmailAction', + label : 'Email notification', + type : 'boolean', + value : String(Boolean(this.post_job_actions['EmailAction' + output_id])), + ignore : 'false', + help : 'An email notification will be send when the job has completed.', + payload : { + 'host' : window.location.host + } + }; + + // delete non-output files + inputs[Utils.uuid()] = { + name : 'pja__' + output_id + '__DeleteIntermediatesAction', + label : 'Output cleanup', + type : 'boolean', + value : String(Boolean(this.post_job_actions['DeleteIntermediatesAction' + output_id])), + ignore : 'false', + help : 'Delete intermediate outputs if they are not used as input for another job.' + }; + + // add output specific actions + for (var i in this.node.output_terminals) { + inputs[Utils.uuid()] = this._makeSection(i); + } } }, - + /** Builds sub section with step actions/annotation */ _makeSection: function(output_id){ @@ -88,12 +111,12 @@ 1 : this.datatypes[key] }); } - + // sort extensions extensions.sort(function(a, b) { return a.label > b.label ? 1 : a.label < b.label ? -1 : 0; }); - + // add additional options extensions.unshift({ 0 : 'Sequences', @@ -105,12 +128,12 @@ }); extensions.unshift({ 0 : 'Leave unchanged', - 1 : 'None' + 1 : '' }); - + // create custom sub section var input_config = { - label : 'Edit Step Action: \'' + output_id + '\'', + label : 'Add Actions: \'' + output_id + '\'', type : 'section', inputs : [{ action : 'RenameDatasetAction', @@ -125,7 +148,7 @@ argument : 'newtype', label : 'Change datatype', type : 'select', - ignore : 'None', + ignore : '', options : extensions, help : 'This action will change the datatype of the output to the indicated value.' },{ @@ -143,59 +166,42 @@ action : 'ColumnSetAction', argument : 'chromCol', label : 'Chrom column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'startCol', label : 'Start column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'endCol', label : 'End column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'strandCol', label : 'Strand column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'nameCol', label : 'Name column', - type : 'text', + type : 'integer', value : '', ignore : '' }], help : 'This action will set column assignments in the output dataset. Blank fields are ignored.' - },{ - action : 'EmailAction', - label : 'Email notification', - type : 'boolean', - value : 'false', - ignore : 'false', - help : 'This action will send an email notifying you when the job is done.', - payload : { - 'host' : window.location.host - } - },{ - action : 'DeleteIntermediatesAction', - label : 'Delete non-outputs', - type : 'boolean', - value : 'false', - ignore : 'false', - help : 'All non-output steps of this workflow will have datasets deleted if they are no longer being used as job inputs when the job this action is attached to is finished. You *must* be using workflow outputs (the snowflake) in your workflow for this to have any effect.' }] }; - + // visit input nodes and enrich by name/value pairs from server data var self = this; function visit (head, head_list) { @@ -209,7 +215,7 @@ if (input.argument) { input.name += '__' + input.argument; } - + // modify names of payload arguments if (input.payload) { for (var p_id in input.payload) { @@ -218,7 +224,7 @@ delete p; } } - + // access/verify existence of value var d = self.post_job_actions[input.action + output_id]; if (d) { @@ -242,11 +248,11 @@ } } visit(input_config); - + // return final configuration return input_config; }, - + /** Builds a new model through api call and recreates the entire form */ _buildModel: function() { @@ -260,24 +266,24 @@ } }); }, - + /** Request a new model for an already created tool form and updates the form inputs */ _updateModel: function() { // create the request dictionary var self = this; var current_state = this.tree.finalize(); - + // log tool state console.debug('tools-form-workflow::_refreshForm() - Refreshing states.'); console.debug(current_state); - + // register process var process_id = this.deferred.register(); // build model url for request var model_url = galaxy_config.root + 'workflow/editor_form_post?tool_id=' + this.options.id + '&__is_dynamic__=False'; - + // post job Utils.request({ type : 'GET', diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 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 @@ -275,6 +275,7 @@ } }); portlet.append(sub_section.$el); + portlet.append($('<div/>').addClass('ui-table-form-info').html(input_def.help)); // add event handler visibility button var visible = false; diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 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 @@ -54,7 +54,7 @@ } // add text field event - this.$text.on('change', function () { + this.$text.on('input', function () { self.value($(this).val()); }); diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 static/scripts/mvc/tools/tools-form-workflow.js --- a/static/scripts/mvc/tools/tools-form-workflow.js +++ b/static/scripts/mvc/tools/tools-form-workflow.js @@ -9,27 +9,29 @@ initialize: function(options) { // link with node representation in workflow module this.node = workflow.active_node; - if (!this.node) { console.debug('FAILED - tools-form-workflow:initialize() - Node not found in workflow.'); return; } - + + // link actions + this.post_job_actions = this.node.post_job_actions || {}; + // initialize parameters this.options = options; - + // set labels this.options.text_enable = 'In Advance'; this.options.text_disable = 'At Runtime'; this.options.use_defaults = true; - + // declare fields as optional Utils.deepeach(options.inputs, function(item) { if (item.type) { item.optional = (['data', 'data_hidden', 'hidden', 'drill_down', 'repeat', 'conditional']).indexOf(item.type) == -1; } }); - + // declare conditional fields as not optional Utils.deepeach(options.inputs, function(item) { if (item.type) { @@ -51,32 +53,53 @@ } }); }, - + /** Builds all sub sections */ _makeSections: function(inputs){ // for annotation inputs[Utils.uuid()] = { - label : 'Edit Step Attributes', - type : 'section', - expand : this.node.annotation, - inputs : [{ - label : 'Annotation / Notes', - name : 'annotation', - type : 'text', - area : true, - help : 'Add an annotation or notes to this step; annotations are available when a workflow is viewed.', - value : this.node.annotation - }] + label : 'Annotation / Notes', + name : 'annotation', + type : 'text', + area : true, + help : 'Add an annotation or note for this step. It will be shown with the workflow.', + value : this.node.annotation } - - // for actions - this.post_job_actions = this.node.post_job_actions; - for (var i in this.node.output_terminals) { - inputs[Utils.uuid()] = this._makeSection(i); + + // get first output id + var output_id = this.node.output_terminals && Object.keys(this.node.output_terminals)[0]; + if (output_id) { + // send email on job completion + inputs[Utils.uuid()] = { + name : 'pja__' + output_id + '__EmailAction', + label : 'Email notification', + type : 'boolean', + value : String(Boolean(this.post_job_actions['EmailAction' + output_id])), + ignore : 'false', + help : 'An email notification will be send when the job has completed.', + payload : { + 'host' : window.location.host + } + }; + + // delete non-output files + inputs[Utils.uuid()] = { + name : 'pja__' + output_id + '__DeleteIntermediatesAction', + label : 'Output cleanup', + type : 'boolean', + value : String(Boolean(this.post_job_actions['DeleteIntermediatesAction' + output_id])), + ignore : 'false', + help : 'Delete intermediate outputs if they are not used as input for another job.' + }; + + // add output specific actions + for (var i in this.node.output_terminals) { + inputs[Utils.uuid()] = this._makeSection(i); + } } }, - + /** Builds sub section with step actions/annotation */ _makeSection: function(output_id){ @@ -88,12 +111,12 @@ 1 : this.datatypes[key] }); } - + // sort extensions extensions.sort(function(a, b) { return a.label > b.label ? 1 : a.label < b.label ? -1 : 0; }); - + // add additional options extensions.unshift({ 0 : 'Sequences', @@ -105,12 +128,12 @@ }); extensions.unshift({ 0 : 'Leave unchanged', - 1 : 'None' + 1 : '' }); - + // create custom sub section var input_config = { - label : 'Edit Step Action: \'' + output_id + '\'', + label : 'Add Actions: \'' + output_id + '\'', type : 'section', inputs : [{ action : 'RenameDatasetAction', @@ -125,7 +148,7 @@ argument : 'newtype', label : 'Change datatype', type : 'select', - ignore : 'None', + ignore : '', options : extensions, help : 'This action will change the datatype of the output to the indicated value.' },{ @@ -143,59 +166,42 @@ action : 'ColumnSetAction', argument : 'chromCol', label : 'Chrom column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'startCol', label : 'Start column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'endCol', label : 'End column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'strandCol', label : 'Strand column', - type : 'text', + type : 'integer', value : '', ignore : '' },{ action : 'ColumnSetAction', argument : 'nameCol', label : 'Name column', - type : 'text', + type : 'integer', value : '', ignore : '' }], help : 'This action will set column assignments in the output dataset. Blank fields are ignored.' - },{ - action : 'EmailAction', - label : 'Email notification', - type : 'boolean', - value : 'false', - ignore : 'false', - help : 'This action will send an email notifying you when the job is done.', - payload : { - 'host' : window.location.host - } - },{ - action : 'DeleteIntermediatesAction', - label : 'Delete non-outputs', - type : 'boolean', - value : 'false', - ignore : 'false', - help : 'All non-output steps of this workflow will have datasets deleted if they are no longer being used as job inputs when the job this action is attached to is finished. You *must* be using workflow outputs (the snowflake) in your workflow for this to have any effect.' }] }; - + // visit input nodes and enrich by name/value pairs from server data var self = this; function visit (head, head_list) { @@ -209,7 +215,7 @@ if (input.argument) { input.name += '__' + input.argument; } - + // modify names of payload arguments if (input.payload) { for (var p_id in input.payload) { @@ -218,7 +224,7 @@ delete p; } } - + // access/verify existence of value var d = self.post_job_actions[input.action + output_id]; if (d) { @@ -242,11 +248,11 @@ } } visit(input_config); - + // return final configuration return input_config; }, - + /** Builds a new model through api call and recreates the entire form */ _buildModel: function() { @@ -260,24 +266,24 @@ } }); }, - + /** Request a new model for an already created tool form and updates the form inputs */ _updateModel: function() { // create the request dictionary var self = this; var current_state = this.tree.finalize(); - + // log tool state console.debug('tools-form-workflow::_refreshForm() - Refreshing states.'); console.debug(current_state); - + // register process var process_id = this.deferred.register(); // build model url for request var model_url = galaxy_config.root + 'workflow/editor_form_post?tool_id=' + this.options.id + '&__is_dynamic__=False'; - + // post job Utils.request({ type : 'GET', diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 static/scripts/mvc/tools/tools-section.js --- a/static/scripts/mvc/tools/tools-section.js +++ b/static/scripts/mvc/tools/tools-section.js @@ -275,6 +275,7 @@ } }); portlet.append(sub_section.$el); + portlet.append($('<div/>').addClass('ui-table-form-info').html(input_def.help)); // add event handler visibility button var visible = false; diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 static/scripts/mvc/ui/ui-slider.js --- a/static/scripts/mvc/ui/ui-slider.js +++ b/static/scripts/mvc/ui/ui-slider.js @@ -54,7 +54,7 @@ } // add text field event - this.$text.on('change', function () { + this.$text.on('input', function () { self.value($(this).val()); }); diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 static/scripts/packed/mvc/tools/tools-form-workflow.js --- a/static/scripts/packed/mvc/tools/tools-form-workflow.js +++ b/static/scripts/packed/mvc/tools/tools-form-workflow.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/tools/tools-form-base"],function(b,a){var c=a.extend({initialize:function(e){this.node=workflow.active_node;if(!this.node){console.debug("FAILED - tools-form-workflow:initialize() - Node not found in workflow.");return}this.options=e;this.options.text_enable="In Advance";this.options.text_disable="At Runtime";this.options.use_defaults=true;b.deepeach(e.inputs,function(f){if(f.type){f.optional=(["data","data_hidden","hidden","drill_down","repeat","conditional"]).indexOf(f.type)==-1}});b.deepeach(e.inputs,function(f){if(f.type){if(f.type=="conditional"){f.test_param.optional=false}}});var d=this;b.get({url:galaxy_config.root+"api/datatypes",cache:true,success:function(f){d.datatypes=f;d._makeSections(e.inputs);a.prototype.initialize.call(d,e)}})},_makeSections:function(d){d[b.uuid()]={label:"Edit Step Attributes",type:"section",expand:this.node.annotation,inputs:[{label:"Annotation / Notes",name:"annotation",type:"text",area:true,help:"Add an annotation or notes to this step; annotations are available when a workflow is viewed.",value:this.node.annotation}]};this.post_job_actions=this.node.post_job_actions;for(var e in this.node.output_terminals){d[b.uuid()]=this._makeSection(e)}},_makeSection:function(h){var g=[];for(key in this.datatypes){g.push({0:this.datatypes[key],1:this.datatypes[key]})}g.sort(function(j,i){return j.label>i.label?1:j.label<i.label?-1:0});g.unshift({0:"Sequences",1:"Sequences"});g.unshift({0:"Roadmaps",1:"Roadmaps"});g.unshift({0:"Leave unchanged",1:"None"});var f={label:"Edit Step Action: '"+h+"'",type:"section",inputs:[{action:"RenameDatasetAction",argument:"newname",label:"Rename dataset",type:"text",value:"",ignore:"",help:'This action will rename the result dataset. Click <a href="https://wiki.galaxyproject.org/Learn/AdvancedWorkflow/Variables">here</a> for more information.'},{action:"ChangeDatatypeAction",argument:"newtype",label:"Change datatype",type:"select",ignore:"None",options:g,help:"This action will change the datatype of the output to the indicated value."},{action:"TagDatasetAction",argument:"tags",label:"Tags",type:"text",value:"",ignore:"",help:"This action will set tags for the dataset."},{label:"Assign columns",type:"section",inputs:[{action:"ColumnSetAction",argument:"chromCol",label:"Chrom column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"startCol",label:"Start column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"endCol",label:"End column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"strandCol",label:"Strand column",type:"text",value:"",ignore:""},{action:"ColumnSetAction",argument:"nameCol",label:"Name column",type:"text",value:"",ignore:""}],help:"This action will set column assignments in the output dataset. Blank fields are ignored."},{action:"EmailAction",label:"Email notification",type:"boolean",value:"false",ignore:"false",help:"This action will send an email notifying you when the job is done.",payload:{host:window.location.host}},{action:"DeleteIntermediatesAction",label:"Delete non-outputs",type:"boolean",value:"false",ignore:"false",help:"All non-output steps of this workflow will have datasets deleted if they are no longer being used as job inputs when the job this action is attached to is finished. You *must* be using workflow outputs (the snowflake) in your workflow for this to have any effect."}]};var d=this;function e(n,o){o=o||[];o.push(n);for(var m in n.inputs){var k=n.inputs[m];if(k.action){k.name="pja__"+h+"__"+k.action;if(k.argument){k.name+="__"+k.argument}if(k.payload){for(var s in k.payload){var q=k.payload[s];k.payload[k.name+"__"+s]=q;delete q}}var r=d.post_job_actions[k.action+h];if(r){for(var l in o){o[l].expand=true}if(k.argument){k.value=r.action_arguments&&r.action_arguments[k.argument]||k.value}else{k.value="true"}}}if(k.inputs){e(k,o.slice(0))}}}e(f);return f},_buildModel:function(){Galaxy.modal.show({title:"Coming soon...",body:"This feature has not been implemented yet.",buttons:{Close:function(){Galaxy.modal.hide()}}})},_updateModel:function(){var d=this;var e=this.tree.finalize();console.debug("tools-form-workflow::_refreshForm() - Refreshing states.");console.debug(e);var g=this.deferred.register();var f=galaxy_config.root+"workflow/editor_form_post?tool_id="+this.options.id+"&__is_dynamic__=False";b.request({type:"GET",url:f,data:e,success:function(h){d.node.update_field_data(h);d._errors(h&&h.tool_model);d.deferred.done(g);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(h)},error:function(h){d.deferred.done(g);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(h)}})}});return{View:c}}); \ No newline at end of file +define(["utils/utils","mvc/tools/tools-form-base"],function(b,a){var c=a.extend({initialize:function(e){this.node=workflow.active_node;if(!this.node){console.debug("FAILED - tools-form-workflow:initialize() - Node not found in workflow.");return}this.post_job_actions=this.node.post_job_actions||{};this.options=e;this.options.text_enable="In Advance";this.options.text_disable="At Runtime";this.options.use_defaults=true;b.deepeach(e.inputs,function(f){if(f.type){f.optional=(["data","data_hidden","hidden","drill_down","repeat","conditional"]).indexOf(f.type)==-1}});b.deepeach(e.inputs,function(f){if(f.type){if(f.type=="conditional"){f.test_param.optional=false}}});var d=this;b.get({url:galaxy_config.root+"api/datatypes",cache:true,success:function(f){d.datatypes=f;d._makeSections(e.inputs);a.prototype.initialize.call(d,e)}})},_makeSections:function(d){d[b.uuid()]={label:"Annotation / Notes",name:"annotation",type:"text",area:true,help:"Add an annotation or note for this step. It will be shown with the workflow.",value:this.node.annotation};var f=this.node.output_terminals&&Object.keys(this.node.output_terminals)[0];if(f){d[b.uuid()]={name:"pja__"+f+"__EmailAction",label:"Email notification",type:"boolean",value:String(Boolean(this.post_job_actions["EmailAction"+f])),ignore:"false",help:"An email notification will be send when the job has completed.",payload:{host:window.location.host}};d[b.uuid()]={name:"pja__"+f+"__DeleteIntermediatesAction",label:"Output cleanup",type:"boolean",value:String(Boolean(this.post_job_actions["DeleteIntermediatesAction"+f])),ignore:"false",help:"Delete intermediate outputs if they are not used as input for another job."};for(var e in this.node.output_terminals){d[b.uuid()]=this._makeSection(e)}}},_makeSection:function(h){var g=[];for(key in this.datatypes){g.push({0:this.datatypes[key],1:this.datatypes[key]})}g.sort(function(j,i){return j.label>i.label?1:j.label<i.label?-1:0});g.unshift({0:"Sequences",1:"Sequences"});g.unshift({0:"Roadmaps",1:"Roadmaps"});g.unshift({0:"Leave unchanged",1:""});var f={label:"Add Actions: '"+h+"'",type:"section",inputs:[{action:"RenameDatasetAction",argument:"newname",label:"Rename dataset",type:"text",value:"",ignore:"",help:'This action will rename the result dataset. Click <a href="https://wiki.galaxyproject.org/Learn/AdvancedWorkflow/Variables">here</a> for more information.'},{action:"ChangeDatatypeAction",argument:"newtype",label:"Change datatype",type:"select",ignore:"",options:g,help:"This action will change the datatype of the output to the indicated value."},{action:"TagDatasetAction",argument:"tags",label:"Tags",type:"text",value:"",ignore:"",help:"This action will set tags for the dataset."},{label:"Assign columns",type:"section",inputs:[{action:"ColumnSetAction",argument:"chromCol",label:"Chrom column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",argument:"startCol",label:"Start column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",argument:"endCol",label:"End column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",argument:"strandCol",label:"Strand column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",argument:"nameCol",label:"Name column",type:"integer",value:"",ignore:""}],help:"This action will set column assignments in the output dataset. Blank fields are ignored."}]};var d=this;function e(n,o){o=o||[];o.push(n);for(var m in n.inputs){var k=n.inputs[m];if(k.action){k.name="pja__"+h+"__"+k.action;if(k.argument){k.name+="__"+k.argument}if(k.payload){for(var s in k.payload){var q=k.payload[s];k.payload[k.name+"__"+s]=q;delete q}}var r=d.post_job_actions[k.action+h];if(r){for(var l in o){o[l].expand=true}if(k.argument){k.value=r.action_arguments&&r.action_arguments[k.argument]||k.value}else{k.value="true"}}}if(k.inputs){e(k,o.slice(0))}}}e(f);return f},_buildModel:function(){Galaxy.modal.show({title:"Coming soon...",body:"This feature has not been implemented yet.",buttons:{Close:function(){Galaxy.modal.hide()}}})},_updateModel:function(){var d=this;var e=this.tree.finalize();console.debug("tools-form-workflow::_refreshForm() - Refreshing states.");console.debug(e);var g=this.deferred.register();var f=galaxy_config.root+"workflow/editor_form_post?tool_id="+this.options.id+"&__is_dynamic__=False";b.request({type:"GET",url:f,data:e,success:function(h){d.node.update_field_data(h);d._errors(h&&h.tool_model);d.deferred.done(g);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(h)},error:function(h){d.deferred.done(g);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(h)}})}});return{View:c}}); \ No newline at end of file diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 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/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(e,b,h,d,c,a,f){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls="ui-table-plain";i.cls_tr="section-row";this.table=new b.View(i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs});o.$el.addClass("ui-table-form-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;function n(i,u){var t=p.id+"-section-"+(q++);var v=null;if(u){v=function(){l.del(t);l.retitle(p.title);s.app.trigger("refresh")}}var w=new g(s.app,{inputs:i});l.add({id:t,title:p.title,$el:w.$el,ondel:v});l.retitle(p.title)}var l=new c.View({title_new:p.title,max:p.max,onnew:function(){n(p.inputs,true);s.app.trigger("refresh")}});var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o,m>=j)}var k=new f(this.app,{label:p.title,help:p.help,field:l});k.$el.addClass("ui-table-form-section");this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;var j=this._createField(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j},_createField:function(i){var j=null;switch(i.type){case"text":j=this._fieldText(i);break;case"select":j=this._fieldSelect(i);break;case"data":j=this._fieldData(i);break;case"data_collection":j=this._fieldData(i);break;case"data_column":i.error_text="Missing columns in referenced dataset.";j=this._fieldSelect(i);break;case"hidden":j=this._fieldHidden(i);break;case"hidden_data":j=this._fieldHidden(i);break;case"integer":j=this._fieldSlider(i);break;case"float":j=this._fieldSlider(i);break;case"boolean":j=this._fieldBoolean(i);break;case"genomebuild":i.searchable=true;j=this._fieldSelect(i);break;case"drill_down":j=this._fieldDrilldown(i);break;case"baseurl":j=this._fieldHidden(i);break;default:this.app.incompatible=true;if(i.options){j=this._fieldSelect(i)}else{j=this._fieldText(i)}console.debug("tools-form::_addRow() : Auto matched field type ("+i.type+").")}if(i.value!==undefined){j.value(i.value)}return j},_fieldData:function(i){if(!this.app.options.is_dynamic){i.info="Data input '"+i.name+"' ("+e.textify(i.extensions.toString())+")";i.value=null;return this._fieldHidden(i)}var j=this;return new a.View(this.app,{id:"field-"+i.id,extensions:i.extensions,optional:i.optional,multiple:i.multiple,type:i.type,data:i.options,onchange:function(){j.app.trigger("refresh")}})},_fieldSelect:function(j){if(!this.app.options.is_dynamic&&j.is_dynamic){return this._fieldText(j)}var l=[];for(var m in j.options){var n=j.options[m];l.push({label:n[0],value:n[1]})}var o=h.Select;switch(j.display){case"checkboxes":o=h.Checkbox;break;case"radio":o=h.Radio;break}var k=this;return new o.View({id:"field-"+j.id,data:l,error_text:j.error_text||"No options available",multiple:j.multiple,searchable:j.searchable,onchange:function(){k.app.trigger("refresh")}})},_fieldDrilldown:function(i){if(!this.app.options.is_dynamic&&i.is_dynamic){return this._fieldText(i)}var j=this;return new h.Drilldown.View({id:"field-"+i.id,data:i.options,display:i.display,onchange:function(){j.app.trigger("refresh")}})},_fieldText:function(i){if(i.options){i.area=i.multiple;if(!e.validate(i.value)){i.value=""}else{if(i.value instanceof Array){i.value=value.toString()}else{i.value=String(i.value).replace(/[\[\]'"\s]/g,"");if(i.multiple){i.value=i.value.replace(/,/g,"\n")}}}}var j=this;return new h.Input({id:"field-"+i.id,area:i.area,onchange:function(){j.app.trigger("refresh")}})},_fieldSlider:function(i){var j=this;return new h.Slider.View({id:"field-"+i.id,precise:i.type=="float",min:i.min,max:i.max,onchange:function(){j.app.trigger("refresh")}})},_fieldHidden:function(i){return new h.Hidden({id:"field-"+i.id,info:i.info})},_fieldBoolean:function(i){var j=this;return new h.RadioButton.View({id:"field-"+i.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){j.app.trigger("refresh")}})}});return{View:g}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(e,b,h,d,c,a,f){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls="ui-table-plain";i.cls_tr="section-row";this.table=new b.View(i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs});o.$el.addClass("ui-table-form-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;function n(i,u){var t=p.id+"-section-"+(q++);var v=null;if(u){v=function(){l.del(t);l.retitle(p.title);s.app.trigger("refresh")}}var w=new g(s.app,{inputs:i});l.add({id:t,title:p.title,$el:w.$el,ondel:v});l.retitle(p.title)}var l=new c.View({title_new:p.title,max:p.max,onnew:function(){n(p.inputs,true);s.app.trigger("refresh")}});var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o,m>=j)}var k=new f(this.app,{label:p.title,help:p.help,field:l});k.$el.addClass("ui-table-form-section");this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);l.append($("<div/>").addClass("ui-table-form-info").html(i.help));var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;var j=this._createField(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j},_createField:function(i){var j=null;switch(i.type){case"text":j=this._fieldText(i);break;case"select":j=this._fieldSelect(i);break;case"data":j=this._fieldData(i);break;case"data_collection":j=this._fieldData(i);break;case"data_column":i.error_text="Missing columns in referenced dataset.";j=this._fieldSelect(i);break;case"hidden":j=this._fieldHidden(i);break;case"hidden_data":j=this._fieldHidden(i);break;case"integer":j=this._fieldSlider(i);break;case"float":j=this._fieldSlider(i);break;case"boolean":j=this._fieldBoolean(i);break;case"genomebuild":i.searchable=true;j=this._fieldSelect(i);break;case"drill_down":j=this._fieldDrilldown(i);break;case"baseurl":j=this._fieldHidden(i);break;default:this.app.incompatible=true;if(i.options){j=this._fieldSelect(i)}else{j=this._fieldText(i)}console.debug("tools-form::_addRow() : Auto matched field type ("+i.type+").")}if(i.value!==undefined){j.value(i.value)}return j},_fieldData:function(i){if(!this.app.options.is_dynamic){i.info="Data input '"+i.name+"' ("+e.textify(i.extensions.toString())+")";i.value=null;return this._fieldHidden(i)}var j=this;return new a.View(this.app,{id:"field-"+i.id,extensions:i.extensions,optional:i.optional,multiple:i.multiple,type:i.type,data:i.options,onchange:function(){j.app.trigger("refresh")}})},_fieldSelect:function(j){if(!this.app.options.is_dynamic&&j.is_dynamic){return this._fieldText(j)}var l=[];for(var m in j.options){var n=j.options[m];l.push({label:n[0],value:n[1]})}var o=h.Select;switch(j.display){case"checkboxes":o=h.Checkbox;break;case"radio":o=h.Radio;break}var k=this;return new o.View({id:"field-"+j.id,data:l,error_text:j.error_text||"No options available",multiple:j.multiple,searchable:j.searchable,onchange:function(){k.app.trigger("refresh")}})},_fieldDrilldown:function(i){if(!this.app.options.is_dynamic&&i.is_dynamic){return this._fieldText(i)}var j=this;return new h.Drilldown.View({id:"field-"+i.id,data:i.options,display:i.display,onchange:function(){j.app.trigger("refresh")}})},_fieldText:function(i){if(i.options){i.area=i.multiple;if(!e.validate(i.value)){i.value=""}else{if(i.value instanceof Array){i.value=value.toString()}else{i.value=String(i.value).replace(/[\[\]'"\s]/g,"");if(i.multiple){i.value=i.value.replace(/,/g,"\n")}}}}var j=this;return new h.Input({id:"field-"+i.id,area:i.area,onchange:function(){j.app.trigger("refresh")}})},_fieldSlider:function(i){var j=this;return new h.Slider.View({id:"field-"+i.id,precise:i.type=="float",min:i.min,max:i.max,onchange:function(){j.app.trigger("refresh")}})},_fieldHidden:function(i){return new h.Hidden({id:"field-"+i.id,info:i.info})},_fieldBoolean:function(i){var j=this;return new h.RadioButton.View({id:"field-"+i.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){j.app.trigger("refresh")}})}});return{View:g}}); \ No newline at end of file diff -r 68f0ed37e08942acb1bb84b63911b22d7d4b6f65 -r e0441a0f85307fb9caf854fd10133f71cc3852d3 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:{min:null,max:null,step:null,precise:false,split:10000},initialize:function(d){var c=this;this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.useslider=this.options.max!==null&&this.options.min!==null&&this.options.max>this.options.min;if(this.options.step===null){this.options.step=1;if(this.options.precise&&this.useslider){this.options.step=(this.options.max-this.options.min)/this.options.split}}if(this.useslider){this.$slider=this.$el.find("#slider");this.$slider.slider(this.options);this.$slider.on("slide",function(f,g){c.value(g.value)})}else{this.$el.find(".ui-form-slider-text").css("width","100%")}this.$text=this.$el.find("#text");if(this.options.value!==undefined){this.value(this.options.value)}this.$text.on("change",function(){c.value($(this).val())});var e=[];this.$text.on("keyup",function(f){e[f.which]=false});this.$text.on("keydown",function(g){var f=g.which;e[f]=true;if(!(f==8||f==9||f==13||f==37||f==39||(f>=48&&f<=57)||(f==190&&$(this).val().indexOf(".")==-1&&c.options.precise)||(f==189&&$(this).val().indexOf("-")==-1)||e[91]||e[17])){event.preventDefault()}})},value:function(c){if(c!==undefined){if(isNaN(c)){c=0}if(this.options.max!==null){c=Math.min(c,this.options.max)}if(this.options.min!==null){c=Math.max(c,this.options.min)}if(this.options.onchange){this.options.onchange(c)}this.$slider&&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:{min:null,max:null,step:null,precise:false,split:10000},initialize:function(d){var c=this;this.options=a.merge(d,this.optionsDefault);this.setElement(this._template(this.options));this.useslider=this.options.max!==null&&this.options.min!==null&&this.options.max>this.options.min;if(this.options.step===null){this.options.step=1;if(this.options.precise&&this.useslider){this.options.step=(this.options.max-this.options.min)/this.options.split}}if(this.useslider){this.$slider=this.$el.find("#slider");this.$slider.slider(this.options);this.$slider.on("slide",function(f,g){c.value(g.value)})}else{this.$el.find(".ui-form-slider-text").css("width","100%")}this.$text=this.$el.find("#text");if(this.options.value!==undefined){this.value(this.options.value)}this.$text.on("input",function(){c.value($(this).val())});var e=[];this.$text.on("keyup",function(f){e[f.which]=false});this.$text.on("keydown",function(g){var f=g.which;e[f]=true;if(!(f==8||f==9||f==13||f==37||f==39||(f>=48&&f<=57)||(f==190&&$(this).val().indexOf(".")==-1&&c.options.precise)||(f==189&&$(this).val().indexOf("-")==-1)||e[91]||e[17])){event.preventDefault()}})},value:function(c){if(c!==undefined){if(isNaN(c)){c=0}if(this.options.max!==null){c=Math.min(c,this.options.max)}if(this.options.min!==null){c=Math.max(c,this.options.min)}if(this.options.onchange){this.options.onchange(c)}this.$slider&&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 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