Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed slaves labels/individual nodes list description display null #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/main/java/hudson/matrix/LabelAxis.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@
import hudson.Extension;
import hudson.Functions;
import hudson.Util;
import hudson.model.Node;
import jenkins.model.Jenkins;
import hudson.model.labels.LabelAtom;

import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;

import java.util.List;
import java.util.Set;

/**
* {@link Axis} that selects label expressions.
Expand Down Expand Up @@ -75,11 +79,26 @@ private String jsstr(String body, Object... args) {
}

public String buildLabelCheckBox(LabelAtom la, LabelAxis instance) {
String desc = "";
Set<Node> nodes = la.getNodes();
if (la.isSelfLabel()) { // if true this is Individual nodes
for (Node node : nodes) {// maybe only one?
desc = node.getNodeDescription();
}
} else { // false this is Labels
if(la.getDescription() != null){
desc += la.getDescription()+": ";
}
for (Node node : nodes) {
desc += node.getDisplayName() + ", ";
}
desc = StringUtils.strip(desc, ", ");
}
return jsstr("<input type='checkbox' name='values' json='%s' ",
Functions.htmlAttributeEscape(la.getName()))
+String.format("+has(%s)+",jsstr(la.getName()))
+jsstr("/><label class='attach-previous'>%s (%s)</label>",
la.getName(),la.getDescription());
la.getName(),desc);
// '${h.jsStringEscape('<input type="checkbox" name="values" json="'+h.htmlAttributeEscape(l.name)+'" ')}'+has("${h.jsStringEscape(l.name)}")+'${h.jsStringEscape('/><label class="attach-previous">'+l.name+' ('+l.description+')</label>')}'
}
}
Expand Down