mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
3 lines
4.3 KiB
JavaScript
3 lines
4.3 KiB
JavaScript
"use strict";define(["mvc/workflow/workflow-view-node"],function(t){return Backbone.Model.extend({initialize:function(t,e){this.app=t,this.element=e.element,this.input_terminals={},this.output_terminals={},this.errors={},this.workflow_outputs=[]},getWorkflowOutput:function(t){return _.findWhere(this.workflow_outputs,{output_name:t})},isWorkflowOutput:function(t){return void 0!=this.getWorkflowOutput(t)},removeWorkflowOutput:function(t){for(;this.isWorkflowOutput(t);)this.workflow_outputs.splice(this.getWorkflowOutput(t),1)},addWorkflowOutput:function(t,e){if(!this.isWorkflowOutput(t)){var n={output_name:t};return e&&(n.label=e),this.workflow_outputs.push(n),!0}return!1},labelWorkflowOutput:function(t,e){var n=!1,o=null;if(this.isWorkflowOutput(t)){var i=this.getWorkflowOutput(t);o=i.label,i.label=e,n=o!=e}else n=this.addWorkflowOutput(t,e);return n&&(this.app.workflow.updateOutputLabel(o,e),this.markChanged(),this.nodeView.redrawWorkflowOutputs()),n},connectedOutputTerminals:function(){return this._connectedTerminals(this.output_terminals)},_connectedTerminals:function(t){var e=[];return $.each(t,function(t,n){n.connectors.length>0&&e.push(n)}),e},hasConnectedOutputTerminals:function(){var t=this.output_terminals;for(var e in t)if(t[e].connectors.length>0)return!0;return!1},connectedMappedInputTerminals:function(){return this._connectedMappedTerminals(this.input_terminals)},hasConnectedMappedInputTerminals:function(){var t=this.input_terminals;for(var e in t){var n=t[e];if(n.connectors.length>0&&n.isMappedOver())return!0}return!1},_connectedMappedTerminals:function(t){var e=[];return $.each(t,function(t,n){n.mapOver().isCollection&&n.connectors.length>0&&e.push(n)}),e},mappedInputTerminals:function(){return this._mappedTerminals(this.input_terminals)},_mappedTerminals:function(t){var e=[];return $.each(t,function(t,n){n.mapOver().isCollection&&e.push(n)}),e},hasMappedOverInputTerminals:function(){var t=!1;return _.each(this.input_terminals,function(e){e.mapOver().isCollection&&(t=!0)}),t},redraw:function(){$.each(this.input_terminals,function(t,e){e.redraw()}),$.each(this.output_terminals,function(t,e){e.redraw()})},destroy:function(){$.each(this.input_terminals,function(t,e){e.destroy()}),$.each(this.output_terminals,function(t,e){e.destroy()}),this.app.workflow.remove_node(this),$(this.element).remove()},make_active:function(){$(this.element).addClass("toolForm-active")},make_inactive:function(){var t=this.element.get(0);!function(e){e.removeChild(t),e.appendChild(t)}(t.parentNode),$(t).removeClass("toolForm-active")},init_field_data:function(e){e.type&&(this.type=e.type),this.name=e.name,this.config_form=e.config_form,this.tool_state=e.tool_state,this.errors=e.errors,this.tooltip=e.tooltip?e.tooltip:"",this.annotation=e.annotation,this.post_job_actions=e.post_job_actions?e.post_job_actions:{},this.label=e.label,this.uuid=e.uuid,this.workflow_outputs=e.workflow_outputs?e.workflow_outputs:[];var n=this,o=new t({el:this.element[0],node:n});n.nodeView=o,$.each(e.data_inputs,function(t,e){o.addDataInput(e)}),e.data_inputs.length>0&&e.data_outputs.length>0&&o.addRule(),$.each(e.data_outputs,function(t,e){o.addDataOutput(e)}),o.render(),this.app.workflow.node_changed(this,!0)},update_field_data:function(t){var e=this,n=e.nodeView;if(this.tool_state=t.tool_state,this.config_form=t.config_form,this.errors=t.errors,this.annotation=t.annotation,this.label=t.label,"post_job_actions"in t){var o=t.post_job_actions;this.post_job_actions=o||{}}e.nodeView.renderToolErrors();var i=n.$("div.inputs"),r=n.newInputsDiv(),a={};_.each(t.data_inputs,function(t){var n=e.nodeView.addDataInput(t,r);a[t.name]=n}),_.each(_.difference(_.values(n.terminalViews),_.values(a)),function(t){t.el.terminal.destroy()}),n.terminalViews=a,e.nodeView.render(),1==t.data_outputs.length&&"collection_type"in t.data_outputs[0]&&n.updateDataOutput(t.data_outputs[0]),i.replaceWith(r),"workflow_outputs"in t&&(this.workflow_outputs=workflow_outputs||[]),this.markChanged(),this.redraw()},error:function(t){var e=$(this.element).find(".toolFormBody");e.find("div").remove();var n="<div style='color: red; text-style: italic;'>"+t+"</div>";this.config_form=n,e.html(n),this.app.workflow.node_changed(this)},markChanged:function(){this.app.workflow.node_changed(this)}})});
|
|
//# sourceMappingURL=../../../maps/mvc/workflow/workflow-node.js.map
|