From 9500200a515f416783453de51a0c381427201a07 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 1 Mar 2012 11:46:50 +0000 Subject: [PATCH] [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 --- .../src/main/webapp/js/archiva/search.js | 21 +++++++++++-------- .../src/main/webapp/js/archiva/utils.js | 8 +++---- 2 files changed, 16 insertions(+), 13 deletions(-) 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 2cf313347..cbde948b8 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 @@ -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(); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index 6c31107c0..242654a9c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -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 []; } -- 2.39.5