Skip to content
Permalink
Browse files
[JENKINS-37331] No paragraphs, use commas to sperate
  • Loading branch information
MadsNielsen committed Apr 19, 2017
1 parent 8ccee77 commit b80f632e5d21be2fe64d21d59b99c28e11b376e8
Showing 2 changed files with 10 additions and 9 deletions.
@@ -6,6 +6,7 @@
import hudson.scm.SCM;
import hudson.views.ListViewColumnDescriptor;
import java.util.ArrayList;
import java.util.List;
import jenkins.triggers.SCMTriggerItem;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
@@ -20,24 +21,26 @@ public class GitBranchSpecifierColumn extends ListViewColumn {
@DataBoundConstructor
public GitBranchSpecifierColumn() { }

public String getBranchSpecifier( final Item item ) {
String branchSpec = "";
public List<String> getBranchSpecifier( final Item item ) {
List<String> branchSpec = new ArrayList<String>();
SCMTriggerItem s = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(item);
if(s != null) {
for(SCM scm : s.getSCMs()) {
if (scm instanceof GitSCM) {
GitSCM gitScm = (GitSCM)scm;
ArrayList<String> branches = new ArrayList<String>();
for(BranchSpec spec : gitScm.getBranches()) {
branches.add(spec.getName());
branchSpec.add(spec.getName());
}
branchSpec = StringUtils.join(branches, " ");
}
}
}
return branchSpec;
}

public String breakOutString(List<String> branches) {
return StringUtils.join(branches, ", ");
}

@Extension
public static class DescriptorImpl extends ListViewColumnDescriptor {

@@ -2,8 +2,6 @@
<j:jelly xmlns:j="jelly:core">
<j:set var="branchSpec" value="${it.getBranchSpecifier(job)}"/>
<td data="${branchSpec}">
<j:forEach items="${branchSpec.split(' ')}" var="i">
<p>${i}</p>
</j:forEach>
</td>
${it.breakOutString(branchSpec)}
</td>
</j:jelly>

0 comments on commit b80f632

Please sign in to comment.