]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1836] Make search limit (maxCount) configurable via UI
authorOlivier Lamy <olamy@apache.org>
Fri, 2 May 2014 05:53:54 +0000 (15:53 +1000)
committerOlivier Lamy <olamy@apache.org>
Fri, 2 May 2014 05:53:54 +0000 (15:53 +1000)
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html

index a26fd7fdfd794ec1f2414d501d568dd9ff2994cd..d944893aaad4fde847c4c21f72243b6a09fe2e67 100644 (file)
@@ -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() )
index b2254664fafa162a47083872c8210f746bc4e077..556a2b27a44d29b834e153f668d1f0e8083b3282 100644 (file)
@@ -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
index 1a982b7a5ffd8a468f0cb1bbb9d323c48e827efd..c92f10acce3e01d284bd7acfdd5e4d1360f36149 100644 (file)
@@ -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);
index 248fa4dcac5d8e229a58e1c590f964fe510f31a6..a96b2928a3ac06c36d60639f0e0e5f44631a23df 100644 (file)
@@ -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);
index 749be02499889935818fd1b4bdbae23c59d99941..f65af0ecbb9f34aee493e0f9378ecf7cff82fa66 100644 (file)
                                data-bind="value: searchRequest().className"/>
                       </div>
                     </div>
+                    <div class="control-group">
+                      <label class="control-label" for="pageSize">${$.i18n.prop('search.artifact.search.form.query.pageSize')}</label>
+
+                      <div class="controls">
+                        <input type="text" class="defaults" id="pageSize" name="pageSize" size="50"
+                               placeholder="my.pageSize"
+                               data-bind="value: searchRequest().pageSize"/>
+                      </div>
+                    </div>
 
                   </fieldset>
                   <button type="submit" id="btn-advanced-search" class="btn btn-primary"