Skip to content

Commit

Permalink
[FIXED JENKINS-22590] Use a combobox, not a pulldown, for permalink s…
Browse files Browse the repository at this point in the history
…election.

Enables a promotion name to be specified even when the upstream job name is not statically known.
  • Loading branch information
jglick committed Apr 14, 2014
1 parent 4371497 commit 15d52b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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 15d52b1

Please sign in to comment.