Skip to content

Commit

Permalink
truncate node argument at 77 and add '...' at the end
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Harasimiuk <[email protected]>
  • Loading branch information
ArturHarasimiuk committed Jun 11, 2019
1 parent b5f51e6 commit ee8f83b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -81,6 +82,7 @@ public void testLongStepArguments() {

String s = col.get(f);
assertTrue(s.length()<=80);
assertTrue(StringUtils.right(s, 3).equals("..."));
}


Expand Down

0 comments on commit ee8f83b

Please sign in to comment.