This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-23631-route-diagram-highlight-error-path in repository https://gitbox.apache.org/repos/asf/camel.git
commit 467a2c44de2f3a065db67f1e2362f921e3ebb222 Author: Claus Ibsen <[email protected]> AuthorDate: Wed May 27 22:51:32 2026 +0200 CAMEL-23631: Use general parent-node resolution for diagram highlights Co-Authored-By: Claude <[email protected]> --- .../core/commands/action/CamelHistoryAction.java | 38 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java index 715e980656cb..93292902c65e 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java @@ -391,16 +391,13 @@ public class CamelHistoryAction extends ActionWatchCommand { return 1; } - // add route and from node IDs for each route that has highlighted nodes - // (the history trace only has processor nodeIds, not the structural route/from nodes) + // add structural parent node IDs for each route that has highlighted nodes + // (the history trace only has processor nodeIds, not structural route/from + // or scope EIP nodes like circuitBreaker, filter, split, doTry, etc.) for (RouteInfo route : routes) { boolean routeHasHighlight = route.nodes.stream().anyMatch(n -> n.id != null && nodeIds.contains(n.id)); if (routeHasHighlight) { - for (RouteDiagramLayoutEngine.NodeInfo node : route.nodes) { - if (node.id != null && ("route".equals(node.type) || "from".equals(node.type))) { - nodeIds.add(node.id); - } - } + addParentNodes(route.nodes, nodeIds); } } @@ -463,6 +460,33 @@ public class CamelHistoryAction extends ActionWatchCommand { } } + private static void addParentNodes(List<RouteDiagramLayoutEngine.NodeInfo> nodes, Set<String> nodeIds) { + // walk the flat node list and add any parent node whose children contain highlighted nodes + // this bridges gaps in the arrow chain for scope EIPs (circuitBreaker, filter, split, etc.) + // and structural nodes (route, from) + for (int i = 0; i < nodes.size(); i++) { + RouteDiagramLayoutEngine.NodeInfo node = nodes.get(i); + if (node.id == null || nodeIds.contains(node.id)) { + continue; + } + // check if any child (higher level following this node) is highlighted + boolean hasHighlightedChild = false; + for (int j = i + 1; j < nodes.size(); j++) { + RouteDiagramLayoutEngine.NodeInfo child = nodes.get(j); + if (child.level <= node.level) { + break; + } + if (child.id != null && nodeIds.contains(child.id)) { + hasHighlightedChild = true; + break; + } + } + if (hasHighlightedChild) { + nodeIds.add(node.id); + } + } + } + private boolean isTextTheme() { return "ascii".equalsIgnoreCase(theme) || "unicode".equalsIgnoreCase(theme); }
