|
47 | 47 | import hudson.model.Run;
|
48 | 48 | import hudson.model.listeners.ItemListener;
|
49 | 49 | import hudson.model.queue.QueueTaskFuture;
|
| 50 | +import hudson.search.Icon; |
| 51 | +import hudson.search.SearchIndex; |
50 | 52 | import hudson.search.SearchIndexBuilder;
|
| 53 | +import hudson.search.SearchItem; |
| 54 | +import hudson.search.SearchItemCategory; |
51 | 55 | import hudson.triggers.Trigger;
|
52 | 56 | import hudson.triggers.TriggerDescriptor;
|
53 | 57 | import hudson.util.AlternativeUiTextProvider;
|
|
63 | 67 | import jenkins.model.lazy.LazyBuildMixIn;
|
64 | 68 | import jenkins.triggers.SCMTriggerItem;
|
65 | 69 | import jenkins.util.TimeDuration;
|
| 70 | +import org.jenkins.ui.icon.IconSet; |
66 | 71 | import org.kohsuke.accmod.Restricted;
|
67 | 72 | import org.kohsuke.accmod.restrictions.DoNotUse;
|
68 | 73 | import org.kohsuke.accmod.restrictions.NoExternalUse;
|
@@ -259,8 +264,33 @@ public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throw
|
259 | 264 | * @return the value to return
|
260 | 265 | */
|
261 | 266 | public final SearchIndexBuilder extendSearchIndex(SearchIndexBuilder sib) {
|
262 |
| - if (asJob().isBuildable() && asJob().hasPermission(Item.BUILD)) { |
263 |
| - sib.add("build", "build"); |
| 267 | + if (asJob().isBuildable() && asJob().isParameterized() && asJob().hasPermission(Item.BUILD)) { |
| 268 | + sib.add(new SearchItem() { |
| 269 | + @Override |
| 270 | + public String getSearchName() { |
| 271 | + return "Build project"; |
| 272 | + } |
| 273 | + |
| 274 | + @Override |
| 275 | + public String getSearchUrl() { |
| 276 | + return "build"; |
| 277 | + } |
| 278 | + |
| 279 | + @Override |
| 280 | + public Icon getSearchItemIcon() { |
| 281 | + return Icon.fromSvg(IconSet.getIonicon("play-outline", null)); |
| 282 | + } |
| 283 | + |
| 284 | + @Override |
| 285 | + public SearchItemCategory getSearchItemCategory() { |
| 286 | + return SearchItemCategory.IN_PAGE_ACTIONS; |
| 287 | + } |
| 288 | + |
| 289 | + @Override |
| 290 | + public SearchIndex getSearchIndex() { |
| 291 | + return null; |
| 292 | + } |
| 293 | + }); |
264 | 294 | }
|
265 | 295 | return sib;
|
266 | 296 | }
|
|
0 commit comments