[MRM-863] Paginate Used By tab

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1399591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-18 11:44:51 +00:00
parent 86f58f2457
commit b06d4e210f
2 changed files with 53 additions and 32 deletions

View File

@ -507,8 +507,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
var calculateUsedBy=function(groupId,artifactId,version){ var calculateUsedBy=function(groupId,artifactId,version){
var dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" ); var dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" );
if( $.trim(dependeesContentDiv.html()).length<1){ //if( $.trim(dependeesContentDiv.html()).length<1){
dependeesContentDiv.html(mediumSpinnerImg()); dependeesContentDiv.append(mediumSpinnerImg());
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId); var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
dependeesUrl+="/"+encodeURIComponent(artifactId); dependeesUrl+="/"+encodeURIComponent(artifactId);
dependeesUrl+="/"+encodeURIComponent(version); dependeesUrl+="/"+encodeURIComponent(version);
@ -521,10 +521,25 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var artifacts=mapArtifacts(data); var artifacts=mapArtifacts(data);
dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts})); //dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts}));
var gridViewModel = new ko.simpleGrid.viewModel({
data: artifacts,
columns: [],
pageSize: 2,
gridUpdateCallBack: function(){
// no op
} }
}); });
$.log("artifacts:"+artifacts.length);
dependeesContentDiv.find("#artifact-usedby-table").attr("data-bind",
"simpleGrid: gridViewModel,simpleGridTemplate:'dependees_tmpl',pageLinksId:'usedbyPagination',data:'artifacts'");
ko.applyBindings({artifacts:artifacts,gridViewModel:gridViewModel},dependeesContentDiv.get(0));
},
complete: function(){
removeMediumSpinnerImg(("#artifact-details-used-by-content"));
} }
});
//}
}; };
this.get('#artifact-used-by/:groupId/:artifactId/:version',function(context){ this.get('#artifact-used-by/:groupId/:artifactId/:version',function(context){

View File

@ -638,7 +638,11 @@
<div id="artifact-details-download-content" class="tab-pane"></div> <div id="artifact-details-download-content" class="tab-pane"></div>
<div id="artifact-details-used-by-content" class="tab-pane"></div> <div id="artifact-details-used-by-content" class="tab-pane">
<table class="table table-striped table-bordered" id="artifact-usedby-table">
</table>
<div id="usedbyPagination"></div>
</div>
<div id="artifact-details-mailing-list-content" class="tab-pane"> <div id="artifact-details-mailing-list-content" class="tab-pane">
{{if projectVersionMetadata.mailingLists && projectVersionMetadata.mailingLists.length>0}} {{if projectVersionMetadata.mailingLists && projectVersionMetadata.mailingLists.length>0}}
@ -771,8 +775,10 @@
</script> </script>
<script id="dependees_tmpl" type="text/html"> <script id="dependees_tmpl" type="text/html">
fooo
<ul> <ul>
{{each(i,artifact) artifacts}} {{each(i, artifact) itemsOnCurrentPage()}}
<li> <li>
{{var entries=artifact.crumbEntries()}} {{var entries=artifact.crumbEntries()}}
{{each(j,crumbEntry) entries}} {{each(j,crumbEntry) entries}}