From: Olivier Lamy Date: Fri, 2 May 2014 05:53:54 +0000 (+1000) Subject: [MRM-1836] Make search limit (maxCount) configurable via UI X-Git-Tag: archiva-2.1.0~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0312f52d7f6a51359a83c721d59ca1def12c5a07;p=archiva.git [MRM-1836] Make search limit (maxCount) configurable via UI --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java index a26fd7fdf..d944893aa 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java @@ -144,6 +144,7 @@ public class DefaultSearchService } SearchFields searchField = getModelMapper().map( searchRequest, SearchFields.class ); SearchResultLimits limits = new SearchResultLimits( 0 ); + limits.setPageSize( searchRequest.getPageSize() ); // if no repos set we use ones available for the user if ( searchField.getRepositories() == null || searchField.getRepositories().isEmpty() ) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index b2254664f..556a2b27a 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -371,6 +371,7 @@ search.artifact.search.form.query.bundleExportPackage=Export Package search.artifact.search.form.query.bundleExportService=Export Service search.artifact.search.form.query.bundleImportPackage=Import Package search.artifact.search.form.query.bundleRequireBundle=Require Bundle +search.artifact.search.form.query.pageSize=Page Size artifact.detail.tab.header.dependencies=Dependencies artifact.detail.tab.header.metadatas=Metadata artifact.detail.tab.header.mailing.list=Mailing Lists diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index 1a982b7a5..c92f10acc 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -346,6 +346,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa var classifier= terms.length>3?terms[3]:""; var packaging= terms.length>4?terms[4]:""; var className= terms.length>5?terms[5]:""; + var pageSize= terms.length>6?terms[6]:""; $.log("groupId:artifactId:version:classifier:packaging:className="+groupId+':'+artifactId+':'+version+':'+classifier+':'+packaging+':'+className); var searchViewModel = new SearchViewModel(); var searchRequest = new SearchRequest(); @@ -355,6 +356,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa searchRequest.classifier(classifier); searchRequest.packaging(packaging); searchRequest.className(className); + searchRequest.pageSize(pageSize); //searchRequest.repositories=repos; //searchRequest.selectedRepoIds=repos; searchViewModel.searchRequest(searchRequest); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js index 248fa4dca..a96b2928a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js @@ -2081,6 +2081,9 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn this.includePomArtifacts=ko.observable(true); this.classifier=ko.observable(); + + // private int pageSize = 30; + this.pageSize = ko.observable( 30 ); } /** @@ -2293,9 +2296,7 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn location+="/"; if(self.searchRequest().groupId()){ location+=self.searchRequest().groupId(); - }/*else{ - location+='~'; - }*/ + } if(self.searchRequest().artifactId()){ location+='~'+self.searchRequest().artifactId(); }else{ @@ -2321,6 +2322,11 @@ define("archiva.search",["jquery","jquery.ui","i18n","jquery.tmpl","select2","kn }else{ location+='~'; } + if(self.searchRequest().pageSize()){ + location+='~'+self.searchRequest().pageSize(); + }else{ + location+='~'; + } $.log("location:"+location); window.sammyArchivaApplication.setLocation(location); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html index 749be0249..f65af0ecb 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html @@ -333,6 +333,15 @@ data-bind="value: searchRequest().className"/> +
+ + +
+ +
+