From 508c24419c83aa13d3b93f4a3020781b699eb447 Mon Sep 17 00:00:00 2001 From: xwk1246 Date: Tue, 28 May 2024 23:26:13 +0800 Subject: [PATCH] add failure node support Signed-off-by: xwk1246 --- .../transformerWorkflowToDag.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/oss-console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx b/packages/oss-console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx index b45b213bd..a3dbbf5a4 100644 --- a/packages/oss-console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx +++ b/packages/oss-console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx @@ -451,7 +451,6 @@ const parseWorkflow = ({ } const templateNodeList = context.template.nodes; - /* Build Nodes from template */ for (let i = 0; i < templateNodeList.length; i++) { const compiledNode: CompiledNode = templateNodeList[i]; @@ -475,6 +474,28 @@ const parseWorkflow = ({ }; } + /* Build failure node and add downstream connection for edges building */ + const failureNode = { ...context.template.failureNode, failureNode: true }; + if (failureNode && failureNode.id) { + parseNode({ + node: failureNode as CompiledNode, + root, + nodeMetadataMap, + staticExecutionIdsMap, + compiledWorkflowClosure, + }); + 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); + context.connections.downstream[failureNode.id] = { + ids: [endNodeId], + }; + } + } + /* Build Edges */ buildWorkflowEdges({ root,