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) {
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 [];
}
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 [];
}
$.ajax(url,
{
type: "POST",
- data: "{\"searchRequest\": " + ko.toJSON(this.searchRequest)+"}",
+ data: ko.toJSON(this.searchRequest),
contentType: 'application/json',
dataType: 'json',
success: function(data) {
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();
}
//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 [];
}