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 2023/05/18 10:03:25 UTC

[camel] branch camel-3.x updated: CAMEL-19370: camel-jbang - Make it possible to show full url for very long endpoints

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

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


The following commit(s) were added to refs/heads/camel-3.x by this push:
     new b7b691ffe6f CAMEL-19370: camel-jbang - Make it possible to show full url for very long endpoints
b7b691ffe6f is described below

commit b7b691ffe6fe5632a37e9bfd003927dd3c520e36
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu May 18 12:02:56 2023 +0200

    CAMEL-19370: camel-jbang - Make it possible to show full url for very long endpoints
---
 .../dsl/jbang/core/commands/process/CamelRouteStatus.java    | 12 ++++++++++--
 .../camel/dsl/jbang/core/commands/process/ListEndpoint.java  | 10 +++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
index e1a488c9285..0b437d722c5 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
@@ -51,6 +51,10 @@ public class CamelRouteStatus extends ProcessWatchCommand {
                         description = "List endpoint URI without query parameters (short)")
     boolean shortUri;
 
+    @CommandLine.Option(names = { "--wide-uri" },
+                        description = "List endpoint URI in full details")
+    boolean wideUri;
+
     @CommandLine.Option(names = { "--limit" },
                         description = "Filter routes by limiting to the given number of rows")
     int limit;
@@ -174,9 +178,13 @@ public class CamelRouteStatus extends ProcessWatchCommand {
                 new Column().header("PID").headerAlign(HorizontalAlign.CENTER).with(r -> r.pid),
                 new Column().header("NAME").dataAlign(HorizontalAlign.LEFT).maxWidth(30, OverflowBehaviour.ELLIPSIS_RIGHT)
                         .with(r -> r.name),
-                new Column().header("ID").dataAlign(HorizontalAlign.LEFT).maxWidth(25, OverflowBehaviour.ELLIPSIS_RIGHT)
+                new Column().header("ID").dataAlign(HorizontalAlign.LEFT).maxWidth(20, OverflowBehaviour.ELLIPSIS_RIGHT)
                         .with(this::getId),
-                new Column().header("FROM").dataAlign(HorizontalAlign.LEFT).maxWidth(40, OverflowBehaviour.ELLIPSIS_RIGHT)
+                new Column().header("FROM").visible(!wideUri).dataAlign(HorizontalAlign.LEFT)
+                        .maxWidth(45, OverflowBehaviour.ELLIPSIS_RIGHT)
+                        .with(this::getFrom),
+                new Column().header("FROM").visible(wideUri).dataAlign(HorizontalAlign.LEFT)
+                        .maxWidth(45, OverflowBehaviour.NEWLINE)
                         .with(this::getFrom),
                 new Column().header("STATUS").headerAlign(HorizontalAlign.CENTER)
                         .with(r -> r.state),
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListEndpoint.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListEndpoint.java
index dc69b45618e..17129106c11 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListEndpoint.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListEndpoint.java
@@ -63,6 +63,10 @@ public class ListEndpoint extends ProcessWatchCommand {
                         description = "List endpoint URI without query parameters (short)")
     boolean shortUri;
 
+    @CommandLine.Option(names = { "--wide-uri" },
+                        description = "List endpoint URI in full details")
+    boolean wideUri;
+
     public ListEndpoint(CamelJBangMain main) {
         super(main);
     }
@@ -149,7 +153,11 @@ public class ListEndpoint extends ProcessWatchCommand {
                 new Column().header("AGE").headerAlign(HorizontalAlign.CENTER).with(r -> r.age),
                 new Column().header("DIR").with(r -> r.direction),
                 new Column().header("TOTAL").with(r -> r.total),
-                new Column().header("URI").dataAlign(HorizontalAlign.LEFT).maxWidth(90, OverflowBehaviour.ELLIPSIS_RIGHT)
+                new Column().header("URI").visible(!wideUri).dataAlign(HorizontalAlign.LEFT)
+                        .maxWidth(90, OverflowBehaviour.ELLIPSIS_RIGHT)
+                        .with(this::getUri),
+                new Column().header("URI").visible(wideUri).dataAlign(HorizontalAlign.LEFT)
+                        .maxWidth(140, OverflowBehaviour.NEWLINE)
                         .with(this::getUri))));
     }