From 5a365283f89384056505cd1477271defb075a28d Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 5 Mar 2012 13:54:17 +0000 Subject: [PATCH] search result add a column with classifier git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1297057 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/archiva/i18n/default.properties | 3 ++- .../src/main/webapp/js/archiva/search.js | 13 +++++++++++-- .../main/webapp/js/archiva/templates/search.html | 10 +++++++++- 3 files changed, 22 insertions(+), 4 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 72e3e8328..f0ed90512 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 @@ -227,7 +227,8 @@ search.artifact.searching=Searching ..... search.artifact.search.form.btn.search=Search search.artifact.search.form.btn.search.filter=Filter Results search.artifact.result.size=Artifacts found - +search.artifact.results.classifier=Classifier +search.artifact.search.form.query.classifier=Classifier #login login.username.placehoder=Username 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 17e7057a7..28b210ed6 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 @@ -657,6 +657,8 @@ $(function() { //private boolean includePomArtifacts = false; this.includePomArtifacts=ko.observable(false); + + this.classifier=ko.observable(); } applyAutocompleteOnHeader=function(property,resultViewModel){ @@ -665,7 +667,7 @@ $(function() { source: function(request, response){ var founds=[]; $(resultViewModel.artifacts()).each(function(idx,artifact){ - if(artifact[property].startsWith(request.term)){ + if(artifact[property] && artifact[property].startsWith(request.term)){ founds.push(artifact[property]); } }); @@ -675,10 +677,11 @@ $(function() { $.log("property:"+property+','+ui.item.value); var artifacts=[]; $(resultViewModel.artifacts()).each(function(idx,artifact){ - if(artifact[property].startsWith(ui.item.value)){ + if(artifact[property] && artifact[property].startsWith(ui.item.value)){ artifacts.push(artifact); } }); + $.log("property:"+property+','+ui.item.value+",size:"+artifacts.length); resultViewModel.artifacts(artifacts); return false; } @@ -706,6 +709,11 @@ $(function() { headerText: $.i18n.prop('search.artifact.results.version'), rowText: "version", id: "version" + }, + { + headerText: $.i18n.prop('search.artifact.results.classifier'), + rowText: "classifier", + id: "classifier" } ], pageSize: 10, @@ -713,6 +721,7 @@ $(function() { applyAutocompleteOnHeader('groupId',self); applyAutocompleteOnHeader('artifactId',self); applyAutocompleteOnHeader('version',self); + applyAutocompleteOnHeader('classifier',self); } }); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html index 3ca8e4711..1f8b9fd96 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html @@ -243,6 +243,13 @@ data-bind="value: searchRequest().version"/> +
+ +
+ +
+
@@ -257,6 +264,7 @@ data-bind="value: searchRequest().className"/>
+ @@ -308,7 +316,7 @@ {{each(i, columnDefinition) columns}} - + {{/each}}