From cc812c46653d3bed30c16e0c8f40d4fae4d86962 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 29 Feb 2012 14:05:12 +0000 Subject: [PATCH] starting filtering on search results git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295114 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/i18n/default.properties | 2 ++ .../src/main/webapp/js/archiva/search.js | 23 +++++++++++++++---- .../webapp/js/archiva/templates/search.html | 15 ++++++++++-- 3 files changed, 33 insertions(+), 7 deletions(-) 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 c9070b78c..921c94576 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 @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index 5d3d42e72..51295b07e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -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 - + @@ -252,7 +253,12 @@ - + + + +
@@ -282,6 +288,11 @@ ${ columnDefinition.headerText } {{/each}} + + {{each(i, columnDefinition) columns}} + + {{/each}} + {{each(i, row) itemsOnCurrentPage()}} -- 2.39.5