]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1610] Use Jackson as jaxrs provider for cxf for performance reasons
authorOlivier Lamy <olamy@apache.org>
Thu, 1 Mar 2012 11:46:50 +0000 (11:46 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 1 Mar 2012 11:46:50 +0000 (11:46 +0000)
fix search screens and js mapping.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295527 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js

index 2cf3133474329e05025771680536709e6f11a0c8..cbde948b8be4ac9541e0ad3b1d34675f9139622b 100644 (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();
         }
index 6c31107c03e1196a59822fb03ec9fd6db604c163..242654a9c63977e138e82c1ece5875dd9c63c996 100644 (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 [];
 }