mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
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:
@@ -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;
|
||||
|
||||
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user