Skip to content
Browse files
[JENKINS-26186] Enable changing display format for Last Build Trigger

Users can now pick how to display build Cause in mentioned column,
since not all users want to see long descriptions.

By default column will display only icon for build cause.
  • Loading branch information
ljader committed Aug 16, 2015
1 parent a64582c commit 94eda6518004133f0f11af0c38ee14d1ad593669
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
@@ -6,6 +6,7 @@

import net.sf.json.JSONObject;

import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import hudson.Extension;
@@ -24,6 +25,25 @@
public class LastBuildTriggerColumn extends ListViewColumn {
public static final String ICON_ONLY = "iconOnly";
public static final String ICON_AND_DESC = "iconAndDesc";

private String causeDisplayType = "iconOnly";

public LastBuildTriggerColumn(String causeDisplayType) {
this.causeDisplayType = causeDisplayType;

public LastBuildTriggerColumn() {

public String getCauseDisplayType() {
return causeDisplayType;

private static final class BuildNodeColumnDescriptor extends ListViewColumnDescriptor {
public String getDisplayName() {
@@ -32,7 +52,7 @@ public String getDisplayName() {

public ListViewColumn newInstance(final StaplerRequest request, final JSONObject formData) throws FormException {
return new LastBuildTriggerColumn();
return request.bindJSON(LastBuildTriggerColumn.class, formData);

@@ -6,7 +6,10 @@
<j:forEach var="causeEntry" varStatus="status" items="${entries}">
<j:set var="causeIconUrl" value="${causeEntry.key}" />
<j:set var="causeShortDesc" value="${causeEntry.value}" />
<img width="16" height="16" src="${rootURL}${causeIconUrl}" title="${causeEntry.value}" />
<img width="16" height="16" src="${rootURL}${causeIconUrl}" title="${causeShortDesc}" />
<j:if test="${it.causeDisplayType.equals('iconAndDesc')}">
<j:if test="${!status.last}">
@@ -0,0 +1,12 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<p>${%This column shows info about the cause of the last build}</p>
<f:entry title="${%Cause display format}">
<select name="causeDisplayType" class="setting-input">
<f:option value="iconOnly" selected="${instance.causeDisplayType.equals('iconOnly')}">${%Icon only}</f:option>
<f:option value="iconAndDesc" selected="${instance.causeDisplayType.equals('iconAndDesc')}">${%Icon and description}</f:option>

0 comments on commit 94eda65

Please sign in to comment.