diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index 6dbf05346..dde707ba1 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -213,21 +213,35 @@ $(function() { source: function(request, response){ $.get("restServices/archivaServices/searchService/quickSearch?queryString="+encodeURIComponent(request.term), function(data) { - var res = $.map(data,function(item){ - return item.artifactId; - }); + var res = mapArtifacts(data); var uniqId = []; + var uniqArtifactIds=[]; for (var i= 0;i" ) + .data( "item.autocomplete", item ) + .append( "" + item.artifactId + "" ) + .appendTo( ul ); + };; } 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 28b210ed6..19b07c23f 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 @@ -747,10 +747,14 @@ $(function() { customShowError("#main-content #search-basic-form", null, null, []); } self.search("restServices/archivaServices/searchService/quickSearchWithRepositories"); - - } + /** + * use from autocomplete search + */ + this.externalAdvancedSearch=function(){ + this.search("restServices/archivaServices/searchService/searchArtifacts"); + } advancedSearch=function(){ self.search("restServices/archivaServices/searchService/searchArtifacts"); } @@ -828,7 +832,7 @@ $(function() { } - displaySearch=function(){ + displaySearch=function(successCallbackFn){ clearUserMessages(); var mainContent=$("#main-content"); mainContent.html(mediumSpinnerImg()); @@ -843,6 +847,7 @@ $(function() { searchViewModel.observableRepoIds(repos); ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0)); mainContent.find("#search-basic-repostories-select" ).chosen(); + if (successCallbackFn) successCallbackFn(); } });