mirror of https://github.com/apache/archiva.git
handle navigation for metatadata tab in artifact detail view
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371828 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
273aeb97a7
commit
22479f55ee
|
@ -256,10 +256,10 @@ function() {
|
|||
}
|
||||
}
|
||||
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,
|
||||
function(){
|
||||
function(artifactVersionDetailViewModel){
|
||||
$("#main-content #"+tabToActivate).tab('show')
|
||||
if(contentDisplayFn){
|
||||
contentDisplayFn(groupId,artifactId,version);
|
||||
contentDisplayFn(groupId,artifactId,version,artifactVersionDetailViewModel);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -362,6 +362,49 @@ function() {
|
|||
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-used-by-content-a","artifact-details-used-by-content",calculateUsedBy);
|
||||
});
|
||||
|
||||
var calculateMetadatas=function(groupId,artifactId,version,artifactVersionDetailViewModel){
|
||||
|
||||
var metadatasContentDiv=$("#main-content #artifact-details-metadatas-content" );
|
||||
var metadatasUrl="restServices/archivaServices/browseService/metadatas/"+encodeURIComponent(groupId);
|
||||
metadatasUrl+="/"+encodeURIComponent(artifactId);
|
||||
metadatasUrl+="/"+encodeURIComponent(version);
|
||||
var selectedRepo=getSelectedBrowsingRepository();
|
||||
if (selectedRepo){
|
||||
metadatasUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
|
||||
}
|
||||
|
||||
//fixe self.entries not in the scope
|
||||
|
||||
$.ajax(metadatasUrl, {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var entries= $.map(data,function(e,i){
|
||||
return new MetadataEntry( e.key, e.value,false);
|
||||
});
|
||||
artifactVersionDetailViewModel.entries(entries);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.get('#artifact-metadatas/: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-metadatas-content-a",null,calculateMetadatas);
|
||||
});
|
||||
|
||||
this.get('#artifact-metadatas~: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-metadatas-content-a",null,calculateMetadatas);
|
||||
});
|
||||
|
||||
|
||||
this.get('#browse/:groupId',function(context){
|
||||
var groupId = this.params.groupId;
|
||||
|
|
|
@ -318,25 +318,13 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
}
|
||||
|
||||
if ($(e.target).attr("href")=="#artifact-details-metadatas-content") {
|
||||
$.log("artifact metadata");
|
||||
var metadatasContentDiv=mainContent.find("#artifact-details-metadatas-content" );
|
||||
var metadatasUrl="restServices/archivaServices/browseService/metadatas/"+encodeURIComponent(groupId);
|
||||
metadatasUrl+="/"+encodeURIComponent(artifactId);
|
||||
metadatasUrl+="/"+encodeURIComponent(version);
|
||||
var selectedRepo=getSelectedBrowsingRepository();
|
||||
if (selectedRepo){
|
||||
metadatasUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
|
||||
var location ="#artifact-metadatas";
|
||||
if (self.repositoryId){
|
||||
location+="~"+self.repositoryId;
|
||||
}
|
||||
$.ajax(metadatasUrl, {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var entries= $.map(data,function(e,i){
|
||||
return new MetadataEntry( e.key, e.value,false);
|
||||
});
|
||||
self.entries(entries);
|
||||
}
|
||||
});
|
||||
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
|
||||
|
||||
window.sammyArchivaApplication.setLocation(location);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -357,7 +345,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
}
|
||||
});
|
||||
if(afterCallbackFn){
|
||||
afterCallbackFn();
|
||||
afterCallbackFn(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue