galaxy-dist commit cf7ec71c5613: Shift management of the interaction between workflow outputs and HideDatasetActions to the front end editor.
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Dannon Baker <dannonbaker@me.com> # Date 1288645730 14400 # Node ID cf7ec71c561323940ce95c8148d2008508920092 # Parent 1efe19f6f3d1a75bda9c198633dd8102d3063410 Shift management of the interaction between workflow outputs and HideDatasetActions to the front end editor. This resolves the issue with multiple HideDatasetActions being created. Existing workflows displaying multiple HideDatasetActions per step on the Run Workflow screen will persist. These extra HideDatasetActions are harmless, but a simple edit workflow -> save will remove them. --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -1270,13 +1270,6 @@ class WorkflowController( BaseController workflow_invocation = model.WorkflowInvocation() workflow_invocation.workflow = workflow outputs = odict() - # Find out if there are any workflow outputs defined, as that influences our actions. - use_workflow_outputs = False - for step in workflow.steps: - if step.type == 'tool' or step.type is None: - if step.workflow_outputs: - use_workflow_outputs = True - break for i, step in enumerate( workflow.steps ): # Execute module job = None @@ -1294,24 +1287,6 @@ class WorkflowController( BaseController job, out_data = tool.execute( trans, step.state.inputs ) outputs[ step.id ] = out_data # Create new PJA associations with the created job, to be run on completion. - if use_workflow_outputs: - # We're using outputs. Check the step for outputs to be displayed. Create PJAs to hide the rest upon completion. - step_outputs = [s.output_name for s in step.workflow_outputs] - for output in tool.outputs.keys(): - if output not in step_outputs: - # Necessary, unfortunately, to clean up workflows that might have more than one at this point. - for pja in step.post_job_actions: - if pja.action_type == "HideDatasetAction" and pja.output_name == output: - step.post_job_actions.remove(pja) - trans.sa_session.delete(pja) - # Create a PJA for hiding this output. - n_pja = PostJobAction('HideDatasetAction', step, output, {}) - else: - # Remove any HideDatasetActions, step is flagged for output. - for pja in step.post_job_actions: - if pja.action_type == "HideDatasetAction" and pja.output_name == output: - step.post_job_actions.remove(pja) - trans.sa_session.delete(pja) for pja in step.post_job_actions: if pja.action_type in ActionBox.immediate_actions: ActionBox.execute(trans.app, trans.sa_session, pja, job) --- a/static/scripts/galaxy.workflow_editor.canvas.js +++ b/static/scripts/galaxy.workflow_editor.canvas.js @@ -475,6 +475,63 @@ function Workflow( canvas_container ) { wf.remove_node( v ); }); }, + rectify_workflow_outputs : function() { + console.log("RECTIFICATION!"); + // Find out if we're using workflow_outputs or not. + var using_workflow_outputs = false; + $.each( this.nodes, function ( k, node ) { + if (node.workflow_outputs && node.workflow_outputs.length > 0){ + using_workflow_outputs = true; + } + }); + if (using_workflow_outputs == false){ + //We're done, leave PJAs alone. + return true; + } + wf = this; + $.each(this.nodes, function (k, node ){ + if (node.type == 'tool'){ + var node_changed = false; + if (node.post_job_actions == null){ + console.log("CREATED FOR NEW NODE"); + node.post_job_actions = {}; + } + var pjas_to_rem = []; + $.each(node.post_job_actions, function(pja_id, pja){ + if (pja.action_type == "HideDatasetAction"){ + pjas_to_rem.push(pja_id); + } + }); + if (pjas_to_rem.length > 0 && node == workflow.active_node) + $.each(pjas_to_rem, function(i, pja_name){ + node_changed = true; + delete node.post_job_actions[pja_name]; + }) + $.each(node.output_terminals, function(ot_id, ot){ + var create_pja = true; + $.each(node.workflow_outputs, function(i, wo_name){ + if (ot.name == wo_name){ + create_pja = false; + } + }); + if (create_pja == true){ + node_changed = true; + var pja = { + action_type : "HideDatasetAction", + output_name : ot.name, + action_arguments : {} + } + node.post_job_actions['HideDatasetAction'+ot.name] = null; + node.post_job_actions['HideDatasetAction'+ot.name] = pja; + } + }); + // lastly, if this is the active node, and we made changes, reload the display at right. + if (wf.active_node == node && node_changed == true) { + wf.reload_active_node(); + } + } + }); + }, to_simple : function () { var nodes = {}; $.each( this.nodes, function ( i, node ) { @@ -491,7 +548,6 @@ function Workflow( canvas_container ) { if (node.post_job_actions){ $.each( node.post_job_actions, function ( i, act ) { var pja = { - job_id : act.id, action_type : act.action_type, output_name : act.output_name, action_arguments : act.action_arguments @@ -559,6 +615,10 @@ function Workflow( canvas_container ) { this.active_form_has_changes = false; } }, + reload_active_node : function() { + this.clear_active_node(); + this.activate_node(node); + }, clear_active_node : function() { if ( this.active_node ) { this.active_node.make_inactive(); --- a/templates/workflow/editor.mako +++ b/templates/workflow/editor.mako @@ -627,6 +627,7 @@ } return; } + workflow.rectify_workflow_outputs(); var savefn = function(callback) { $.ajax( { url: "${h.url_for( action='save_workflow' )}",
participants (1)
-
commits-noreply@bitbucket.org