history navigation when seeing artifact dependency tree

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-09 21:12:28 +00:00
parent 3b0eb2985c
commit ce9d1c8f8f
3 changed files with 67 additions and 20 deletions

View File

@ -281,6 +281,28 @@ function() {
});
this.get('#artifact-dependency-tree/: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;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #artifact-details-dependency-tree-content-a").tab('show')});
});
this.get('#artifact-dependency-tree~: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;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #artifact-details-dependency-tree-content-a").tab('show')});
});
this.get('#browse/:groupId',function(context){
var groupId = this.params.groupId;
if (groupId){

View File

@ -243,8 +243,43 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
ko.applyBindings(self,mainContent.find("#browse_breadcrumb" ).get(0));
mainContent.find("#browse-autocomplete" ).hide();
mainContent.find("#browse-autocomplete-divider" ).hide();
//calculate tree content
var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" );
if( $.trim(treeContentDiv.html()).length<1){
treeContentDiv.html(mediumSpinnerImg());
var treeDependencyUrl="restServices/archivaServices/browseService/treeEntries/"+encodeURIComponent(groupId);
treeDependencyUrl+="/"+encodeURIComponent(artifactId);
treeDependencyUrl+="/"+encodeURIComponent(version);
var selectedRepo=getSelectedBrowsingRepository();
if (selectedRepo){
treeDependencyUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
}
$.ajax(treeDependencyUrl, {
type: "GET",
dataType: 'json',
success: function(data) {
var treeEntries = mapTreeEntries(data);
treeContentDiv.html($("#dependency_tree_tmpl" ).tmpl({treeEntries: treeEntries}));
}
});
}
mainContent.find("#artifact-details-tabs").on('show', function (e) {
if ($(e.target).attr("data-target")=="#artifact-details-info-content") {
var location ="#artifact";
if (self.repositoryId){
location+="~"+self.repositoryId;
}
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
window.sammyArchivaApplication.setLocation(location);
return;
}
if ($(e.target).attr("data-target")=="#artifact-details-dependencies-content") {
var location ="#artifact-dependencies";
if (self.repositoryId){
@ -253,28 +288,18 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
window.sammyArchivaApplication.setLocation(location);
return;
}
if ($(e.target).attr("href")=="#artifact-details-dependency-tree-content") {
var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" );
if( $.trim(treeContentDiv.html()).length<1){
treeContentDiv.html(mediumSpinnerImg());
var treeDependencyUrl="restServices/archivaServices/browseService/treeEntries/"+encodeURIComponent(groupId);
treeDependencyUrl+="/"+encodeURIComponent(artifactId);
treeDependencyUrl+="/"+encodeURIComponent(version);
var selectedRepo=getSelectedBrowsingRepository();
if (selectedRepo){
treeDependencyUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
}
$.ajax(treeDependencyUrl, {
type: "GET",
dataType: 'json',
success: function(data) {
var treeEntries = mapTreeEntries(data);
treeContentDiv.html($("#dependency_tree_tmpl" ).tmpl({treeEntries: treeEntries}));
}
});
if ($(e.target).attr("data-target")=="#artifact-details-dependency-tree-content") {
var location ="#artifact-dependency-tree";
if (self.repositoryId){
location+="~"+self.repositoryId;
}
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
window.sammyArchivaApplication.setLocation(location);
return;
return;
}
if ($(e.target).attr("href")=="#artifact-details-used-by-content") {

View File

@ -426,7 +426,7 @@
<script id="browse-artifact-detail-tmpl" type="text/html">
<ul id="artifact-details-tabs" class="nav nav-tabs">
<li class="active">
<a data-toggle="tab" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
<a data-toggle="tab" id="artifact-details-info-content-a" data-target="#artifact-details-info-content" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
</li>
<li>
<a data-toggle="tab" id="artifact-details-dependencies-content-a" data-target="#artifact-details-dependencies-content" href="#artifact-details-dependencies-content">${$.i18n.prop('artifact.detail.tab.header.dependencies')}</a>