]> source.dussan.org Git - archiva.git/commitdiff
starting filtering on search results
authorOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 14:05:12 +0000 (14:05 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 29 Feb 2012 14:05:12 +0000 (14:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295114 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html

index c9070b78cd6749ac0d9918c39c2ef86d93b42926..921c945769eb055e606ed7dcc5092b34604f1303 100644 (file)
@@ -223,3 +223,5 @@ search.artifact.results.groupId=Group ID
 search.artifact.results.artifactId=Artifact ID
 search.artifact.results.version=Version
 search.artifact.searching=Searching .....
+search.artifact.search.form.btn.search=Search
+search.artifact.search.form.btn.search.filter=Filter Results
index 5d3d42e727073ca413f6defc46918285ad75074a..51295b07e0661aa1adaf94e3bd7286da0de1b911 100644 (file)
@@ -647,15 +647,18 @@ $(function() {
       columns: [
         {
           headerText: $.i18n.prop('search.artifact.results.groupId'),
-          rowText: "groupId"
+          rowText: "groupId",
+          id: "groupId"
         },
         {
           headerText: $.i18n.prop('search.artifact.results.artifactId'),
-          rowText: "artifactId"
+          rowText: "artifactId",
+          id: "artifactId"
         },
         {
           headerText: $.i18n.prop('search.artifact.results.version'),
-          rowText: "version"
+          rowText: "version",
+          id: "version"
         }
       ],
       pageSize: 10,
@@ -674,8 +677,7 @@ $(function() {
     this.resultViewModel=new ResultViewModel([]);
     basicSearch=function(){
       var queryTerm=this.searchRequest().queryTerms();
-      if (!queryTerm || $.trim(queryTerm).length<1){
-        $.log("empty");
+      if ($.trim(queryTerm).length<1){
         var errorList=[{
           message: $.i18n.prop("search.artifact.search.form.terms.empty"),
                  element: $("#main-content #search-basic-form #search-terms" ).get(0)
@@ -732,6 +734,7 @@ $(function() {
                 ko.applyBindings(self.resultViewModel,searchResultsGrid.get(0));
               }
               activateSearchResultsTab();
+              mainContent.find("#btn-advanced-search-filter" ).show();
             }
           },
           error: function(data) {
@@ -745,6 +748,16 @@ $(function() {
         }
       );
     }
+
+    filterResults=function(){
+      var filtered=[];
+      for (var i=0;i<self.resultViewModel.artifacts().length;i++){
+        if (self.resultViewModel.artifacts()[i].groupId==this.searchRequest().groupId()){
+          filtered.push(self.resultViewModel.artifacts()[i]);
+        }
+      }
+      self.resultViewModel.artifacts(filtered);
+    }
   }
 
   activateSearchResultsTab=function(){
index 129ae9e08b8ac16fade0adedcd8153cbedf99b0e..db333ab90b35383511129496fde571396902824f 100644 (file)
                              data-bind="value: searchRequest().queryTerms" placeholder="${$.i18n.prop('search.artifact.search.form.query.terms')}"/>
                     </div>
                   </div>
-                  <button type="submit" id="btn-basic-search" class="btn btn-primary" data-loading-text="${$.i18n.prop('search.artifact.searching')}" data-bind="click: basicSearch">Search</button>
+                  <button type="submit" id="btn-basic-search" class="btn btn-primary"
+                          data-loading-text="${$.i18n.prop('search.artifact.searching')}" data-bind="click: basicSearch">${$.i18n.prop('search.artifact.search.form.btn.search')}</button>
                 </fieldset>
               </form>
             </div>
                       </div>
                     </div>
                   </fieldset>
-                  <button type="submit" id="btn-advanced-search" class="btn btn-primary" class="btn" data-bind="click: advancedSearch">Search</button>
+                  <button type="submit" id="btn-advanced-search" class="btn btn-primary"
+                          data-bind="click: advancedSearch">${$.i18n.prop('search.artifact.search.form.btn.search')}</button>
+
+                  <button type="submit" id="btn-advanced-search-filter" class="btn btn-success hide"
+                          data-bind="click: filterResults">${$.i18n.prop('search.artifact.search.form.btn.search.filter')}</button>
+
                 </form>
             </div>
             <div class="pill-pane" id="search-osgi-form-pane">
             <th title="${ columnDefinition.title }">${ columnDefinition.headerText }</th>
           {{/each}}
         </tr>
+        <tr>
+          {{each(i, columnDefinition) columns}}
+            <th title="${ columnDefinition.title }" id="search-filter-auto-${ columnDefinition.id }"><input type="text" place-holder="filter"/></th>
+          {{/each}}
+        </tr>
     </thead>
     <tbody>
         {{each(i, row) itemsOnCurrentPage()}}