browsing download artifacts content is now navigable

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1378030 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-28 09:08:01 +00:00
parent fc50439f7f
commit 7a447503fd
2 changed files with 56 additions and 19 deletions

View File

@ -393,6 +393,32 @@ function(jquery,ui,sammy,tmpl) {
});
this.get('#artifact-details-download-content/:groupId/:artifactId/:version',function(context){
var repositoryId = this.params.repositoryId;
var groupId= this.params.groupId;
var artifactId= this.params.artifactId;
var version= this.params.version;
checkArtifactDetailContent(groupId,artifactId,version,null,"artifact-details-download-content-a","artifact-details-download-content",
function(groupId,artifactId,version,artifactVersionDetailViewModel){
displayArtifactDownloadContent(artifactVersionDetailViewModel);
});
});
this.get('#artifact-details-download-content~:repositoryId/:groupId/:artifactId/:version',function(context){
var repositoryId = this.params.repositoryId;
var groupId= this.params.groupId;
var artifactId= this.params.artifactId;
var version= this.params.version;
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-download-content-a","artifact-details-download-content",
function(groupId,artifactId,version,artifactVersionDetailViewModel){
displayArtifactDownloadContent(artifactVersionDetailViewModel);
});
});
this.get('#artifact-dependency-tree/:groupId/:artifactId/:version',function(context){

View File

@ -329,19 +329,16 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
}
if ($(e.target).attr("href")=="#artifact-details-download-content") {
mainContent.find("#artifact-details-download-content" ).html(smallSpinnerImg());
var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.groupId);
artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
$.get(artifactDownloadInfosUrl,function(data){
var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data),self);
mainContent.find("#artifact-details-download-content" ).attr("data-bind",'template:{name:"artifact-details-download-content_tmpl"}');
ko.applyBindings(artifactDetailsDownloadViewModel,mainContent.find("#artifact-details-download-content" ).get(0));
});
var location ="#artifact-details-download-content";
if (self.repositoryId){
location+="~"+self.repositoryId;
}
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
window.sammyArchivaApplication.setLocation(location);
return;
}
if ($(e.target).attr("href")=="#artifact-details-files-content") {
//displayArtifactFilesContent(self);
var location ="#artifact-details-files-content";
if (self.repositoryId){
location+="~"+self.repositoryId;
@ -520,11 +517,25 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
}
displayArtifactFilesContent=function(self){
displayArtifactDownloadContent=function(artifactVersionDetailViewModel){
var mainContent=$("#main-content");
mainContent.find("#artifact-details-download-content" ).html(smallSpinnerImg());
var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
artifactDownloadInfosUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(artifactVersionDetailViewModel.version);
artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
$.get(artifactDownloadInfosUrl,function(data){
var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data),artifactVersionDetailViewModel);
mainContent.find("#artifact-details-download-content" ).attr("data-bind",'template:{name:"artifact-details-download-content_tmpl"}');
ko.applyBindings(artifactDetailsDownloadViewModel,mainContent.find("#artifact-details-download-content" ).get(0));
});
return;
}
displayArtifactFilesContent=function(artifactVersionDetailViewModel){
var mainContent = $("#main-content");
mainContent.find("#artifact-details-files-content" ).html(smallSpinnerImg());
var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.groupId);
artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
artifactDownloadInfosUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(artifactVersionDetailViewModel.version);
artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
$.get(artifactDownloadInfosUrl,function(data){
@ -542,8 +553,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
$.log("click:" + idValue + " -> " + classifier + ":" + type + ":" + version);
if (type=="pom"){
$.log("show pom");
var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
pomContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version);
var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
pomContentUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
pomContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
pomContentUrl+="&t=pom";
mainContent.find("#artifact-content-text" ).html(smallSpinnerImg());
@ -559,8 +570,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
});
return;
}
var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version);
var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
entriesUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
if(classifier){
entriesUrl+="&c="+encodeURIComponent(classifier);
@ -570,8 +581,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
root: ""
},function(file) {
$.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier);
var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
fileContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version);
var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
fileContentUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
fileContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
if(type){
fileContentUrl+="&t="+encodeURIComponent(type);