mirror of https://github.com/apache/archiva.git
display artifact info in artifact detail
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1293694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b3e4b0439a
commit
628c50b48d
|
@ -57,15 +57,7 @@ $(function() {
|
||||||
breadCrumbEntries=function(){
|
breadCrumbEntries=function(){
|
||||||
// root level ?
|
// root level ?
|
||||||
if (!self.parentBrowseViewModel) return [];
|
if (!self.parentBrowseViewModel) return [];
|
||||||
var splitted = self.groupId.split(".");
|
return calculateBreadCrumbEntries(self.groupId);
|
||||||
var breadCrumbEntries=[];
|
|
||||||
var curGroupId="";
|
|
||||||
for (var i=0;i<splitted.length;i++){
|
|
||||||
curGroupId+=splitted[i];
|
|
||||||
breadCrumbEntries.push(new BreadCrumbEntry(curGroupId,splitted[i]));
|
|
||||||
curGroupId+="."
|
|
||||||
}
|
|
||||||
return breadCrumbEntries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayEntry=function(value){
|
displayEntry=function(value){
|
||||||
|
@ -76,11 +68,23 @@ $(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calculateBreadCrumbEntries=function(groupId){
|
||||||
|
var splitted = groupId.split(".");
|
||||||
|
var breadCrumbEntries=[];
|
||||||
|
var curGroupId="";
|
||||||
|
for (var i=0;i<splitted.length;i++){
|
||||||
|
curGroupId+=splitted[i];
|
||||||
|
breadCrumbEntries.push(new BreadCrumbEntry(curGroupId,splitted[i]));
|
||||||
|
curGroupId+="."
|
||||||
|
}
|
||||||
|
return breadCrumbEntries;
|
||||||
|
}
|
||||||
|
|
||||||
displayGroupDetail=function(groupId,parentBrowseViewModel,restUrl){
|
displayGroupDetail=function(groupId,parentBrowseViewModel,restUrl){
|
||||||
var mainContent = $("#main-content");
|
var mainContent = $("#main-content");
|
||||||
var browseResult=mainContent.find("#browse_result");
|
var browseResult=mainContent.find("#browse_result");
|
||||||
|
browseResult.show();
|
||||||
|
mainContent.find("#browse_artifact" ).hide();
|
||||||
var browseBreadCrumb=mainContent.find("#browse_breadcrumb");
|
var browseBreadCrumb=mainContent.find("#browse_breadcrumb");
|
||||||
mainContent.find("#main_browse_result_content").hide( "slide", {}, 300,
|
mainContent.find("#main_browse_result_content").hide( "slide", {}, 300,
|
||||||
function(){
|
function(){
|
||||||
|
@ -94,36 +98,63 @@ $(function() {
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var browseResultEntries = mapbrowseResultEntries(data);
|
var browseResultEntries = mapbrowseResultEntries(data);
|
||||||
var browseViewModel = new BrowseViewModel(browseResultEntries,parentBrowseViewModel,groupId);
|
var browseViewModel = new BrowseViewModel(browseResultEntries,parentBrowseViewModel,groupId);
|
||||||
ko.applyBindings(browseViewModel,mainContent.get(0));
|
ko.applyBindings(browseViewModel,browseBreadCrumb.get(0));
|
||||||
|
ko.applyBindings(browseViewModel,browseResult.get(0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtifactDetailViewModel=function(){
|
ArtifactDetailViewModel=function(groupId,artifactId){
|
||||||
|
var self=this;
|
||||||
this.versions=[];
|
this.versions=[];
|
||||||
this.projectVersionMetadata=null;
|
this.projectVersionMetadata=null;
|
||||||
|
this.groupId=groupId;
|
||||||
|
this.artifactId=artifactId;
|
||||||
|
breadCrumbEntries=function(){
|
||||||
|
var entries = calculateBreadCrumbEntries(self.groupId);
|
||||||
|
entries.push(new BreadCrumbEntry("foo",self.artifactId));
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
displayArtifactInfo=function(){
|
||||||
|
if ($("#main-content #artifact-info:visible" ).length>0) {
|
||||||
|
$("#main-content #artifact-info" ).hide();
|
||||||
|
} else {
|
||||||
|
$("#main-content #artifact-info" ).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){
|
displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){
|
||||||
$.log("displayArtifactDetail:"+groupId+":"+artifactId);
|
$.log("displayArtifactDetail:"+groupId+":"+artifactId);
|
||||||
var artifactDetailViewModel=new ArtifactDetailViewModel();
|
var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId);
|
||||||
$.ajax("restServices/archivaServices/browseService/projectVersionMetadata/"+groupId+"/"+artifactId, {
|
var mainContent = $("#main-content");
|
||||||
type: "GET",
|
mainContent.find("#browse_result").hide();
|
||||||
dataType: 'json',
|
mainContent.find("#main_browse_result_content").hide("slide", {}, 300,function(){
|
||||||
success: function(data) {
|
mainContent.find("#browse_breadcrumb").html(smallSpinnerImg());
|
||||||
artifactDetailViewModel.projectVersionMetadata=mapProjectVersionMetadata(data);
|
mainContent.find("#browse_artifact").show();
|
||||||
$.ajax("restServices/archivaServices/browseService/versionsList/"+groupId+"/"+artifactId, {
|
mainContent.find("#browse_artifact").html(mediumSpinnerImg());
|
||||||
type: "GET",
|
mainContent.find("#main_browse_result_content").show();
|
||||||
dataType: 'json',
|
$.ajax("restServices/archivaServices/browseService/projectVersionMetadata/"+groupId+"/"+artifactId, {
|
||||||
success: function(data) {
|
type: "GET",
|
||||||
artifactDetailViewModel.versions=mapVersionsList(data);
|
dataType: 'json',
|
||||||
}
|
success: function(data) {
|
||||||
});
|
artifactDetailViewModel.projectVersionMetadata=mapProjectVersionMetadata(data);
|
||||||
|
$.ajax("restServices/archivaServices/browseService/versionsList/"+groupId+"/"+artifactId, {
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
artifactDetailViewModel.versions=mapVersionsList(data);
|
||||||
|
ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_artifact").get(0));
|
||||||
|
ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_breadcrumb").get(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +177,8 @@ $(function() {
|
||||||
var browseResultEntries = mapbrowseResultEntries(data);
|
var browseResultEntries = mapbrowseResultEntries(data);
|
||||||
$.log("size:"+browseResultEntries.length);
|
$.log("size:"+browseResultEntries.length);
|
||||||
var browseViewModel = new BrowseViewModel(browseResultEntries,null,null);
|
var browseViewModel = new BrowseViewModel(browseResultEntries,null,null);
|
||||||
ko.applyBindings(browseViewModel,mainContent.get(0));
|
ko.applyBindings(browseViewModel,mainContent.find("#browse_breadcrumb").get(0));
|
||||||
|
ko.applyBindings(browseViewModel,mainContent.find("#browse_result").get(0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -183,6 +215,8 @@ $(function() {
|
||||||
BreadCrumbEntry=function(groupId,displayValue){
|
BreadCrumbEntry=function(groupId,displayValue){
|
||||||
this.groupId=groupId;
|
this.groupId=groupId;
|
||||||
this.displayValue=displayValue;
|
this.displayValue=displayValue;
|
||||||
|
this.artifactId=null;
|
||||||
|
this.artifact=false;
|
||||||
}
|
}
|
||||||
mapVersionsList=function(data){
|
mapVersionsList=function(data){
|
||||||
if (data.versionsList){
|
if (data.versionsList){
|
||||||
|
@ -195,44 +229,50 @@ $(function() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
mapProjectVersionMetadata=function(data){
|
mapProjectVersionMetadata=function(data){
|
||||||
if (data.projectVersionMetadata){
|
if (data && data.projectVersionMetadata){
|
||||||
var projectVersionMetadata = new ProjectVersionMetadata(data.id,data.url,data.name,data.description,null,null,null,null,null,
|
var projectVersionMetadata =
|
||||||
null,null,data.incomplete);
|
new ProjectVersionMetadata(data.projectVersionMetadata.id,data.projectVersionMetadata.url,
|
||||||
if (data.organization){
|
data.projectVersionMetadata.name,data.projectVersionMetadata.description,
|
||||||
projectVersionMetadata.organization=new Organization(data.organization.name,data.organization.url);
|
null,null,null,null,null,null,null,data.projectVersionMetadata.incomplete);
|
||||||
|
|
||||||
|
if (data.projectVersionMetadata.organization){
|
||||||
|
projectVersionMetadata.organization=new Organization(data.projectVersionMetadata.organization.name,data.projectVersionMetadata.organization.url);
|
||||||
}
|
}
|
||||||
if (data.issueManagement){
|
if (data.projectVersionMetadata.issueManagement){
|
||||||
projectVersionMetadata.issueManagement=new IssueManagement(data.issueManagement.system,data.issueManagement.url);
|
projectVersionMetadata.issueManagement=
|
||||||
|
new IssueManagement(data.projectVersionMetadata.issueManagement.system,data.projectVersionMetadata.issueManagement.url);
|
||||||
}
|
}
|
||||||
if (data.scm){
|
if (data.projectVersionMetadata.scm){
|
||||||
projectVersionMetadata.scm=new Scm(data.scm.connection,data.scm.developerConnection,data.scm.url);
|
projectVersionMetadata.scm=
|
||||||
|
new Scm(data.projectVersionMetadata.scm.connection,data.projectVersionMetadata.scm.developerConnection,data.projectVersionMetadata.scm.url);
|
||||||
}
|
}
|
||||||
if (data.ciManagement){
|
if (data.projectVersionMetadata.ciManagement){
|
||||||
projectVersionMetadata.ciManagement=new CiManagement(data.ciManagement.system,data.ciManagement.url);
|
projectVersionMetadata.ciManagement=new CiManagement(data.projectVersionMetadata.ciManagement.system,data.projectVersionMetadata.ciManagement.url);
|
||||||
}
|
}
|
||||||
if (data.licenses){
|
if (data.projectVersionMetadata.licenses){
|
||||||
var licenses =
|
var licenses =
|
||||||
$.isArray(data.licenses) ? $.map(data.licenses,function(item){
|
$.isArray(data.projectVersionMetadata.licenses) ? $.map(data.projectVersionMetadata.licenses,function(item){
|
||||||
return new License(item.name,item.url);
|
return new License(item.name,item.url);
|
||||||
}):[data.licenses];
|
}):[data.projectVersionMetadata.licenses];
|
||||||
projectVersionMetadata.licenses=licenses;
|
projectVersionMetadata.licenses=licenses;
|
||||||
}
|
}
|
||||||
if (data.mailingLists){
|
if (data.projectVersionMetadata.mailingLists){
|
||||||
var mailingLists =
|
var mailingLists =
|
||||||
$.isArray(data.mailingLists) ? $.map(data.mailingLists,function(item){
|
$.isArray(data.projectVersionMetadata.mailingLists) ? $.map(data.projectVersionMetadata.mailingLists,function(item){
|
||||||
return new MailingList(item.mainArchiveUrl,item.otherArchives,item.name,item.postAddress,
|
return new MailingList(item.mainArchiveUrl,item.otherArchives,item.name,item.postAddress,
|
||||||
item.subscribeAddress,item.unsubscribeAddress);
|
item.subscribeAddress,item.unsubscribeAddress);
|
||||||
}):[data.mailingLists];
|
}):[data.projectVersionMetadata.mailingLists];
|
||||||
projectVersionMetadata.mailingLists=mailingLists;
|
projectVersionMetadata.mailingLists=mailingLists;
|
||||||
}
|
}
|
||||||
if (data.dependencies){
|
if (data.projectVersionMetadata.dependencies){
|
||||||
var dependencies =
|
var dependencies =
|
||||||
$.isArray(data.dependencies) ? $.map(data.dependencies,function(item){
|
$.isArray(data.projectVersionMetadata.dependencies) ? $.map(data.projectVersionMetadata.dependencies,function(item){
|
||||||
return new Dependency(item.classifier,item.optional,item.scope,item.systemPath,item.type,
|
return new Dependency(item.classifier,item.optional,item.scope,item.systemPath,item.type,
|
||||||
item.artifactId,item.groupId,item.version);
|
item.artifactId,item.groupId,item.version);
|
||||||
}):[data.dependencies];
|
}):[data.projectVersionMetadata.dependencies];
|
||||||
projectVersionMetadata.dependencies=dependencies;
|
projectVersionMetadata.dependencies=dependencies;
|
||||||
}
|
}
|
||||||
|
$.log("projectVersionMetadata.issueManagement.system:"+(projectVersionMetadata.issueManagement?projectVersionMetadata.issueManagement.system:"null"));
|
||||||
return projectVersionMetadata;
|
return projectVersionMetadata;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -78,7 +78,6 @@
|
||||||
<a href="#" data-bind="click: function(){displayGroupId(breadCrumbEntry.groupId)}">${breadCrumbEntry.displayValue}</a>
|
<a href="#" data-bind="click: function(){displayGroupId(breadCrumbEntry.groupId)}">${breadCrumbEntry.displayValue}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if i<number-1}}
|
{{if i<number-1}}
|
||||||
|
|
||||||
<span class="divider">/</span>
|
<span class="divider">/</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
|
@ -87,5 +86,35 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="browse-artifact-tmpl" type="text/html">
|
<script id="browse-artifact-tmpl" type="text/html">
|
||||||
foo
|
<div class="row-fluid">
|
||||||
|
<div>
|
||||||
|
<a href="#" data-bind="click: function(){displayArtifactInfo()}">
|
||||||
|
${$.i18n.prop('browse.artifact.display.artifactInfo')}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<div id="artifact-info" class="alert alert-info" style="display: none">
|
||||||
|
<div>${$.i18n.prop('browse.artifact.groupId')}: ${groupId}</div>
|
||||||
|
<div>${$.i18n.prop('browse.artifact.artifactId')}: ${artifactId}</div>
|
||||||
|
<div>${$.i18n.prop('browse.artifact.name')}: ${projectVersionMetadata.name}</div>
|
||||||
|
<div>${$.i18n.prop('browse.artifact.organization.name')}: ${projectVersionMetadata.organization.name}</div>
|
||||||
|
{{if projectVersionMetadata.issueManagement}}
|
||||||
|
<div>${$.i18n.prop('browse.artifact.organization.issueManagement')}:
|
||||||
|
<a href="${projectVersionMetadata.issueManagement.url}" target="_blank">${projectVersionMetadata.issueManagement.system}</a>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<h4>${$.i18n.prop('browse.artifact.versions')}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
{{each(i,version) versions}}
|
||||||
|
<li>${version}</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue