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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 2a0591240942 Camel 23517 tui history tab 2 (#23236)
2a0591240942 is described below

commit 2a0591240942600095f5bd5626d365e28f595935
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu May 14 22:07:55 2026 +0200

    Camel 23517 tui history tab 2 (#23236)
    
    * CAMEL-23517: Add exchange properties to History tab detail panel
    
    Add 'p' key to toggle exchange properties display on/off in the
    History tab detail panel. Properties shown before headers with
    same type prefix format (dimmed, 20 chars, shortTypeName).
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
    
    * CAMEL-23517: Add exchange variables to History tab detail panel
    
    Add 'v' key to toggle exchange variables display on/off in the
    History tab detail panel. Variables shown after properties and
    before headers, with same type prefix format.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
    
    ---------
    
    Signed-off-by: Claus Ibsen <[email protected]>
    Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
---
 .../dsl/jbang/core/commands/tui/CamelMonitor.java  | 99 +++++++++++++++++++++-
 1 file changed, 98 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 9fa43dfb3209..99bb52adc022 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
@@ -181,6 +181,8 @@ public class CamelMonitor extends CamelCommand {
     // History state
     private volatile List<HistoryEntry> historyEntries = 
Collections.emptyList();
     private final TableState historyTableState = new TableState();
+    private boolean showHistoryProperties;
+    private boolean showHistoryVariables;
     private boolean showHistoryHeaders = true;
     private boolean showHistoryBody = true;
     private boolean historyWordWrap;
@@ -497,8 +499,16 @@ public class CamelMonitor extends CamelCommand {
                 }
             }
 
-            // History tab: headers/body toggle and refresh
+            // History tab: properties/headers/body toggle and refresh
             if (tab == TAB_HISTORY) {
+                if (ke.isCharIgnoreCase('p')) {
+                    showHistoryProperties = !showHistoryProperties;
+                    return true;
+                }
+                if (ke.isCharIgnoreCase('v')) {
+                    showHistoryVariables = !showHistoryVariables;
+                    return true;
+                }
                 if (ke.isCharIgnoreCase('h')) {
                     showHistoryHeaders = !showHistoryHeaders;
                     return true;
@@ -2256,6 +2266,51 @@ public class CamelMonitor extends CamelCommand {
         }
         lines.add(Line.from(Span.raw("")));
 
+        // Headers
+        // Exchange Properties
+        if (showHistoryProperties && entry.exchangeProperties != null && 
!entry.exchangeProperties.isEmpty()) {
+            lines.add(Line.from(Span.styled(" Exchange Properties:", 
Style.EMPTY.fg(Color.GREEN).bold())));
+            for (Map.Entry<String, Object> p : 
entry.exchangeProperties.entrySet()) {
+                String type = entry.exchangePropertyTypes != null ? 
entry.exchangePropertyTypes.get(p.getKey()) : null;
+                String typeLabel;
+                if (type != null) {
+                    String t = "(" + type + ")";
+                    t = truncate(t, 20);
+                    typeLabel = String.format("%-20s ", t);
+                } else {
+                    typeLabel = String.format("%-21s", "");
+                }
+                lines.add(Line.from(
+                        Span.styled("   " + typeLabel, Style.EMPTY.dim()),
+                        Span.styled(p.getKey(), Style.EMPTY.fg(Color.CYAN)),
+                        Span.raw(" = "),
+                        Span.raw(p.getValue() != null ? 
p.getValue().toString() : "null")));
+            }
+            lines.add(Line.from(Span.raw("")));
+        }
+
+        // Exchange Variables
+        if (showHistoryVariables && entry.exchangeVariables != null && 
!entry.exchangeVariables.isEmpty()) {
+            lines.add(Line.from(Span.styled(" Exchange Variables:", 
Style.EMPTY.fg(Color.GREEN).bold())));
+            for (Map.Entry<String, Object> v : 
entry.exchangeVariables.entrySet()) {
+                String type = entry.exchangeVariableTypes != null ? 
entry.exchangeVariableTypes.get(v.getKey()) : null;
+                String typeLabel;
+                if (type != null) {
+                    String t = "(" + type + ")";
+                    t = truncate(t, 20);
+                    typeLabel = String.format("%-20s ", t);
+                } else {
+                    typeLabel = String.format("%-21s", "");
+                }
+                lines.add(Line.from(
+                        Span.styled("   " + typeLabel, Style.EMPTY.dim()),
+                        Span.styled(v.getKey(), Style.EMPTY.fg(Color.CYAN)),
+                        Span.raw(" = "),
+                        Span.raw(v.getValue() != null ? 
v.getValue().toString() : "null")));
+            }
+            lines.add(Line.from(Span.raw("")));
+        }
+
         // Headers
         if (showHistoryHeaders && entry.headers != null && 
!entry.headers.isEmpty()) {
             lines.add(Line.from(Span.styled(" Headers:", 
Style.EMPTY.fg(Color.GREEN).bold())));
@@ -2444,6 +2499,8 @@ public class CamelMonitor extends CamelCommand {
             hint(spans, "Esc", "back");
             hint(spans, "\u2191\u2193", "navigate");
             hint(spans, "PgUp/PgDn", "scroll detail");
+            hint(spans, "p", "properties" + (showHistoryProperties ? " [on]" : 
" [off]"));
+            hint(spans, "v", "variables" + (showHistoryVariables ? " [on]" : " 
[off]"));
             hint(spans, "h", "headers" + (showHistoryHeaders ? " [on]" : " 
[off]"));
             hint(spans, "b", "body" + (showHistoryBody ? " [on]" : " [off]"));
             hint(spans, "w", "wrap" + (historyWordWrap ? " [on]" : " [off]"));
@@ -2945,6 +3002,42 @@ public class CamelMonitor extends CamelCommand {
             } else if (bodyObj != null) {
                 entry.body = bodyObj.toString();
             }
+
+            Object propsObj = message.get("exchangeProperties");
+            if (propsObj instanceof List<?> propList) {
+                entry.exchangeProperties = new LinkedHashMap<>();
+                entry.exchangePropertyTypes = new LinkedHashMap<>();
+                for (Object p : propList) {
+                    if (p instanceof JsonObject pObj) {
+                        String key = String.valueOf(pObj.get("key"));
+                        entry.exchangeProperties.put(key, pObj.get("value"));
+                        Object type = pObj.get("type");
+                        if (type != null) {
+                            entry.exchangePropertyTypes.put(key, 
TuiHelper.shortTypeName(type.toString()));
+                        }
+                    }
+                }
+            } else if (propsObj instanceof Map) {
+                entry.exchangeProperties = new LinkedHashMap<>((Map<String, 
Object>) propsObj);
+            }
+
+            Object varsObj = message.get("exchangeVariables");
+            if (varsObj instanceof List<?> varList) {
+                entry.exchangeVariables = new LinkedHashMap<>();
+                entry.exchangeVariableTypes = new LinkedHashMap<>();
+                for (Object v : varList) {
+                    if (v instanceof JsonObject vObj) {
+                        String key = String.valueOf(vObj.get("key"));
+                        entry.exchangeVariables.put(key, vObj.get("value"));
+                        Object type = vObj.get("type");
+                        if (type != null) {
+                            entry.exchangeVariableTypes.put(key, 
TuiHelper.shortTypeName(type.toString()));
+                        }
+                    }
+                }
+            } else if (varsObj instanceof Map) {
+                entry.exchangeVariables = new LinkedHashMap<>((Map<String, 
Object>) varsObj);
+            }
         }
 
         // Exception
@@ -3361,6 +3454,10 @@ public class CamelMonitor extends CamelCommand {
         String exception;
         Map<String, Object> headers;
         Map<String, String> headerTypes;
+        Map<String, Object> exchangeProperties;
+        Map<String, String> exchangePropertyTypes;
+        Map<String, Object> exchangeVariables;
+        Map<String, String> exchangeVariableTypes;
     }
 
     record VanishingInfo(IntegrationInfo info, long startTime) {

Reply via email to