[MRM-1620] add a tab to browse artifact content in artifact detail view

being able to see file content of each artifact (pom, sources etc..)

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341043 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-05-21 14:23:35 +00:00
parent ba65bc6ad7
commit e9d4231e1b
2 changed files with 38 additions and 15 deletions

View File

@ -270,20 +270,28 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
});
}
if ($(e.target).attr("href")=="#artifact-details-file-content") {
if ($(e.target).attr("href")=="#artifact-details-files-content") {
$.log("file content:"+self.groupId+":"+self.artifactId+":"+self.version);
var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
//entriesUrl+="&p="+encodeURIComponent(artifactContentEntry.name);
var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.groupId);
artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
$.get(artifactDownloadInfosUrl,function(data){
$("#artifact-details-files-content" ).html($("#artifact-details-files-content_tmpl").tmpl({artifactDownloadInfos:data}));
var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
//entriesUrl+="&p="+encodeURIComponent(artifactContentEntry.name);
$("#main-content #artifact_content_tree").fileTree({
script: entriesUrl,
root: ""
},function(file) {
});
});
$("#main-content #artifact_content_tree").fileTree({
script: entriesUrl,
root: ""
},function(file) {
//alert(file);
});
}
});
}

View File

@ -433,7 +433,7 @@
<a data-toggle="tab" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a>
</li>
<li>
<a data-toggle="tab" href="#artifact-details-file-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
<a data-toggle="tab" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
</li>
<li>
<a data-toggle="tab" href="#artifact-details-used-by-content">${$.i18n.prop('artifact.detail.tab.header.used.by')}</a>
@ -628,9 +628,8 @@
<div id="artifact-details-dependency-tree-content" class="tab-pane">
</div>
<div id="artifact-details-file-content" class="tab-pane">
<div id="artifact_content_tree">
</div>
<div id="artifact-details-files-content" class="tab-pane">
</div>
<div id="artifact-details-used-by-content" class="tab-pane"></div>
@ -806,4 +805,20 @@
{{/if}}
{{/each}}
</ul>
</script>
<script id="artifact-details-files-content_tmpl" type="text/html">
<div class="row">
<div class="span4">
<ul>
{{each artifactDownloadInfos}}
<li>${$value.type}:${$value.classifier}</li>
{{/each}}
</ul>
</div>
<div class="span8">
<div id="artifact_content_tree">
</div>
</div>
</div>
</script>