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 04cdd9447d4e chore: camel-tui - show EIP category label instead of
object in autocomplete popup
04cdd9447d4e is described below
commit 04cdd9447d4e53c490a5a78e2f4f780ef0cc9f1b
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Aug 6 16:11:51 2026 +0200
chore: camel-tui - show EIP category label instead of object in
autocomplete popup
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../jbang/core/commands/tui/AutocompletePopup.java | 60 ++++++++++++++++++++--
1 file changed, 57 insertions(+), 3 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java
index dcb2ca9a30b1..5334cd8e6cb9 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AutocompletePopup.java
@@ -306,6 +306,12 @@ class AutocompletePopup {
if (ci.type() != null) {
String type = simplifyType(ci.type());
+ if ("object".equals(type) && ci.group() != null &&
!ci.group().isEmpty()) {
+ String label = primaryLabel(ci.group());
+ if (label != null) {
+ type = label;
+ }
+ }
int remaining = nameColW - displayKey.length() - 3;
if (remaining > 3 && type.length() <= remaining) {
int pad = remaining - type.length();
@@ -368,9 +374,21 @@ class AutocompletePopup {
lines.add(Line.empty());
if (selected.type() != null) {
- lines.add(Line.from(
- Span.styled("Type: ", normalStyle.bold()),
- Span.styled(simplifyType(selected.type()),
normalStyle)));
+ String typeDisplay = simplifyType(selected.type());
+ if ("object".equals(typeDisplay) && selected.group() != null
&& !selected.group().isEmpty()) {
+ String label = primaryLabel(selected.group());
+ if (label != null) {
+ lines.add(Line.from(
+ Span.styled("Category: ", normalStyle.bold()),
+ Span.styled(label, normalStyle)));
+ typeDisplay = null;
+ }
+ }
+ if (typeDisplay != null) {
+ lines.add(Line.from(
+ Span.styled("Type: ", normalStyle.bold()),
+ Span.styled(typeDisplay, normalStyle)));
+ }
}
if (selected.defaultValue() != null) {
lines.add(Line.from(
@@ -424,6 +442,42 @@ class AutocompletePopup {
return dot >= 0 ? type.substring(dot + 1) : type;
}
+ private static final String[][] LABEL_PRIORITY = {
+ { "errorhandling", "error handling" },
+ { "resilience", "resilience" },
+ { "loadbalancing", "load balancing" },
+ { "flowcontrol", "flow control" },
+ { "enrichment", "enrichment" },
+ { "transformation", "transformation" },
+ { "dataformat", "data format" },
+ { "messaging", "messaging" },
+ { "ai", "ai" },
+ { "routing", "routing" },
+ { "rest", "rest" },
+ { "configuration", "configuration" },
+ { "monitoring", "monitoring" },
+ { "security", "security" },
+ { "health", "health" },
+ { "validation", "validation" },
+ { "endpoint", "endpoint" },
+ { "language", "language" },
+ };
+
+ static String primaryLabel(String group) {
+ if (group == null || group.isEmpty()) {
+ return null;
+ }
+ String[] parts = group.split(",");
+ for (String[] entry : LABEL_PRIORITY) {
+ for (String part : parts) {
+ if (entry[0].equals(part.trim())) {
+ return entry[1];
+ }
+ }
+ }
+ return null;
+ }
+
boolean isValueMode() {
return valueMode;
}