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 4780ad5ba1a00cb288d2a6e2c8d3073085d1368a
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jun 4 10:24:20 2026 +0200

    CAMEL-23672: camel-tui - Add description toggle to routes tab
    
    Co-Authored-By: Claude <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/tui/RouteInfo.java      |  1 +
 .../dsl/jbang/core/commands/tui/RoutesTab.java      | 21 ++++++++++++++++++---
 .../dsl/jbang/core/commands/tui/StatusParser.java   |  1 +
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteInfo.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteInfo.java
index 672dbd6447a5..8f309088d39a 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteInfo.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteInfo.java
@@ -21,6 +21,7 @@ import java.util.List;
 
 class RouteInfo {
     String routeId;
+    String description;
     String group;
     String from;
     String state;
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
index 24c72adc6df5..0b61a0283652 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
@@ -69,6 +69,7 @@ class RoutesTab implements MonitorTab {
     private final SourceViewer sourceViewer = new SourceViewer();
     private boolean diagramAllRoutes;
     private boolean diagramMetrics = true;
+    private boolean showDescription;
     private String diagramRouteId;
 
     RoutesTab(MonitorContext ctx) {
@@ -151,6 +152,12 @@ class RoutesTab implements MonitorTab {
             return true;
         }
 
+        // Toggle description in route table
+        if (!sourceViewer.isVisible() && !diagram.isShowDiagram() && 
ke.isCharIgnoreCase('n')) {
+            showDescription = !showDescription;
+            return true;
+        }
+
         // Text diagram toggle
         if (ke.isCharIgnoreCase('d')) {
             diagram.toggleDiagram(this::loadDiagramForSelectedRoute);
@@ -272,7 +279,7 @@ class RoutesTab implements MonitorTab {
 
                 routeRows.add(Row.from(
                         Cell.from(Span.styled(route.routeId != null ? 
route.routeId : "", Style.EMPTY.fg(Color.CYAN))),
-                        Cell.from(route.from != null ? route.from : ""),
+                        Cell.from(routeFromLabel(route)),
                         rightCell(route.total > 0 ? 
String.valueOf(route.meanTime) : "", 6, topTimeStyle(route.meanTime)),
                         rightCell(route.total > 0 ? 
String.valueOf(route.maxTime) : "", 6, topTimeStyle(route.maxTime)),
                         rightCell(route.total > 0 ? 
String.valueOf(route.minTime) : "", 6),
@@ -334,7 +341,7 @@ class RoutesTab implements MonitorTab {
 
                 routeRows.add(Row.from(
                         Cell.from(Span.styled(route.routeId != null ? 
route.routeId : "", Style.EMPTY.fg(Color.CYAN))),
-                        Cell.from(route.from != null ? route.from : ""),
+                        Cell.from(routeFromLabel(route)),
                         Cell.from(Span.styled(route.state != null ? 
route.state : "", stateStyle)),
                         Cell.from(route.uptime != null ? route.uptime : ""),
                         rightCell(route.coverage != null ? route.coverage : 
"", 6),
@@ -417,6 +424,7 @@ class RoutesTab implements MonitorTab {
             hint(spans, "Esc", "back");
             hint(spans, "↑↓", "navigate");
             hint(spans, "s", "sort");
+            hint(spans, "n", "description" + (showDescription ? " [on]" : " 
[off]"));
             hint(spans, "t", routeTopMode ? "top [on]" : "top [off]");
             if (!routeTopMode) {
                 hint(spans, "c", "source");
@@ -447,6 +455,13 @@ class RoutesTab implements MonitorTab {
         }
     }
 
+    private String routeFromLabel(RouteInfo route) {
+        if (showDescription && route.description != null && 
!route.description.isBlank()) {
+            return route.description;
+        }
+        return route.from != null ? route.from : "";
+    }
+
     // ---- Rendering helpers ----
 
     private void renderProcessors(Frame frame, Rect area, RouteInfo route) {
@@ -612,7 +627,7 @@ class RoutesTab implements MonitorTab {
                     : Style.EMPTY;
             rows.add(Row.from(
                     Cell.from(Span.styled(route.routeId != null ? 
route.routeId : "", Style.EMPTY.fg(Color.CYAN))),
-                    Cell.from(route.from != null ? route.from : ""),
+                    Cell.from(routeFromLabel(route)),
                     Cell.from(Span.styled(route.state != null ? route.state : 
"", stateStyle)),
                     Cell.from(route.uptime != null ? route.uptime : ""),
                     rightCell(route.throughput != null ? route.throughput : 
"", 8),
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StatusParser.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StatusParser.java
index c3a37e17e602..4932e49c4e74 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StatusParser.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/StatusParser.java
@@ -165,6 +165,7 @@ final class StatusParser {
                 JsonObject rj = (JsonObject) r;
                 RouteInfo ri = new RouteInfo();
                 ri.routeId = rj.getString("routeId");
+                ri.description = rj.getString("description");
                 ri.group = rj.getString("group");
                 ri.from = rj.getString("from");
                 ri.state = rj.getString("state");

Reply via email to