This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch fix/camel-tui-circuit-breaker
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/fix/camel-tui-circuit-breaker 
by this push:
     new c7d6d423a788 TUI: show OPEN count in red on Circuit Breaker tab label 
when breakers are open
c7d6d423a788 is described below

commit c7d6d423a788299d762912758557d216e9a6e063
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat May 16 15:39:55 2026 +0200

    TUI: show OPEN count in red on Circuit Breaker tab label when breakers are 
open
    
    When one or more circuit breakers are OPEN or FORCED_OPEN, the tab title
    changes to a red '(N OPEN)' badge — same pattern as the Health tab's
    '(N DOWN)' indicator.
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 .../dsl/jbang/core/commands/tui/CamelMonitor.java      | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
index 54d0e846b871..3d8a9e154f21 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
@@ -818,6 +818,12 @@ public class CamelMonitor extends CamelCommand {
         int routeCount = hasSelection ? sel.routes.size() : 0;
         int endpointCount = hasSelection ? sel.endpoints.size() : 0;
         int cbCount = hasSelection ? sel.circuitBreakers.size() : 0;
+        long cbOpenCount = hasSelection
+                ? sel.circuitBreakers.stream()
+                        .filter(cb -> cb.state != null && 
(cb.state.equalsIgnoreCase("open")
+                                || cb.state.equalsIgnoreCase("forced_open")))
+                        .count()
+                : 0;
         int healthCount = hasSelection ? sel.healthChecks.size() : 0;
         long healthDownCount = hasSelection
                 ? sel.healthChecks.stream().filter(hc -> 
"DOWN".equals(hc.state)).count() : 0;
@@ -830,7 +836,7 @@ public class CamelMonitor extends CamelCommand {
                         Line.from(" 2 Log "),
                         badge(" 3 Routes ", routeCount),
                         badge(" 4 Endpoints ", endpointCount),
-                        badge(" 5 Circuit Breaker ", cbCount),
+                        badgeCb(" 5 Circuit Breaker ", cbCount, cbOpenCount),
                         badgeHealth(" 6 Health ", healthCount, 
healthDownCount),
                         badge(" 7 History ", historyCount),
                         hasTraces
@@ -2943,6 +2949,16 @@ public class CamelMonitor extends CamelCommand {
         return Cell.from(Span.styled(" ".repeat(leftPad) + text, style));
     }
 
+    private static Line badgeCb(String label, long total, long open) {
+        if (open > 0) {
+            return Line.from(
+                    Span.raw(label),
+                    Span.styled("(" + open + " OPEN)", 
Style.EMPTY.fg(Color.RED).bold()),
+                    Span.raw(" "));
+        }
+        return badge(label, total);
+    }
+
     private static Line badgeHealth(String label, long total, long down) {
         if (down > 0) {
             return Line.from(

Reply via email to