summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-08-23 16:11:30 +0000
committerOlivier Lamy <olamy@apache.org>2012-08-23 16:11:30 +0000
commitffb5c2ff0eedaf201b062e4ffcfc3b869aab3edb (patch)
tree4b283de01d6d2d299e5061502bd758bc9c846ef1 /archiva-modules
parent40d9e74fc8f92faf541316639282b696412cda8c (diff)
downloadarchiva-ffb5c2ff0eedaf201b062e4ffcfc3b869aab3edb.tar.gz
archiva-ffb5c2ff0eedaf201b062e4ffcfc3b869aab3edb.zip
simplify code
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376568 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js70
1 files changed, 15 insertions, 55 deletions
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 5c0c8f0bb..51a3bdc2a 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
@@ -246,8 +246,18 @@ function($,sammy,tmpl,ui) {
},searchViewModel);
});
- var advancedSearchRoute=function(repositoryIds,groupId,artifactId,version,classifier,packaging,className){
-
+ var advancedSearchRoute=function(params){
+ var repositoryIds = params.repositoryIds;
+ var repos = repositoryIds ? repositoryIds.split("~"):[];
+ var queryTerms = params.queryterms;
+ var terms=queryTerms?queryTerms.split('~'):[];
+ $.log("queryTerms:"+queryTerms+",terms.length:"+terms.length);
+ var groupId= terms.length>0?terms[0]:"";
+ var artifactId= terms.length>1?terms[1]:"";
+ var version= terms.length>2?terms[2]:"";
+ var classifier= terms.length>3?terms[3]:"";
+ var packaging= terms.length>4?terms[4]:"";
+ var className= terms.length>5?terms[5]:"";
$.log("groupId:artifactId:version:classifier:packaging:className="+groupId+':'+artifactId+':'+version+':'+classifier+':'+packaging+':'+className);
var searchViewModel = new SearchViewModel();
var searchRequest = new SearchRequest();
@@ -261,67 +271,17 @@ function($,sammy,tmpl,ui) {
searchRequest.selectedRepoIds=repositoryIds;
searchViewModel.searchRequest(searchRequest);
displaySearch(function(){
- //searchViewModel.externalAdvancedSearch();
+
searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repositoryIds);
},searchViewModel);
}
- /*var advancedSearchParams=['groupId','artifactId','version','classifier','packaging','className'];
-
- var createAdvancedSearchRoutes=function(startLocation){
- for(var idx=1;idx<advancedSearchParams.length+1;idx++){
- var route = startLocation;
- $(advancedSearchParams).each(function(index) {
- if(index<idx){
- route+="~:"+advancedSearchParams[index];
- }
- });
- $.log("add route:"+route);
- self.get(route,function(){
- var repositoryIds = this.params.repositoryIds;
- var repos = repositoryIds ? repositoryIds.split("~"):[];
- $.log('repos:'+repos.length);
- var groupId= this.params.groupId;
- var artifactId= this.params.artifactId;
- var version= this.params.version;
- var classifier= this.params.classifier;
- var packaging= this.params.packaging;
- var className= this.params.className;
- advancedSearchRoute(repos,groupId,artifactId,version,classifier,packaging,className);
- });
- }
- }*/
- //createAdvancedSearchRoutes("#advancedsearch/");
- //createAdvancedSearchRoutes("#advancedsearch~:repositoryIds/");
-
self.get("#advancedsearch/:queryterms",function(){
- var repositoryIds = this.params.repositoryIds;
- var repos = repositoryIds ? repositoryIds.split("~"):[];
- var queryTerms = this.params.queryterms;
- var terms=queryTerms?queryTerms.split('~'):[];
- $.log("queryTerms:"+queryTerms+",terms.length:"+terms.length);
- var groupId= terms.length>0?terms[0]:"";
- var artifactId= terms.length>1?terms[1]:"";
- var version= terms.length>2?terms[2]:"";
- var classifier= terms.length>3?terms[3]:"";
- var packaging= terms.length>4?terms[4]:"";
- var className= terms.length>5?terms[5]:"";
- advancedSearchRoute(repos,groupId,artifactId,version,classifier,packaging,className);
+ advancedSearchRoute(this.params);
});
self.get("#advancedsearch~:repositoryIds/:queryterms",function(){
- var repositoryIds = this.params.repositoryIds;
- var repos = repositoryIds ? repositoryIds.split("~"):[];
- var queryTerms = this.params.queryterms;
- var terms=queryTerms?queryTerms.split('~'):[];
- $.log("queryTerms:"+queryTerms+",terms.length:"+terms.length);
- var groupId= terms.length>0?terms[0]:"";
- var artifactId= terms.length>1?terms[1]:"";
- var version= terms.length>2?terms[2]:"";
- var classifier= terms.length>3?terms[3]:"";
- var packaging= terms.length>4?terms[4]:"";
- var className= terms.length>5?terms[5]:"";
- advancedSearchRoute(repos,groupId,artifactId,version,classifier,packaging,className);
+ advancedSearchRoute(this.params);
});