This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-23517-tui-history-tab-2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit af63457f0ff5d67475db7710b1a636f98a8bee35 Author: Claus Ibsen <[email protected]> AuthorDate: Thu May 14 21:42:34 2026 +0200 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]> --- .../dsl/jbang/core/commands/tui/CamelMonitor.java | 51 +++++++++++++++++++++- 1 file changed, 50 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..471ce6a82923 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,7 @@ 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 showHistoryHeaders = true; private boolean showHistoryBody = true; private boolean historyWordWrap; @@ -497,8 +498,12 @@ 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('h')) { showHistoryHeaders = !showHistoryHeaders; return true; @@ -2256,6 +2261,29 @@ 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(""))); + } + // Headers if (showHistoryHeaders && entry.headers != null && !entry.headers.isEmpty()) { lines.add(Line.from(Span.styled(" Headers:", Style.EMPTY.fg(Color.GREEN).bold()))); @@ -2444,6 +2472,7 @@ 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, "h", "headers" + (showHistoryHeaders ? " [on]" : " [off]")); hint(spans, "b", "body" + (showHistoryBody ? " [on]" : " [off]")); hint(spans, "w", "wrap" + (historyWordWrap ? " [on]" : " [off]")); @@ -2945,6 +2974,24 @@ 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); + } } // Exception @@ -3361,6 +3408,8 @@ public class CamelMonitor extends CamelCommand { String exception; Map<String, Object> headers; Map<String, String> headerTypes; + Map<String, Object> exchangeProperties; + Map<String, String> exchangePropertyTypes; } record VanishingInfo(IntegrationInfo info, long startTime) {
