fix view of artifact with artifactId containing dot

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1309178 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-04-03 22:18:21 +00:00
parent f94ea34c10
commit 016ae930af
1 changed files with 19 additions and 20 deletions

View File

@ -42,26 +42,25 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
} }
} }
displayProjectEntry=function(id){
// value org.apache.maven/maven-archiver
// split this org.apache.maven and maven-archiver
var values = id.split(".");
var groupId="";
for (var i = 0;i<values.length-1;i++){
groupId+=values[i];
if (i<values.length-2)groupId+=".";
}
var artifactId=values[values.length-1];
displayArtifactDetail(groupId,artifactId,self);
}
breadCrumbEntries=function(){ breadCrumbEntries=function(){
// root level ? // root level ?
if (!self.parentBrowseViewModel) return []; if (!self.parentBrowseViewModel) return [];
return calculateBreadCrumbEntries(self.groupId); return calculateBreadCrumbEntries(self.groupId);
} }
displayProjectEntry=function(id){
// value org.apache.maven/maven-archiver
// artifactId can contains .
// value org.apache.aries/org.apache.aries.util
// split this org.apache.maven and maven-archiver
var values = id.substring((self.groupId+'.').length,id.length);//.split(".");
$.log("displayProjectEntry:"+id+",groupId:"+self.groupId+",values:"+values);
displayArtifactDetail(self.groupId,values,self);
}
displayEntry=function(value){ displayEntry=function(value){
if (self.groupId){ if (self.groupId){
return value.substr(self.groupId.length+1,value.length-self.groupId.length); return value.substr(self.groupId.length+1,value.length-self.groupId.length);
@ -109,7 +108,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data); var browseResultEntries = mapBrowseResultEntries(data);
var browseViewModel = new BrowseViewModel(browseResultEntries,parentBrowseViewModel,groupId); var browseViewModel = new BrowseViewModel(browseResultEntries,parentBrowseViewModel,groupId);
ko.applyBindings(browseViewModel,browseBreadCrumb.get(0)); ko.applyBindings(browseViewModel,browseBreadCrumb.get(0));
ko.applyBindings(browseViewModel,browseResult.get(0)); ko.applyBindings(browseViewModel,browseResult.get(0));
@ -501,7 +500,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data); var browseResultEntries = mapBrowseResultEntries(data);
$.log("size:"+browseResultEntries.length); $.log("size:"+browseResultEntries.length);
var browseViewModel = new BrowseViewModel(browseResultEntries,null,null); var browseViewModel = new BrowseViewModel(browseResultEntries,null,null);
ko.applyBindings(browseViewModel,mainContent.find("#browse_breadcrumb").get(0)); ko.applyBindings(browseViewModel,mainContent.find("#browse_breadcrumb").get(0));
@ -546,7 +545,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
// try with rootGroups then filtered // try with rootGroups then filtered
$.get(url, $.get(url,
function(data) { function(data) {
var browseResultEntries = mapbrowseResultEntries(data); var browseResultEntries = mapBrowseResultEntries(data);
var filetered = []; var filetered = [];
for(var i=0;i<browseResultEntries.length;i++){ for(var i=0;i<browseResultEntries.length;i++){
@ -588,7 +587,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
} }
$.get(browseUrl, $.get(browseUrl,
function(data) { function(data) {
var browseResultEntries = mapbrowseResultEntries(data); var browseResultEntries = mapBrowseResultEntries(data);
if (dotEnd){ if (dotEnd){
response(browseResultEntries); response(browseResultEntries);
} else { } else {
@ -667,8 +666,8 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
displayArtifactDetail(groupId,artifactId,null,null); displayArtifactDetail(groupId,artifactId,null,null);
} }
mapbrowseResultEntries=function(data){ mapBrowseResultEntries=function(data){
$.log("mapbrowseResultEntries"); $.log("mapBrowseResultEntries");
if (data.browseResultEntries) { if (data.browseResultEntries) {
return $.isArray(data.browseResultEntries) ? return $.isArray(data.browseResultEntries) ?
$.map(data.browseResultEntries,function(item){ $.map(data.browseResultEntries,function(item){