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){
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;
}
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;
}
<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">