mirror of https://github.com/apache/archiva.git
enabled advanced search form
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295048 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a67abc4333
commit
9fd6d23558
|
@ -640,6 +640,7 @@ $(function() {
|
||||||
|
|
||||||
ResultViewModel=function(artifacts){
|
ResultViewModel=function(artifacts){
|
||||||
var self=this;
|
var self=this;
|
||||||
|
this.originalArtifacts=artifacts;
|
||||||
this.artifacts=ko.observableArray(artifacts);
|
this.artifacts=ko.observableArray(artifacts);
|
||||||
this.gridViewModel = new ko.simpleGrid.viewModel({
|
this.gridViewModel = new ko.simpleGrid.viewModel({
|
||||||
data: self.artifacts,
|
data: self.artifacts,
|
||||||
|
@ -672,8 +673,6 @@ $(function() {
|
||||||
this.selectedRepoIds=[];
|
this.selectedRepoIds=[];
|
||||||
this.resultViewModel=new ResultViewModel([]);
|
this.resultViewModel=new ResultViewModel([]);
|
||||||
basicSearch=function(){
|
basicSearch=function(){
|
||||||
//$.log("query:"+this.searchParameters().basicQueryString());
|
|
||||||
//$.log("repoIds:"+this.selectedRepoIds);
|
|
||||||
var queryTerm=this.searchRequest().queryTerms();
|
var queryTerm=this.searchRequest().queryTerms();
|
||||||
if (!queryTerm || $.trim(queryTerm).length<1){
|
if (!queryTerm || $.trim(queryTerm).length<1){
|
||||||
$.log("empty");
|
$.log("empty");
|
||||||
|
@ -687,11 +686,33 @@ $(function() {
|
||||||
// cleanup previours error message
|
// cleanup previours error message
|
||||||
customShowError("#main-content #search-basic-form", null, null, []);
|
customShowError("#main-content #search-basic-form", null, null, []);
|
||||||
}
|
}
|
||||||
var searchResultsGrid=$("#main-content #search-results #search-results-grid" );
|
self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
|
||||||
$("#main-content #btn-basic-search" ).button("loading");
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
advancedSearch=function(){
|
||||||
|
self.search("restServices/archivaServices/searchService/searchArtifacts");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.search=function(url){
|
||||||
|
|
||||||
|
var mainContent=$("#main-content");
|
||||||
|
|
||||||
|
var searchResultsGrid=mainContent.find("#search-results #search-results-grid" );
|
||||||
|
mainContent.find("#btn-basic-search" ).button("loading");
|
||||||
$("#user-messages").html(mediumSpinnerImg());
|
$("#user-messages").html(mediumSpinnerImg());
|
||||||
|
|
||||||
|
|
||||||
|
self.selectedRepoIds=[];
|
||||||
|
mainContent.find("#search-basic-repositories" )
|
||||||
|
.find(".chzn-choices li span").each(function(i,span){
|
||||||
|
self.selectedRepoIds.push($(span).html());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.searchRequest().repositories=this.selectedRepoIds;
|
this.searchRequest().repositories=this.selectedRepoIds;
|
||||||
$.ajax("restServices/archivaServices/searchService/quickSearchWithRepositories",
|
$.ajax(url,
|
||||||
{
|
{
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: "{\"searchRequest\": " + ko.toJSON(this.searchRequest)+"}",
|
data: "{\"searchRequest\": " + ko.toJSON(this.searchRequest)+"}",
|
||||||
|
@ -723,12 +744,6 @@ $(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
advancedSearch=function(){
|
|
||||||
$.log("groupId:"+this.searchParameters().searchRequest().groupId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,16 +769,7 @@ $(function() {
|
||||||
var searchViewModel=new SearchViewModel();
|
var searchViewModel=new SearchViewModel();
|
||||||
searchViewModel.observableRepoIds(mapStringList(data));
|
searchViewModel.observableRepoIds(mapStringList(data));
|
||||||
ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0));
|
ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0));
|
||||||
mainContent.find("#search-basic-repostories-select" ).chosen()
|
mainContent.find("#search-basic-repostories-select" ).chosen();
|
||||||
.change(function(){
|
|
||||||
searchViewModel.selectedRepoIds=[];
|
|
||||||
mainContent.find("#search-basic-repositories" )
|
|
||||||
.find(".chzn-choices li span").each(function(i,span){
|
|
||||||
searchViewModel.selectedRepoIds.push($(span).html());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue