[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 dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" );
if( $.trim(dependeesContentDiv.html()).length<1){
dependeesContentDiv.html(mediumSpinnerImg());
//if( $.trim(dependeesContentDiv.html()).length<1){
dependeesContentDiv.append(mediumSpinnerImg());
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
dependeesUrl+="/"+encodeURIComponent(artifactId);
dependeesUrl+="/"+encodeURIComponent(version);
@ -521,10 +521,25 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
dataType: 'json',
success: function(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){

View File

@ -638,7 +638,11 @@
<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">
{{if projectVersionMetadata.mailingLists && projectVersionMetadata.mailingLists.length>0}}
@ -713,33 +717,33 @@
<tbody>
{{each(i, row) itemsOnCurrentPage()}}
<tr>
<th>${row.artifactId}</th>
</tr>
<tr>
<td>
{{var entries=row.crumbEntries()}}
{{each(j,crumbEntry) entries}}
{{if j < entries.length - 2}}
<a href="#" data-bind="click: function(){displayGroup(crumbEntry.groupId)}">${crumbEntry.displayValue}</a>
{{else j == entries.length - 2}}
<a href="#" data-bind="click: function(){displayArtifactDetailView(crumbEntry.groupId,crumbEntry.artifactId)}">${crumbEntry.displayValue}</a>
{{else j == entries.length - 1}}
&nbsp;|&nbsp;<b>${$.i18n.prop('browse.artifact.version')}:</b>&nbsp;
<a href="#" data-bind="click: function(){displayArtifactVersionDetailViewModel(crumbEntry.groupId,crumbEntry.artifactId,crumbEntry.version)}">${row.version}</a>&nbsp;
{{/if}}
{{if j < entries.length - 2}}
&nbsp;/&nbsp;
{{/if}}
{{/each}}
{{each(i, row) itemsOnCurrentPage()}}
<tr>
<th>${row.artifactId}</th>
</tr>
<tr>
<td>
{{var entries=row.crumbEntries()}}
{{each(j,crumbEntry) entries}}
{{if j < entries.length - 2}}
<a href="#" data-bind="click: function(){displayGroup(crumbEntry.groupId)}">${crumbEntry.displayValue}</a>
{{else j == entries.length - 2}}
<a href="#" data-bind="click: function(){displayArtifactDetailView(crumbEntry.groupId,crumbEntry.artifactId)}">${crumbEntry.displayValue}</a>
{{else j == entries.length - 1}}
&nbsp;|&nbsp;<b>${$.i18n.prop('browse.artifact.version')}:</b>&nbsp;
<a href="#" data-bind="click: function(){displayArtifactVersionDetailViewModel(crumbEntry.groupId,crumbEntry.artifactId,crumbEntry.version)}">${row.version}</a>&nbsp;
{{/if}}
{{if j < entries.length - 2}}
&nbsp;/&nbsp;
{{/if}}
{{/each}}
{{if row.scope}}
|&nbsp;<b>${$.i18n.prop('browse.artifact.scope')}:</b>&nbsp;${row.scope}
{{/if}}
</td>
</tr>
{{/each}}
{{if row.scope}}
|&nbsp;<b>${$.i18n.prop('browse.artifact.scope')}:</b>&nbsp;${row.scope}
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</script>
@ -771,8 +775,10 @@
</script>
<script id="dependees_tmpl" type="text/html">
fooo
<ul>
{{each(i,artifact) artifacts}}
{{each(i, artifact) itemsOnCurrentPage()}}
<li>
{{var entries=artifact.crumbEntries()}}
{{each(j,crumbEntry) entries}}