From 2b5b856126e69d8a70bd7851894a4e8cb5322915 Mon Sep 17 00:00:00 2001 From: Yi Date: Fri, 30 Aug 2024 17:58:29 +0800 Subject: [PATCH] solve the branch issue --- .../components/workflow/run/tracing-panel.tsx | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/run/tracing-panel.tsx b/web/app/components/workflow/run/tracing-panel.tsx index 3f5f17972c..d2408c13b7 100644 --- a/web/app/components/workflow/run/tracing-panel.tsx +++ b/web/app/components/workflow/run/tracing-panel.tsx @@ -112,13 +112,27 @@ function buildLogTree(nodes: NodeTracing[]): TracingNodeProps[] { } } const branchTitle = parallel_start_node_id === node.node_id ? getBranchTitle(parent_parallel_id, parallelStacks[parallel_id].children.length + 1) : '' - parallelStacks[parallel_id].children.push({ - id: node.id, - isParallel: false, - data: node, - children: [], - branchTitle, - }) + if (branchTitle) { + parallelStacks[parallel_id].children.push({ + id: node.id, + isParallel: false, + data: node, + children: [], + branchTitle, + }) + } + else { + const sameBranchIndex = parallelStacks[parallel_id].children.findLastIndex(c => + c.data?.execution_metadata.parallel_start_node_id === node.execution_metadata.parallel_start_node_id, + ) + parallelStacks[parallel_id].children.splice(sameBranchIndex + 1, 0, { + id: node.id, + isParallel: false, + data: node, + children: [], + branchTitle, + }) + } } }