Skip to content

Commit

Permalink
Merge pull request #34 from jglick/permalink-combobox-JENKINS-22590
Browse files Browse the repository at this point in the history
[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 4c6e978
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.Job;
import hudson.model.PermalinkProjectAction.Permalink; import hudson.model.PermalinkProjectAction.Permalink;
import hudson.model.Run; import hudson.model.Run;
import hudson.util.ListBoxModel; import hudson.util.ComboBoxModel;
import hudson.util.ListBoxModel.Option;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundConstructor;
Expand Down Expand Up @@ -65,15 +64,14 @@ public String getDisplayName() {
return Messages.PermalinkBuildSelector_DisplayName(); return Messages.PermalinkBuildSelector_DisplayName();
} }


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

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

0 comments on commit 4c6e978

Please sign in to comment.