Skip to content
Permalink
Browse files

Merge pull request #34 from jglick/permalink-combobox-JENKINS-22590

[FIXED JENKINS-22590] Use a combobox, not a pulldown, for permalink selection
  • Loading branch information...
ikedam committed May 11, 2014
2 parents 59d7982 + 15d52b1 commit 4c6e9781192b0a92b2ae9a34cb24346e2c6a8a0d
@@ -30,8 +30,7 @@
import hudson.model.Job;
import hudson.model.PermalinkProjectAction.Permalink;
import hudson.model.Run;
import hudson.util.ListBoxModel;
import hudson.util.ListBoxModel.Option;
import hudson.util.ComboBoxModel;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
@@ -65,15 +64,14 @@ public String getDisplayName() {
return Messages.PermalinkBuildSelector_DisplayName();
}

public ListBoxModel doFillIdItems(@AncestorInPath Job defaultJob, @RelativePath("..") @QueryParameter("projectName") String projectName) {
// gracefully fall back to some job, if none is given
public ComboBoxModel doFillIdItems(@AncestorInPath Job copyingJob, @RelativePath("..") @QueryParameter("projectName") String projectName) {
Job j = null;
if (projectName!=null) j = Jenkins.getInstance().getItem(projectName,defaultJob,Job.class);
if (j==null) j = defaultJob;

ListBoxModel r = new ListBoxModel();
for (Permalink p : j.getPermalinks()) {
r.add(new Option(p.getDisplayName(),p.getId()));
if (projectName != null) {
j = Jenkins.getInstance().getItem(projectName, copyingJob, Job.class);
}
ComboBoxModel r = new ComboBoxModel();
for (Permalink p : j != null ? j.getPermalinks() : Permalink.BUILTIN) {
r.add(p.getId());
}
return r;
}
@@ -24,6 +24,6 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="${%Permalink}" field="id">
<f:select />
<f:combobox/>
</f:entry>
</j:jelly>

0 comments on commit 4c6e978

Please sign in to comment.
You can’t perform that action at this time.