From f89be266d9dece1d0cdd9f73da21d77162ea985d Mon Sep 17 00:00:00 2001 From: Lyon Lu Date: Sat, 24 Feb 2024 04:42:44 +0800 Subject: [PATCH] feat: display failure node in workflow graph Signed-off-by: Lyon Lu --- .../transformerWorkflowToDag.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx b/packages/console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx index 97c40e29e..ac638be03 100644 --- a/packages/console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx +++ b/packages/console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx @@ -492,6 +492,28 @@ const parseWorkflow = ( }; } + /* Build failure node and add downstream connection for edges building */ + const failureNode = context.template.failureNode; + if (failureNode && failureNode.id) { + parseNode({ + node: failureNode as CompiledNode, + root: root, + dynamicToMerge, + nodeExecutionsById, + staticExecutionIdsMap, + workflow, + }); + nodeMap[failureNode.id] = { + dNode: root.nodes[root.nodes.length - 1], + compiledNode: failureNode as CompiledNode, + }; + if ( + !context.connections.downstream[startNodeId].ids.includes(failureNode.id) + ) { + context.connections.downstream[startNodeId].ids.push(failureNode.id); + } + } + /* Build Edges */ buildWorkflowEdges(root, context.connections, startNodeId, nodeMap); return root;