This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-23672-tui-diagram in repository https://gitbox.apache.org/repos/asf/camel.git
commit a662efaf167eb28acef089a3630e96bc692ebfcc Author: Claus Ibsen <[email protected]> AuthorDate: Wed Jun 3 22:30:10 2026 +0200 CAMEL-23672: camel-tui - Select from node on drill-down instead of route When drilling down to a route or jumping between routes, select the from node as the initial selection instead of the route structural node, which is more natural for navigation. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/dsl/jbang/core/commands/tui/DiagramSupport.java | 13 +++++++++++++ .../camel/dsl/jbang/core/commands/tui/DiagramTab.java | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramSupport.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramSupport.java index 4bae049f477a..b6288889e22f 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramSupport.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramSupport.java @@ -568,6 +568,19 @@ class DiagramSupport { this.selectedEipNodeIndex = idx; } + void selectFromNode(String routeId) { + var layout = routeLayouts.get(routeId); + if (layout != null) { + for (int i = 0; i < layout.nodes.size(); i++) { + if ("from".equals(layout.nodes.get(i).type)) { + selectedEipNodeIndex = i; + return; + } + } + } + selectedEipNodeIndex = 0; + } + org.apache.camel.dsl.jbang.core.commands.tui.diagram.RouteDiagramWidget.EipNodeBox getSelectedEipNodeBox() { if (selectedEipNodeIndex >= 0 && selectedEipNodeIndex < eipNodeBoxes.size()) { return eipNodeBoxes.get(selectedEipNodeIndex); diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java index d4b16b783468..3d16c4e426b9 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/DiagramTab.java @@ -141,7 +141,7 @@ class DiagramTab implements MonitorTab { if (linkedRouteId != null && diagram.getRouteLayout(linkedRouteId) != null) { routeNavigationStack.push(drillDownRouteId); drillDownRouteId = linkedRouteId; - diagram.setSelectedEipNodeIndex(0); + diagram.selectFromNode(linkedRouteId); diagram.resetScroll(); return true; } @@ -158,7 +158,7 @@ class DiagramTab implements MonitorTab { drillDownRouteId = selectedRouteId; topologyMode = false; diagram.setTopologyMode(false); - diagram.setSelectedEipNodeIndex(0); + diagram.selectFromNode(selectedRouteId); diagram.resetScroll(); diagram.endLoad(); // Use cached route layout if available (no IPC needed) @@ -180,7 +180,7 @@ class DiagramTab implements MonitorTab { if (!routeNavigationStack.isEmpty()) { // Go back to the previous route in the stack drillDownRouteId = routeNavigationStack.pop(); - diagram.setSelectedEipNodeIndex(0); + diagram.selectFromNode(drillDownRouteId); diagram.resetScroll(); return true; }
