Skip to content

Commit b001019

Browse files
xwk1246jsonporter
andauthored
feat: add failure node support (#878)
add failure node support Signed-off-by: xwk1246 <wenkai@union.ai> Co-authored-by: Jason Porter <84735036+jsonporter@users.noreply.github.com>
1 parent c74e22e commit b001019

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

packages/oss-console/src/components/WorkflowGraph/transformerWorkflowToDag.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ const parseWorkflow = ({
451451
}
452452

453453
const templateNodeList = context.template.nodes;
454-
455454
/* Build Nodes from template */
456455
for (let i = 0; i < templateNodeList.length; i++) {
457456
const compiledNode: CompiledNode = templateNodeList[i];
@@ -475,6 +474,28 @@ const parseWorkflow = ({
475474
};
476475
}
477476

477+
/* Build failure node and add downstream connection for edges building */
478+
const failureNode = { ...context.template.failureNode, failureNode: true };
479+
if (failureNode && failureNode.id) {
480+
parseNode({
481+
node: failureNode as CompiledNode,
482+
root,
483+
nodeMetadataMap,
484+
staticExecutionIdsMap,
485+
compiledWorkflowClosure,
486+
});
487+
nodeMap[failureNode.id] = {
488+
dNode: root.nodes[root.nodes.length - 1],
489+
compiledNode: failureNode as CompiledNode,
490+
};
491+
if (!context.connections.downstream[startNodeId].ids.includes(failureNode.id)) {
492+
context.connections.downstream[startNodeId].ids.push(failureNode.id);
493+
context.connections.downstream[failureNode.id] = {
494+
ids: [endNodeId],
495+
};
496+
}
497+
}
498+
478499
/* Build Edges */
479500
buildWorkflowEdges({
480501
root,

0 commit comments

Comments
 (0)