diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index 0c525dfabe84..14f0b3de4f4d 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -48,6 +48,7 @@ import hudson.node_monitors.NodeMonitor; import hudson.remoting.Channel; import hudson.remoting.VirtualChannel; +import hudson.search.SearchGroup; import hudson.security.ACL; import hudson.security.AccessControlled; import hudson.security.Permission; @@ -1109,6 +1110,11 @@ public String getSearchUrl() { return getUrl(); } + @Override + public SearchGroup getSearchGroup() { + return SearchGroup.COMPUTER; + } + /** * {@link RetentionStrategy} associated with this computer. * diff --git a/core/src/main/java/hudson/search/Search.java b/core/src/main/java/hudson/search/Search.java index 1edbfdb5dc3f..6f1240560351 100644 --- a/core/src/main/java/hudson/search/Search.java +++ b/core/src/main/java/hudson/search/Search.java @@ -173,7 +173,7 @@ public void doSuggest(StaplerRequest2 req, StaplerResponse2 rsp, @QueryParameter r.suggestions.add(new Item(curItem.getPath(), curItem.getUrl(), Symbol.get(new SymbolRequest.Builder().withRaw(iconName).build()))); } else { - r.suggestions.add(new Item(curItem.getPath(), curItem.getUrl(), iconName, "image")); + r.suggestions.add(new Item(curItem.getPath(), curItem.getUrl(), iconName, "image", curItem.item.getSearchGroup())); } } rsp.serveExposedBean(req, r, new ExportConfig()); @@ -277,7 +277,9 @@ public static class Item { private final String type; - public final String iconXml; + private final String iconXml; + + private final SearchGroup group; public Item(String name) { this(name, null, null); @@ -288,13 +290,15 @@ public Item(String name, String url, String iconXml) { this.url = url; this.iconXml = iconXml; this.type = "symbol"; + this.group = null; } - public Item(String name, String url, String iconXml, String type) { + public Item(String name, String url, String iconXml, String type, SearchGroup group) { this.name = name; this.url = url; this.iconXml = iconXml; this.type = type; + this.group = group; } @Exported @@ -311,6 +315,11 @@ public String getIconXml() { public String getType() { return type; } + + @Exported + public SearchGroup getGroup() { + return group; + } } private enum Mode { diff --git a/core/src/main/java/hudson/search/SearchItem.java b/core/src/main/java/hudson/search/SearchItem.java index e64efb0257ed..2cb70a3a897d 100644 --- a/core/src/main/java/hudson/search/SearchItem.java +++ b/core/src/main/java/hudson/search/SearchItem.java @@ -63,6 +63,10 @@ default String getSearchIcon() { return "symbol-search"; } + default SearchGroup getSearchGroup() { + return SearchGroup.OTHER; + } + /** * Returns the {@link SearchIndex} to further search sub items inside this item. *