Refactor interaction between workflows JS and editor JS for adding nodes.

Add abstraction into editor for use by galaxy.workflow.js to hide some editor details from workflow code and reduce duplication between add_node_for_tool and add_node_for_module.
This commit is contained in:
John Chilton
2014-04-10 13:31:47 -05:00
parent 9b0bbb0dab
commit 69ddb38557
2 changed files with 14 additions and 10 deletions
@@ -892,6 +892,18 @@ function prebuild_node( type, title_text, tool_id ) {
return node;
}
function add_node( type, title_text, tool_id ) {
// Abstraction for use by galaxy.workflow.js to hide
// some editor details from workflow code and reduce duplication
// between add_node_for_tool and add_node_for_module.
var node = prebuild_node( type, title_text, tool_id );
workflow.add_node( node );
workflow.fit_canvas_to_nodes();
canvas_manager.draw_overview();
workflow.activate_node( node );
return node;
}
var ext_to_type = null;
var type_to_type = null;
+2 -10
View File
@@ -320,11 +320,7 @@ function scroll_to_nodes() {
// Add a new step to the workflow by tool id
function add_node_for_tool( id, title ) {
var node = prebuild_node( 'tool', title, id );
workflow.add_node( node );
workflow.fit_canvas_to_nodes();
canvas_manager.draw_overview();
workflow.activate_node( node );
node = add_node( 'tool', title, id );
$.ajax( {
url: get_new_module_info_url,
data: { type: "tool", tool_id: id, "_": "true" },
@@ -344,11 +340,7 @@ function add_node_for_tool( id, title ) {
}
function add_node_for_module( type, title ) {
node = prebuild_node( type, title );
workflow.add_node( node );
workflow.fit_canvas_to_nodes();
canvas_manager.draw_overview();
workflow.activate_node( node );
node = add_node( type, title );
$.ajax( {
url: get_new_module_info_url,
data: { type: type, "_": "true" },