From ee8f83b529b17a6d82f89a4f01936115f3865240 Mon Sep 17 00:00:00 2001 From: Artur Harasimiuk Date: Tue, 11 Jun 2019 18:12:59 +0200 Subject: [PATCH] truncate node argument at 77 and add '...' at the end Signed-off-by: Artur Harasimiuk --- .../workflow/support/visualization/table/ArgumentsColumn.java | 4 +++- .../workflow/support/visualization/ArgumentsColumnTest.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/visualization/table/ArgumentsColumn.java b/src/main/java/org/jenkinsci/plugins/workflow/support/visualization/table/ArgumentsColumn.java index 7b5c1f8f..0068f0f4 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/visualization/table/ArgumentsColumn.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/visualization/table/ArgumentsColumn.java @@ -40,7 +40,9 @@ public class ArgumentsColumn extends FlowNodeViewColumn { @DataBoundConstructor public ArgumentsColumn() {} public String get(FlowNode node) { - return StringUtils.substring(ArgumentsAction.getStepArgumentsAsString(node), 0, 80); + if(StringUtils.length(ArgumentsAction.getStepArgumentsAsString(node))>77) + return StringUtils.substring(ArgumentsAction.getStepArgumentsAsString(node), 0, 77) + "..."; + return ArgumentsAction.getStepArgumentsAsString(node); } @Extension public static class DescriptorImpl extends FlowNodeViewColumnDescriptor { diff --git a/src/test/java/org/jenkinsci/plugins/workflow/support/visualization/ArgumentsColumnTest.java b/src/test/java/org/jenkinsci/plugins/workflow/support/visualization/ArgumentsColumnTest.java index fd77b0c4..5a6d932d 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/support/visualization/ArgumentsColumnTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/support/visualization/ArgumentsColumnTest.java @@ -31,6 +31,7 @@ import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringUtils; import org.jenkinsci.plugins.workflow.graph.FlowNode; import org.jenkinsci.plugins.workflow.graph.StepNode; import org.jenkinsci.plugins.workflow.steps.Step; @@ -81,6 +82,7 @@ public void testLongStepArguments() { String s = col.get(f); assertTrue(s.length()<=80); + assertTrue(StringUtils.right(s, 3).equals("...")); }