mirror of https://github.com/apache/archiva.git
[MRM-1620] add a tab to browse artifact content in artifact detail view
pom view ! git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd37dbe4b4
commit
de4d335725
|
@ -279,15 +279,45 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
|
||||||
|
|
||||||
$.get(artifactDownloadInfosUrl,function(data){
|
$.get(artifactDownloadInfosUrl,function(data){
|
||||||
$("#artifact-details-files-content" ).html($("#artifact-details-files-content_tmpl").tmpl({artifactDownloadInfos:data}));
|
$("#artifact-details-files-content" ).html($("#artifact-details-files-content_tmpl").tmpl({artifactDownloadInfos:data}));
|
||||||
|
mainContent.find("#artifact-content-list-files li" ).on("click",function(){
|
||||||
|
var idValue = $(this ).attr("id");
|
||||||
|
var classifier=idValue.substringBeforeLast(":");
|
||||||
|
var type = idValue.substringAfterLast(":");
|
||||||
|
$.log("click:" + idValue + " -> " + classifier + ":" + type );
|
||||||
|
if (type=="pom"){
|
||||||
|
$.log("show pom");
|
||||||
|
var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
|
||||||
|
pomContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
|
||||||
|
pomContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
|
||||||
|
pomContentUrl+="&t=pom";
|
||||||
|
$.ajax({
|
||||||
|
url: pomContentUrl,
|
||||||
|
dataType: "text",
|
||||||
|
success: function(data) {
|
||||||
|
$.log("foo");
|
||||||
|
$.log("data:"+data);
|
||||||
|
var text = data.replace(/</g,'<');
|
||||||
|
text=text.replace(/>/g,">");
|
||||||
|
mainContent.find("#artifact-content-text" ).html(text);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
|
var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
|
||||||
entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
|
entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
|
||||||
entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
|
entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
|
||||||
|
if(classifier){
|
||||||
|
entriesUrl+="&c="+classifier;
|
||||||
|
}
|
||||||
$("#main-content #artifact_content_tree").fileTree({
|
$("#main-content #artifact_content_tree").fileTree({
|
||||||
script: entriesUrl,
|
script: entriesUrl,
|
||||||
root: ""
|
root: ""
|
||||||
},function(file) {
|
},function(file) {
|
||||||
|
$.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,6 +389,10 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() {
|
||||||
return this.substring(0,this.lastIndexOf(str));
|
return this.substring(0,this.lastIndexOf(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String.prototype.substringAfterLast = function(str) {
|
||||||
|
return this.substring(this.lastIndexOf(str)+1);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
// extends jquery tmpl to support var def
|
// extends jquery tmpl to support var def
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
|
|
|
@ -810,9 +810,11 @@
|
||||||
<script id="artifact-details-files-content_tmpl" type="text/html">
|
<script id="artifact-details-files-content_tmpl" type="text/html">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<ul>
|
<ul id="artifact-content-list-files">
|
||||||
{{each artifactDownloadInfos}}
|
{{each artifactDownloadInfos}}
|
||||||
<li>${$value.type}:${$value.classifier}</li>
|
<li id="${$value.classifier}:${$value.type}">
|
||||||
|
<a href="#">${$value.type}</a>
|
||||||
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -821,4 +823,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h4>Content</h4>
|
||||||
|
<div>
|
||||||
|
<pre id="artifact-content-text"></pre>
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue