[MRM-1610] Use Jackson as jaxrs provider for cxf for performance reasons

fix search screens and js mapping.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-01 11:46:50 +00:00
parent b90094b435
commit 9500200a51
2 changed files with 16 additions and 13 deletions

View File

@ -137,12 +137,12 @@ $(function() {
mainContent.find("#browse_artifact").show();
mainContent.find("#browse_artifact").html(mediumSpinnerImg());
mainContent.find("#main_browse_result_content").show();
$.ajax("restServices/archivaServices/browseService/projectVersionMetadata/"+groupId+"/"+artifactId, {
$.ajax("restServices/archivaServices/browseService/projectVersionMetadata/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId), {
type: "GET",
dataType: 'json',
success: function(data) {
artifactDetailViewModel.projectVersionMetadata=mapProjectVersionMetadata(data);
$.ajax("restServices/archivaServices/browseService/versionsList/"+groupId+"/"+artifactId, {
$.ajax("restServices/archivaServices/browseService/versionsList/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId), {
type: "GET",
dataType: 'json',
success: function(data) {
@ -293,11 +293,12 @@ $(function() {
mapbrowseResultEntries=function(data){
if (data.browseResult && data.browseResult.browseResultEntries) {
return $.isArray(data.browseResult.browseResultEntries) ?
$.map(data.browseResult.browseResultEntries,function(item){
$.log("mapbrowseResultEntries");
if (data) {
return $.isArray(data) ?
$.map(data,function(item){
return new BrowseResultEntry(item.name, item.project);
} ).sort(): [data.browseResult.browseResultEntries];
} ).sort(): [data];
}
return [];
}
@ -584,7 +585,7 @@ $(function() {
mapArtifacts=function(data){
if (data){
return $.isArray(data )? $.map(data.artifact,function(item){return mapArtifact(item)}) : [data];
return $.isArray(data )? $.map(data,function(item){return mapArtifact(item)}) : [data];
}
return [];
}
@ -748,7 +749,7 @@ $(function() {
$.ajax(url,
{
type: "POST",
data: "{\"searchRequest\": " + ko.toJSON(this.searchRequest)+"}",
data: ko.toJSON(this.searchRequest),
contentType: 'application/json',
dataType: 'json',
success: function(data) {
@ -805,7 +806,9 @@ $(function() {
success: function(data) {
mainContent.html($("#search-artifacts-div-tmpl" ).tmpl());
var searchViewModel=new SearchViewModel();
searchViewModel.observableRepoIds(mapStringList(data));
var repos=mapStringList(data);
$.log("repos:"+repos);
searchViewModel.observableRepoIds(repos);
ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0));
mainContent.find("#search-basic-repostories-select" ).chosen();
}

View File

@ -318,13 +318,13 @@ Entry=function(key,value){
//this.value.subscribe(function(newValue){self.modified(true)});
}
/**
* map {"stringList":{"strings":["foo-managed","internal","snapshots"]}} to an array
* map {"strings":["snapshots","internal"]} to an array
* @param data
*/
mapStringList=function(data){
if (data && data.stringList && data.stringList.strings){
return $.isArray(data.stringList.strings) ?
$.map(data.stringList.strings,function(item){return item}): [data.stringList.strings];
if (data && data.strings){
return $.isArray(data.strings) ?
$.map(data.strings,function(item){return item}): [data.strings];
}
return [];
}