`;\n }\n });\n if (upgrade_message) {\n window.show_modal(\n \"Issues loading this workflow\",\n `Please review the following issues, possibly resulting from tool upgrades or changes.
`;\n for (var ot_key in node.output_terminals) {\n var output = node.output_terminals[ot_key];\n if (node.isWorkflowOutput(output.name)) {\n new_content += `
${output.name}
`;\n } else {\n new_content += `
${output.name}
`;\n }\n }\n new_content += \"
\";\n }\n }\n $(\"#output-fill-area\").html(new_content);\n $(\"#output-fill-area input\").bind(\"click\", function() {\n var node_id = this.name.split(\"|\")[0];\n var workflowNode = this.workflow.nodes[node_id];\n var output_name = this.name.split(\"|\")[1];\n if (this.checked) {\n workflowNode.addWorkflowOutput(output_name);\n } else {\n workflowNode.removeWorkflowOutput(output_name);\n }\n self.workflow.has_changes = true;\n });\n $(\"#workflow-output-area\").show();\n }\n\n function layout_editor() {\n self.workflow.layout();\n self.workflow.fit_canvas_to_nodes();\n self.scroll_to_nodes();\n self.canvas_manager.draw_overview();\n }\n\n // On load, set the size to the pref stored in local storage if it exists\n var overview_size = $.jStorage.get(\"overview-size\");\n if (overview_size !== undefined) {\n $(\"#overview-border\").css({\n width: overview_size,\n height: overview_size\n });\n }\n\n // Show viewport on load unless pref says it's off\n if ($.jStorage.get(\"overview-off\")) {\n hide_overview();\n } else {\n show_overview();\n }\n\n // Stores the size of the overview into local storage when it's resized\n $(\"#overview-border\").bind(\"dragend\", function(e, d) {\n var op = $(this).offsetParent();\n var opo = op.offset();\n var new_size = Math.max(op.width() - (d.offsetX - opo.left), op.height() - (d.offsetY - opo.top));\n $.jStorage.set(\"overview-size\", `${new_size}px`);\n });\n\n function show_overview() {\n $.jStorage.set(\"overview-off\", false);\n $(\"#overview-border\").css(\"right\", \"0px\");\n $(\"#close-viewport\").css(\"background-position\", \"0px 0px\");\n }\n\n function hide_overview() {\n $.jStorage.set(\"overview-off\", true);\n $(\"#overview-border\").css(\"right\", \"20000px\");\n $(\"#close-viewport\").css(\"background-position\", \"12px 0px\");\n }\n\n // Lets the overview be toggled visible and invisible, adjusting the arrows accordingly\n $(\"#close-viewport\").click(() => {\n if ($(\"#overview-border\").css(\"right\") === \"0px\") {\n hide_overview();\n } else {\n show_overview();\n }\n });\n\n // Unload handler\n window.onbeforeunload = () => {\n if (workflow && self.workflow.has_changes) {\n return \"There are unsaved changes to your workflow which will be lost.\";\n }\n };\n\n this.options.workflows.length > 0 &&\n $(\"#left\")\n .find(\".toolMenu\")\n .append(this._buildToolPanelWorkflows());\n\n // Tool menu\n $(\"div.toolSectionBody\").hide();\n $(\"div.toolSectionTitle > span\").wrap(\"\");\n var last_expanded = null;\n $(\"div.toolSectionTitle\").each(function() {\n var body = $(this).next(\"div.toolSectionBody\");\n $(this).click(() => {\n if (body.is(\":hidden\")) {\n if (last_expanded) last_expanded.slideUp(\"fast\");\n last_expanded = body;\n body.slideDown(\"fast\");\n } else {\n body.slideUp(\"fast\");\n last_expanded = null;\n }\n });\n });\n\n // Rename async.\n async_save_text(\"workflow-name\", \"workflow-name\", self.urls.rename_async, \"new_name\");\n\n // Tag async. Simply have the workflow edit element generate a click on the tag element to activate tagging.\n $(\"#workflow-tag\").click(() => {\n $(\".tag-area\").click();\n return false;\n });\n // Annotate async.\n async_save_text(\n \"workflow-annotation\",\n \"workflow-annotation\",\n self.urls.annotate_async,\n \"new_annotation\",\n 25,\n true,\n 4\n );\n },\n\n _buildToolPanelWorkflows: function() {\n var self = this;\n var $section = $(\n '
\";\n });\n if (upgrade_message) {\n window.show_modal(\n \"Subworkflow embedded with changes\",\n `Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
${\n upgrade_message\n }
`,\n { Continue: hide_modal }\n );\n } else {\n hide_modal();\n }\n },\n beforeSubmit: function(data) {\n show_message(\"Importing workflow\", \"progress\");\n }\n });\n },\n\n // Global state for the whole workflow\n reset: function() {\n this.workflow && this.workflow.remove_all();\n this.workflow = window.workflow_globals.workflow = new Workflow(this, $(\"#canvas-container\"));\n },\n\n scroll_to_nodes: function() {\n var cv = $(\"#canvas-viewport\");\n var cc = $(\"#canvas-container\");\n var top;\n var left;\n if (cc.width() < cv.width()) {\n left = (cv.width() - cc.width()) / 2;\n } else {\n left = 0;\n }\n if (cc.height() < cv.height()) {\n top = (cv.height() - cc.height()) / 2;\n } else {\n top = 0;\n }\n cc.css({ left: left, top: top });\n },\n\n _workflowLoadAjax: function(workflowId, options) {\n $.ajax(\n Utils.merge(options, {\n url: this.urls.load_workflow,\n data: { id: workflowId, _: \"true\" },\n dataType: \"json\",\n cache: false\n })\n );\n },\n\n _moduleInitAjax: function(node, request_data) {\n var self = this;\n Utils.request({\n type: \"POST\",\n url: `${Galaxy.root}api/workflows/build_module`,\n data: request_data,\n success: function(data) {\n node.init_field_data(data);\n node.update_field_data(data);\n self.workflow.activate_node(node);\n }\n });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_tool: function(id, title) {\n var node = this.workflow.create_node(\"tool\", title, id);\n this._moduleInitAjax(node, {\n type: \"tool\",\n tool_id: id,\n _: \"true\"\n });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_subworkflow: function(id, title) {\n var node = this.workflow.create_node(\"subworkflow\", title, id);\n this._moduleInitAjax(node, {\n type: \"subworkflow\",\n content_id: id,\n _: \"true\"\n });\n },\n\n add_node_for_module: function(type, title) {\n var node = this.workflow.create_node(type, title);\n this._moduleInitAjax(node, { type: type, _: \"true\" });\n },\n\n display_file_list: function(node) {\n var addlist = \"\";\n return addlist;\n },\n\n showWorkflowParameters: function() {\n var parameter_re = /\\$\\{.+?\\}/g;\n var workflow_parameters = [];\n var wf_parm_container = $(\"#workflow-parameters-container\");\n var wf_parm_box = $(\"#workflow-parameters-box\");\n var new_parameter_content = \"\";\n var matches = [];\n $.each(this.workflow.nodes, (k, node) => {\n if (node.config_form && node.config_form.inputs) {\n Utils.deepeach(node.config_form.inputs, d => {\n if (typeof d.value == \"string\") {\n var form_matches = d.value.match(parameter_re);\n if (form_matches) {\n matches = matches.concat(form_matches);\n }\n }\n });\n }\n if (node.post_job_actions) {\n $.each(node.post_job_actions, (k, pja) => {\n if (pja.action_arguments) {\n $.each(pja.action_arguments, (k, action_argument) => {\n var arg_matches = action_argument.match(parameter_re);\n if (arg_matches) {\n matches = matches.concat(arg_matches);\n }\n });\n }\n });\n }\n if (matches) {\n $.each(matches, (k, element) => {\n if ($.inArray(element, workflow_parameters) === -1) {\n workflow_parameters.push(element);\n }\n });\n }\n });\n if (workflow_parameters && workflow_parameters.length !== 0) {\n $.each(workflow_parameters, (k, element) => {\n new_parameter_content += `
${element.substring(2, element.length - 1)}
`;\n });\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.show();\n } else {\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.hide();\n }\n },\n\n showAttributes: function() {\n $(\".right-content\").hide();\n $(\"#edit-attributes\").show();\n },\n\n showForm: function(content, node) {\n var self = this;\n var cls = \"right-content\";\n var id = `${cls}-${node.id}`;\n var $container = $(`#${cls}`);\n if (content && $container.find(`#${id}`).length == 0) {\n var $el = $(`
`);\n content.node = node;\n content.workflow = this.workflow;\n content.datatypes = this.datatypes;\n content.icon = WorkflowIcons[node.type];\n content.cls = \"ui-portlet-narrow\";\n if (node) {\n var form_type = node.type == \"tool\" ? \"Tool\" : \"Default\";\n $el.append(new FormWrappers[form_type](content).form.$el);\n $container.append($el);\n } else {\n Galaxy.emit.debug(\"workflow-view::initialize()\", \"Node not found in workflow.\");\n }\n }\n $(`.${cls}`).hide();\n $container.find(`#${id}`).show();\n $container.show();\n $container.scrollTop();\n },\n\n isSubType: function(child, parent) {\n child = this.ext_to_type[child];\n parent = this.ext_to_type[parent];\n return this.type_to_type[child] && parent in this.type_to_type[child];\n },\n\n prebuildNode: function(type, title_text, content_id) {\n var self = this;\n var $f = $(\"\");\n var $title = $(`
`;\n }\n });\n if (upgrade_message) {\n window.show_modal(\n \"Issues loading this workflow\",\n `Please review the following issues, possibly resulting from tool upgrades or changes.
`;\n for (var ot_key in node.output_terminals) {\n var output = node.output_terminals[ot_key];\n if (node.isWorkflowOutput(output.name)) {\n new_content += `
${output.name}
`;\n } else {\n new_content += `
${output.name}
`;\n }\n }\n new_content += \"
\";\n }\n }\n $(\"#output-fill-area\").html(new_content);\n $(\"#output-fill-area input\").bind(\"click\", function() {\n var node_id = this.name.split(\"|\")[0];\n var workflowNode = this.workflow.nodes[node_id];\n var output_name = this.name.split(\"|\")[1];\n if (this.checked) {\n workflowNode.addWorkflowOutput(output_name);\n } else {\n workflowNode.removeWorkflowOutput(output_name);\n }\n self.workflow.has_changes = true;\n });\n $(\"#workflow-output-area\").show();\n }\n\n function layout_editor() {\n self.workflow.layout();\n self.workflow.fit_canvas_to_nodes();\n self.scroll_to_nodes();\n self.canvas_manager.draw_overview();\n }\n\n // On load, set the size to the pref stored in local storage if it exists\n var overview_size = $.jStorage.get(\"overview-size\");\n if (overview_size !== undefined) {\n $(\"#overview-border\").css({\n width: overview_size,\n height: overview_size\n });\n }\n\n // Show viewport on load unless pref says it's off\n if ($.jStorage.get(\"overview-off\")) {\n hide_overview();\n } else {\n show_overview();\n }\n\n // Stores the size of the overview into local storage when it's resized\n $(\"#overview-border\").bind(\"dragend\", function(e, d) {\n var op = $(this).offsetParent();\n var opo = op.offset();\n var new_size = Math.max(op.width() - (d.offsetX - opo.left), op.height() - (d.offsetY - opo.top));\n $.jStorage.set(\"overview-size\", `${new_size}px`);\n });\n\n function show_overview() {\n $.jStorage.set(\"overview-off\", false);\n $(\"#overview-border\").css(\"right\", \"0px\");\n $(\"#close-viewport\").css(\"background-position\", \"0px 0px\");\n }\n\n function hide_overview() {\n $.jStorage.set(\"overview-off\", true);\n $(\"#overview-border\").css(\"right\", \"20000px\");\n $(\"#close-viewport\").css(\"background-position\", \"12px 0px\");\n }\n\n // Lets the overview be toggled visible and invisible, adjusting the arrows accordingly\n $(\"#close-viewport\").click(() => {\n if ($(\"#overview-border\").css(\"right\") === \"0px\") {\n hide_overview();\n } else {\n show_overview();\n }\n });\n\n // Unload handler\n window.onbeforeunload = () => {\n if (workflow && self.workflow.has_changes) {\n return \"There are unsaved changes to your workflow which will be lost.\";\n }\n };\n\n this.options.workflows.length > 0 &&\n $(\"#left\")\n .find(\".toolMenu\")\n .append(this._buildToolPanelWorkflows());\n\n // Tool menu\n $(\"div.toolSectionBody\").hide();\n $(\"div.toolSectionTitle > span\").wrap(\"\");\n var last_expanded = null;\n $(\"div.toolSectionTitle\").each(function() {\n var body = $(this).next(\"div.toolSectionBody\");\n $(this).click(() => {\n if (body.is(\":hidden\")) {\n if (last_expanded) last_expanded.slideUp(\"fast\");\n last_expanded = body;\n body.slideDown(\"fast\");\n } else {\n body.slideUp(\"fast\");\n last_expanded = null;\n }\n });\n });\n\n // Rename async.\n async_save_text(\"workflow-name\", \"workflow-name\", self.urls.rename_async, \"new_name\");\n\n // Tag async. Simply have the workflow edit element generate a click on the tag element to activate tagging.\n $(\"#workflow-tag\").click(() => {\n $(\".tag-area\").click();\n return false;\n });\n // Annotate async.\n async_save_text(\n \"workflow-annotation\",\n \"workflow-annotation\",\n self.urls.annotate_async,\n \"new_annotation\",\n 25,\n true,\n 4\n );\n },\n\n _buildToolPanelWorkflows: function() {\n var self = this;\n var $section = $(\n '
\";\n });\n if (upgrade_message) {\n window.show_modal(\n \"Subworkflow embedded with changes\",\n `Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
${\n upgrade_message\n }
`,\n { Continue: hide_modal }\n );\n } else {\n hide_modal();\n }\n },\n beforeSubmit: function(data) {\n show_message(\"Importing workflow\", \"progress\");\n }\n });\n },\n\n // Global state for the whole workflow\n reset: function() {\n this.workflow && this.workflow.remove_all();\n this.workflow = window.workflow_globals.workflow = new Workflow(this, $(\"#canvas-container\"));\n },\n\n scroll_to_nodes: function() {\n var cv = $(\"#canvas-viewport\");\n var cc = $(\"#canvas-container\");\n var top;\n var left;\n if (cc.width() < cv.width()) {\n left = (cv.width() - cc.width()) / 2;\n } else {\n left = 0;\n }\n if (cc.height() < cv.height()) {\n top = (cv.height() - cc.height()) / 2;\n } else {\n top = 0;\n }\n cc.css({ left: left, top: top });\n },\n\n _workflowLoadAjax: function(workflowId, options) {\n $.ajax(\n Utils.merge(options, {\n url: this.urls.load_workflow,\n data: { id: workflowId, _: \"true\" },\n dataType: \"json\",\n cache: false\n })\n );\n },\n\n _moduleInitAjax: function(node, request_data) {\n var self = this;\n Utils.request({\n type: \"POST\",\n url: `${Galaxy.root}api/workflows/build_module`,\n data: request_data,\n success: function(data) {\n node.init_field_data(data);\n node.update_field_data(data);\n self.workflow.activate_node(node);\n }\n });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_tool: function(id, title) {\n var node = this.workflow.create_node(\"tool\", title, id);\n this._moduleInitAjax(node, {\n type: \"tool\",\n tool_id: id,\n _: \"true\"\n });\n },\n\n // Add a new step to the workflow by tool id\n add_node_for_subworkflow: function(id, title) {\n var node = this.workflow.create_node(\"subworkflow\", title, id);\n this._moduleInitAjax(node, {\n type: \"subworkflow\",\n content_id: id,\n _: \"true\"\n });\n },\n\n add_node_for_module: function(type, title) {\n var node = this.workflow.create_node(type, title);\n this._moduleInitAjax(node, { type: type, _: \"true\" });\n },\n\n display_file_list: function(node) {\n var addlist = \"\";\n return addlist;\n },\n\n showWorkflowParameters: function() {\n var parameter_re = /\\$\\{.+?\\}/g;\n var workflow_parameters = [];\n var wf_parm_container = $(\"#workflow-parameters-container\");\n var wf_parm_box = $(\"#workflow-parameters-box\");\n var new_parameter_content = \"\";\n var matches = [];\n $.each(this.workflow.nodes, (k, node) => {\n if (node.config_form && node.config_form.inputs) {\n Utils.deepeach(node.config_form.inputs, d => {\n if (typeof d.value == \"string\") {\n var form_matches = d.value.match(parameter_re);\n if (form_matches) {\n matches = matches.concat(form_matches);\n }\n }\n });\n }\n if (node.post_job_actions) {\n $.each(node.post_job_actions, (k, pja) => {\n if (pja.action_arguments) {\n $.each(pja.action_arguments, (k, action_argument) => {\n var arg_matches = action_argument.match(parameter_re);\n if (arg_matches) {\n matches = matches.concat(arg_matches);\n }\n });\n }\n });\n }\n if (matches) {\n $.each(matches, (k, element) => {\n if ($.inArray(element, workflow_parameters) === -1) {\n workflow_parameters.push(element);\n }\n });\n }\n });\n if (workflow_parameters && workflow_parameters.length !== 0) {\n $.each(workflow_parameters, (k, element) => {\n new_parameter_content += `
${element.substring(2, element.length - 1)}
`;\n });\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.show();\n } else {\n wf_parm_container.html(new_parameter_content);\n wf_parm_box.hide();\n }\n },\n\n showAttributes: function() {\n $(\".right-content\").hide();\n $(\"#edit-attributes\").show();\n },\n\n showForm: function(content, node) {\n var self = this;\n var cls = \"right-content\";\n var id = `${cls}-${node.id}`;\n var $container = $(`#${cls}`);\n if (content && $container.find(`#${id}`).length == 0) {\n var $el = $(`
`);\n content.node = node;\n content.workflow = this.workflow;\n content.datatypes = this.datatypes;\n content.icon = WorkflowIcons[node.type];\n content.cls = \"ui-portlet-narrow\";\n if (node) {\n var form_type = node.type == \"tool\" ? \"Tool\" : \"Default\";\n $el.append(new FormWrappers[form_type](content).form.$el);\n $container.append($el);\n } else {\n Galaxy.emit.debug(\"workflow-view::initialize()\", \"Node not found in workflow.\");\n }\n }\n $(`.${cls}`).hide();\n $container.find(`#${id}`).show();\n $container.show();\n $container.scrollTop();\n },\n\n isSubType: function(child, parent) {\n child = this.ext_to_type[child];\n parent = this.ext_to_type[parent];\n return this.type_to_type[child] && parent in this.type_to_type[child];\n },\n\n prebuildNode: function(type, title_text, content_id) {\n var self = this;\n var $f = $(\"\");\n var $title = $(`
")}),e?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.
"+e+"
",{Continue:hide_modal}):hide_modal(),i.showWorkflowParameters()},beforeSubmit:function(o){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu($("#workflow-options-button"),{Save:a,"Save As":function(){var o=$('');window.show_modal("Save As a New Workflow",o,{OK:function(){var o=$("#workflow_rename").val().length>0?$("#workflow_rename").val():"SavedAs_"+i.workflow.name,e=$("#wf_annotation").val().length>0?$("#wf_annotation").val():"";$.ajax({url:i.urls.workflow_save_as,type:"POST",data:{workflow_name:o,workflow_annotation:e,workflow_data:function(){return JSON.stringify(i.workflow.to_simple())}}}).done(function(o){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+o,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})},Run:function(){window.location=Galaxy.root+"workflow/run?id="+i.options.id},"Edit Attributes":function(){i.workflow.clear_active_node()},"Auto Re-layout":function(){i.workflow.layout(),i.workflow.fit_canvas_to_nodes(),i.scroll_to_nodes(),i.canvas_manager.draw_overview()},Close:function(){if(i.workflow.check_changes_in_active_form(),workflow&&i.workflow.has_changes){var o=function(){window.onbeforeunload=void 0,window.document.location=i.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){a(null,o)}},{"Don't Save":o})}else window.document.location=i.urls.workflow_index}});var n=$.jStorage.get("overview-size");void 0!==n&&$("#overview-border").css({width:n,height:n}),$.jStorage.get("overview-off")?t():e(),$("#overview-border").bind("dragend",function(o,e){var t=$(this).offsetParent(),i=t.offset(),a=Math.max(t.width()-(e.offsetX-i.left),t.height()-(e.offsetY-i.top));$.jStorage.set("overview-size",a+"px")}),$("#close-viewport").click(function(){"0px"===$("#overview-border").css("right")?t():e()}),window.onbeforeunload=function(){if(workflow&&i.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&$("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),$("div.toolSectionBody").hide(),$("div.toolSectionTitle > span").wrap("");var s=null;$("div.toolSectionTitle").each(function(){var o=$(this).next("div.toolSectionBody");$(this).click(function(){o.is(":hidden")?(s&&s.slideUp("fast"),s=o,o.slideDown("fast")):(o.slideUp("fast"),s=null)})}),(0,y.default)("workflow-name","workflow-name",i.urls.rename_async,"new_name"),$("#workflow-tag").click(function(){return $(".tag-area").click(),!1}),(0,y.default)("workflow-annotation","workflow-annotation",i.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var o=this,e=$('
');return _.each(this.options.workflows,function(t){if(t.id!==o.options.id){var i=new g.default.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){t.step_count<2?o.copy_into_workflow(t.id,t.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+t.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),o.copy_into_workflow(t.id,t.name)}}})}}),a=$("").attr("href","#").html(t.name).on("click",function(){o.add_node_for_subworkflow(t.latest_id,t.name)});e.find(".toolSectionBg").append($("").addClass("toolTitle").append(a).append(i.$el))}}),e},copy_into_workflow:function(o){var e=this;this._workflowLoadAjax(o,{success:function(o){e.workflow.from_simple(o,!1);var t="";$.each(o.upgrade_messages,function(o,i){t+="
"}),t?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
"}),t.html(a),i.show()):(t.html(a),i.hide())},showAttributes:function(){$(".right-content").hide(),$("#edit-attributes").show()},showForm:function(o,e){var t="right-content",i=t+"-"+e.id,a=$("#"+t);if(o&&0==a.find("#"+i).length){var n=$('');if(o.node=e,o.workflow=this.workflow,o.datatypes=this.datatypes,o.icon=m.default[e.type],o.cls="ui-portlet-narrow",e){var s="tool"==e.type?"Tool":"Default";n.append(new k.default[s](o).form.$el),a.append(n)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}$("."+t).hide(),a.find("#"+i).show(),a.show(),a.scrollTop()},isSubType:function(o,e){return o=this.ext_to_type[o],e=this.ext_to_type[e],this.type_to_type[o]&&e in this.type_to_type[o]},prebuildNode:function(o,e,t){var i=this,a=$(""),n=$("
")}),e?window.show_modal("Issues loading this workflow","Please review the following issues, possibly resulting from tool upgrades or changes.
"+e+"
",{Continue:hide_modal}):hide_modal(),i.showWorkflowParameters()},beforeSubmit:function(o){show_message("Loading workflow","progress")}}),window.make_popupmenu&&make_popupmenu($("#workflow-options-button"),{Save:a,"Save As":function(){var o=$('');window.show_modal("Save As a New Workflow",o,{OK:function(){var o=$("#workflow_rename").val().length>0?$("#workflow_rename").val():"SavedAs_"+i.workflow.name,e=$("#wf_annotation").val().length>0?$("#wf_annotation").val():"";$.ajax({url:i.urls.workflow_save_as,type:"POST",data:{workflow_name:o,workflow_annotation:e,workflow_data:function(){return JSON.stringify(i.workflow.to_simple())}}}).done(function(o){window.onbeforeunload=void 0,window.location=Galaxy.root+"workflow/editor?id="+o,hide_modal()}).fail(function(){hide_modal(),alert("Saving this workflow failed. Please contact this site's administrator.")})},Cancel:hide_modal})},Run:function(){window.location=Galaxy.root+"workflows/run?id="+i.options.id},"Edit Attributes":function(){i.workflow.clear_active_node()},"Auto Re-layout":function(){i.workflow.layout(),i.workflow.fit_canvas_to_nodes(),i.scroll_to_nodes(),i.canvas_manager.draw_overview()},Close:function(){if(i.workflow.check_changes_in_active_form(),workflow&&i.workflow.has_changes){var o=function(){window.onbeforeunload=void 0,window.document.location=i.urls.workflow_index};window.show_modal("Close workflow editor","There are unsaved changes to your workflow which will be lost.",{Cancel:hide_modal,"Save Changes":function(){a(null,o)}},{"Don't Save":o})}else window.document.location=i.urls.workflow_index}});var n=$.jStorage.get("overview-size");void 0!==n&&$("#overview-border").css({width:n,height:n}),$.jStorage.get("overview-off")?t():e(),$("#overview-border").bind("dragend",function(o,e){var t=$(this).offsetParent(),i=t.offset(),a=Math.max(t.width()-(e.offsetX-i.left),t.height()-(e.offsetY-i.top));$.jStorage.set("overview-size",a+"px")}),$("#close-viewport").click(function(){"0px"===$("#overview-border").css("right")?t():e()}),window.onbeforeunload=function(){if(workflow&&i.workflow.has_changes)return"There are unsaved changes to your workflow which will be lost."},this.options.workflows.length>0&&$("#left").find(".toolMenu").append(this._buildToolPanelWorkflows()),$("div.toolSectionBody").hide(),$("div.toolSectionTitle > span").wrap("");var s=null;$("div.toolSectionTitle").each(function(){var o=$(this).next("div.toolSectionBody");$(this).click(function(){o.is(":hidden")?(s&&s.slideUp("fast"),s=o,o.slideDown("fast")):(o.slideUp("fast"),s=null)})}),(0,y.default)("workflow-name","workflow-name",i.urls.rename_async,"new_name"),$("#workflow-tag").click(function(){return $(".tag-area").click(),!1}),(0,y.default)("workflow-annotation","workflow-annotation",i.urls.annotate_async,"new_annotation",25,!0,4)},_buildToolPanelWorkflows:function(){var o=this,e=$('
');return _.each(this.options.workflows,function(t){if(t.id!==o.options.id){var i=new g.default.ButtonIcon({icon:"fa fa-copy",cls:"ui-button-icon-plain",tooltip:"Copy and insert individual steps",onclick:function(){t.step_count<2?o.copy_into_workflow(t.id,t.name):Galaxy.modal.show({title:"Warning",body:"This will copy "+t.step_count+" new steps into your workflow.",buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:function(){Galaxy.modal.hide(),o.copy_into_workflow(t.id,t.name)}}})}}),a=$("").attr("href","#").html(t.name).on("click",function(){o.add_node_for_subworkflow(t.latest_id,t.name)});e.find(".toolSectionBg").append($("").addClass("toolTitle").append(a).append(i.$el))}}),e},copy_into_workflow:function(o){var e=this;this._workflowLoadAjax(o,{success:function(o){e.workflow.from_simple(o,!1);var t="";$.each(o.upgrade_messages,function(o,i){t+="
"}),t?window.show_modal("Subworkflow embedded with changes","Problems were encountered loading this workflow (possibly a result of tool upgrades). Please review the following parameters and then save.
"}),t.html(a),i.show()):(t.html(a),i.hide())},showAttributes:function(){$(".right-content").hide(),$("#edit-attributes").show()},showForm:function(o,e){var t="right-content",i=t+"-"+e.id,a=$("#"+t);if(o&&0==a.find("#"+i).length){var n=$('');if(o.node=e,o.workflow=this.workflow,o.datatypes=this.datatypes,o.icon=m.default[e.type],o.cls="ui-portlet-narrow",e){var s="tool"==e.type?"Tool":"Default";n.append(new k.default[s](o).form.$el),a.append(n)}else Galaxy.emit.debug("workflow-view::initialize()","Node not found in workflow.")}$("."+t).hide(),a.find("#"+i).show(),a.show(),a.scrollTop()},isSubType:function(o,e){return o=this.ext_to_type[o],e=this.ext_to_type[e],this.type_to_type[o]&&e in this.type_to_type[o]},prebuildNode:function(o,e,t){var i=this,a=$(""),n=$("