You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/05/18 14:51:59 UTC
(camel) 09/39: TUI: HTTP tab — add CONSUMES column, sort on consumes/produces
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch feat/camel-tui
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2d0c4047ecaaf3a79ec72968aa031ac303b1ac01
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon May 18 10:11:49 2026 +0200
TUI: HTTP tab — add CONSUMES column, sort on consumes/produces
- Add CONSUMES column between PATH and PRODUCES
- Expand HTTP_SORT_COLUMNS to include consumes and produces
- Both CONSUMES and PRODUCES headers now show sort indicator (▼/▲)
when active, consistent with other tabs
- Tighten METHOD column (14→12) to fit the extra column
STATE column (REST DSL only): reflects ServiceStatus of the underlying
route consumer — Started/Stopped/Suspended. Always blank for
Platform-HTTP endpoints since the HTTP engine has no per-endpoint state.
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 26 ++++++++++------------
1 file changed, 12 insertions(+), 14 deletions(-)
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 7030b1deeb81..fa40e567e029 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
@@ -144,7 +144,7 @@ public class CamelMonitor extends CamelCommand {
private static final String[] CB_SORT_COLUMNS = { "route", "id", "component", "state" };
// HTTP sort columns
- private static final String[] HTTP_SORT_COLUMNS = { "method", "path", "source" };
+ private static final String[] HTTP_SORT_COLUMNS = { "method", "path", "source", "consumes", "produces" };
@CommandLine.Parameters(description = "Name or pid of running Camel integration", arity = "0..1")
String name = "*";
@@ -3516,17 +3516,11 @@ public class CamelMonitor extends CamelCommand {
// Sort
visible.sort((a, b) -> {
int result = switch (httpSort) {
- case "path" -> {
- String pa = a.path != null ? a.path : "";
- String pb = b.path != null ? b.path : "";
- yield pa.compareToIgnoreCase(pb);
- }
+ case "path" -> compareStr(a.path, b.path);
case "source" -> Boolean.compare(b.fromRest, a.fromRest);
- default -> { // method
- String ma = a.method != null ? a.method : "";
- String mb = b.method != null ? b.method : "";
- yield ma.compareToIgnoreCase(mb);
- }
+ case "consumes" -> compareStr(a.consumes, b.consumes);
+ case "produces" -> compareStr(a.produces, b.produces);
+ default -> compareStr(a.method, b.method); // "method"
};
return httpSortReversed ? -result : result;
});
@@ -3592,6 +3586,7 @@ public class CamelMonitor extends CamelCommand {
for (HttpEndpointInfo ep : visible) {
String method = ep.method != null ? ep.method : "";
String path = ep.path != null ? ep.path : (ep.url != null ? ep.url : "");
+ String consumes = ep.consumes != null ? ep.consumes : "";
String produces = ep.produces != null ? ep.produces : "";
String source;
if (ep.management) {
@@ -3605,6 +3600,7 @@ public class CamelMonitor extends CamelCommand {
rows.add(Row.from(
Cell.from(Span.styled(method, methodStyle(method))),
Cell.from(path),
+ Cell.from(consumes),
Cell.from(produces),
Cell.from(Span.styled(source,
ep.fromRest ? Style.EMPTY.fg(Color.GREEN) : Style.EMPTY.fg(Color.CYAN))),
@@ -3617,7 +3613,8 @@ public class CamelMonitor extends CamelCommand {
Row header = Row.from(
Cell.from(Span.styled(httpSortLabel("METHOD", "method"), httpSortStyle("method"))),
Cell.from(Span.styled(httpSortLabel("PATH", "path"), httpSortStyle("path"))),
- Cell.from(Span.styled("PRODUCES", Style.EMPTY.bold())),
+ Cell.from(Span.styled(httpSortLabel("CONSUMES", "consumes"), httpSortStyle("consumes"))),
+ Cell.from(Span.styled(httpSortLabel("PRODUCES", "produces"), httpSortStyle("produces"))),
Cell.from(Span.styled(httpSortLabel("SOURCE", "source"), httpSortStyle("source"))),
Cell.from(Span.styled("STATE", Style.EMPTY.bold())));
@@ -3625,9 +3622,10 @@ public class CamelMonitor extends CamelCommand {
.rows(rows)
.header(header)
.widths(
- Constraint.length(14),
+ Constraint.length(12),
Constraint.fill(),
- Constraint.length(24),
+ Constraint.length(20),
+ Constraint.length(20),
Constraint.length(15),
Constraint.length(8))
.highlightStyle(Style.EMPTY.fg(Color.WHITE).bold().onBlue())