mirror of https://github.com/apache/archiva.git
handle navigation for used-by tab in artifact detail view
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371489 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a0903fa853
commit
ab3edfb450
|
@ -245,15 +245,23 @@ function() {
|
|||
return;
|
||||
});
|
||||
|
||||
var checkArtifactDetailContent=function(groupId,artifactId,version,repositoryId,tabToActivate){
|
||||
var checkArtifactDetailContent=function(groupId,artifactId,version,repositoryId,tabToActivate,idContentToCheck,contentDisplayFn){
|
||||
// no need to recalculate all stuff just activate the tab
|
||||
if($("#browse_artifact_detail" ).html()!=null){
|
||||
var htmlId = idContentToCheck?idContentToCheck:"browse_artifact_detail";
|
||||
if($("#main-content #"+htmlId ).html()!=null){
|
||||
if( $.trim($("#browse_artifact_detail" ).html().length)>0){
|
||||
$("#main-content #"+tabToActivate).tab('show')
|
||||
return;
|
||||
}
|
||||
}
|
||||
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #"+tabToActivate).tab('show')});
|
||||
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,
|
||||
function(){
|
||||
$("#main-content #"+tabToActivate).tab('show')
|
||||
if(contentDisplayFn){
|
||||
contentDisplayFn();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.get('#artifact/:groupId/:artifactId/:version',function(context){
|
||||
|
@ -312,6 +320,47 @@ function() {
|
|||
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependency-tree-content-a");
|
||||
});
|
||||
|
||||
this.get('#artifact-used-by/: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;
|
||||
|
||||
var calculateUsedBy=function(){
|
||||
var dependeesContentDiv=$("#main-content #artifact-details-used-by-content" );
|
||||
if( $.trim(dependeesContentDiv.html()).length<1){
|
||||
dependeesContentDiv.html(mediumSpinnerImg());
|
||||
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
|
||||
dependeesUrl+="/"+encodeURIComponent(artifactId);
|
||||
dependeesUrl+="/"+encodeURIComponent(version);
|
||||
var selectedRepo=getSelectedBrowsingRepository();
|
||||
if (selectedRepo){
|
||||
dependeesUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
|
||||
}
|
||||
$.ajax(dependeesUrl, {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var artifacts=mapArtifacts(data);
|
||||
dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-used-by-content-a","artifact-details-used-by-content",calculateUsedBy);
|
||||
});
|
||||
|
||||
this.get('#artifact-used-by~: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-used-by-content-a");
|
||||
});
|
||||
|
||||
|
||||
this.get('#browse/:groupId',function(context){
|
||||
var groupId = this.params.groupId;
|
||||
|
|
|
@ -307,25 +307,13 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
|
|||
}
|
||||
|
||||
if ($(e.target).attr("data-target")=="#artifact-details-used-by-content") {
|
||||
var dependeesContentDiv=mainContent.find("#artifact-details-used-by-content" );
|
||||
if( $.trim(dependeesContentDiv.html()).length<1){
|
||||
dependeesContentDiv.html(mediumSpinnerImg());
|
||||
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
|
||||
dependeesUrl+="/"+encodeURIComponent(artifactId);
|
||||
dependeesUrl+="/"+encodeURIComponent(version);
|
||||
var selectedRepo=getSelectedBrowsingRepository();
|
||||
if (selectedRepo){
|
||||
dependeesUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
|
||||
}
|
||||
$.ajax(dependeesUrl, {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var artifacts=mapArtifacts(data);
|
||||
dependeesContentDiv.html($("#dependees_tmpl" ).tmpl({artifacts: artifacts}));
|
||||
}
|
||||
});
|
||||
var location ="#artifact-used-by";
|
||||
if (self.repositoryId){
|
||||
location+="~"+self.repositoryId;
|
||||
}
|
||||
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
|
||||
|
||||
window.sammyArchivaApplication.setLocation(location);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -435,19 +435,19 @@
|
|||
<a data-toggle="tab" id="artifact-details-dependency-tree-content-a" data-target="#artifact-details-dependency-tree-content" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
|
||||
<a data-toggle="tab" id="artifact-details-files-content-a" data-target="#artifact-details-files-content" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#artifact-details-download-content">${$.i18n.prop('artifact.detail.tab.header.file.download')}</a>
|
||||
<a data-toggle="tab" id="artifact-details-download-content-a" data-target="#artifact-details-download-content" href="#artifact-details-download-content">${$.i18n.prop('artifact.detail.tab.header.file.download')}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#artifact-details-used-by-content">${$.i18n.prop('artifact.detail.tab.header.used.by')}</a>
|
||||
<a data-toggle="tab" id="artifact-details-used-by-content-a" data-target="#artifact-details-used-by-content" href="#artifact-details-used-by-content">${$.i18n.prop('artifact.detail.tab.header.used.by')}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#artifact-details-mailing-list-content">${$.i18n.prop('artifact.detail.tab.header.mailing.list')}</a>
|
||||
<a data-toggle="tab" id="artifact-details-mailing-list-content-a" data-target="#artifact-details-mailing-list-content" href="#artifact-details-mailing-list-content">${$.i18n.prop('artifact.detail.tab.header.mailing.list')}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#artifact-details-metadatas-content">${$.i18n.prop('artifact.detail.tab.header.metadatas')}</a>
|
||||
<a data-toggle="tab" id="artifact-details-metadatas-content-a" data-target="#artifact-details-metadatas-content" href="#artifact-details-metadatas-content">${$.i18n.prop('artifact.detail.tab.header.metadatas')}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
|
Loading…
Reference in New Issue