[MRM-862] Paginate Dependencies Page.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1399507 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-18 03:16:53 +00:00
parent 6b221f10bc
commit 86f58f2457
3 changed files with 53 additions and 35 deletions

View File

@ -340,6 +340,18 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
dataType: 'json',
success: function(data) {
self.projectVersionMetadata=mapProjectVersionMetadata(data);
//pagination for dependencies
self.projectVersionMetadata.dependencies=ko.observableArray(self.projectVersionMetadata.dependencies?self.projectVersionMetadata.dependencies:[]);
self.gridViewModel = new ko.simpleGrid.viewModel({
data: self.projectVersionMetadata.dependencies(),
columns: [],
pageSize: 7,
gridUpdateCallBack: function(){
// nope
}
});
ko.applyBindings(self,mainContent.find("#browse_artifact_detail" ).get(0));
ko.applyBindings(self,mainContent.find("#browse_breadcrumb" ).get(0));
mainContent.find("#browse-autocomplete" ).hide();

View File

@ -43,6 +43,7 @@
};
this.gridUpdateCallBack = configuration.gridUpdateCallBack;
this.pageLinksUpdateCallBack = configuration.pageLinksUpdateCallBack;
}
};

View File

@ -626,41 +626,10 @@
<div id="artifact-details-dependencies-content" class="tab-pane">
<table class="table">
<tbody>
{{if projectVersionMetadata.dependencies && projectVersionMetadata.dependencies.length>0}}
{{each(i,dependency) projectVersionMetadata.dependencies}}
<tr>
<th>${dependency.artifactId}</th>
</tr>
<tr>
<td>
{{var entries=dependency.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)}">${dependency.version}</a>&nbsp;
{{/if}}
{{if j < entries.length - 2}}
&nbsp;/&nbsp;
{{/if}}
{{/each}}
{{if dependency.scope}}
|&nbsp;<b>${$.i18n.prop('browse.artifact.scope')}:</b>&nbsp;${dependency.scope}
{{/if}}
</td>
</tr>
{{/each}}
{{else}}
${$.i18n.prop('browse.artifact.dependencies.none')}
{{/if}}
</tbody>
</table>
<table class="table table-striped table-bordered" id="artifact-dependencies-table"
data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko_dependenciesGrid',pageLinksId:'dependenciesPagination',data:'dependencies'">
</table>
<div id="dependenciesPagination"></div>
</div>
<div id="artifact-details-dependency-tree-content" class="tab-pane"></div>
@ -737,6 +706,42 @@
</div>
</div>
</div>
</script>
<script id="ko_dependenciesGrid" type="text/html">
<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}}
{{if row.scope}}
|&nbsp;<b>${$.i18n.prop('browse.artifact.scope')}:</b>&nbsp;${row.scope}
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</script>
<script id="dependency_tree_tmpl" type="text/html">