Skip to content

Commit

Permalink
[JENKINS-47020] - Improve job search experience (#3324)
Browse files Browse the repository at this point in the history
* Increase search results limit from 20 to 100

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>

* Enlarge search box size

Increase the max number of results from 10 to 25.
Increase width of results from 25em to 35em
in order to suit longer job names.

This still fits even small 13" screens and improves
user experience.

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
  • Loading branch information
ssbarnea authored and oleg-nenashev committed Mar 24, 2018
1 parent d5a8487 commit a30ada7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/search/Search.java
Expand Up @@ -140,7 +140,7 @@ public void doSuggest(StaplerRequest req, StaplerResponse rsp, @QueryParameter S
public SearchResult getSuggestions(StaplerRequest req, String query) {
Set<String> paths = new HashSet<String>(); // paths already added, to control duplicates
SearchResultImpl r = new SearchResultImpl();
int max = req.hasParameter("max") ? Integer.parseInt(req.getParameter("max")) : 20;
int max = req.hasParameter("max") ? Integer.parseInt(req.getParameter("max")) : 100;
SearchableModelObject smo = findClosestSearchableModelObject(req);
for (SuggestedItem i : suggest(makeSuggestIndex(req), query, smo)) {
if(r.size()>=max) {
Expand Down
Expand Up @@ -48,8 +48,8 @@ THE SOFTWARE.
</j:forEach>
</ol>
<j:if test="${items.hasMoreResults()}">
<j:set var="max" value="${request.hasParameter('max')?request.getParameter('max'):20}"/>
<em>result has been truncated, <a href="?q=${it.encodeQuery(q)}&amp;max=${max+20}">see 20 more</a></em>
<j:set var="max" value="${request.hasParameter('max')?request.getParameter('max'):100}"/>
<em>result has been truncated, <a href="?q=${it.encodeQuery(q)}&amp;max=${max+100}">see 100 more</a></em>
</j:if>
</j:otherwise>
</j:choose>
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/webapp/css/style.css
Expand Up @@ -1493,7 +1493,7 @@ DIV.yahooTree td {

#search-box-completion .yui-ac-content {
border: 1px solid black;
width:25em;
width:35em;
background-color: white;
overflow: hidden;
}
Expand Down
1 change: 1 addition & 0 deletions war/src/main/webapp/scripts/hudson-behavior.js
Expand Up @@ -2373,6 +2373,7 @@ function createSearchBox(searchURL) {
ac.typeAhead = false;
ac.autoHighlight = false;
ac.formatResult = ac.formatEscapedResult;
ac.maxResultsDisplayed = 25;

var box = $("search-box");
var sizer = $("search-box-sizer");
Expand Down

0 comments on commit a30ada7

Please sign in to comment.