fix pagination

pull/4159/head
Jens Ulferts 9 years ago
parent 003eae5bbb
commit bcf402e9a5
  1. 10
      frontend/app/components/routing/wp-list/wp-list.controller.ts

@ -104,7 +104,7 @@ function WorkPackagesListController($scope,
apiWorkPackages
.list(json.meta.page, json.meta.per_page, json.meta.query)
.then((workPackageCollection) => {
mergeApiResponses(json, workPackageCollection.getElements());
mergeApiResponses(json, workPackageCollection);
setupPage(json, !!queryParams);
QueryService.loadAvailableUnusedColumns($scope.projectIdentifier).then(function(data){
@ -235,20 +235,24 @@ function WorkPackagesListController($scope,
.list(json.meta.page, json.meta.per_page, json.meta.query)
.then((workPackageCollection) => {
// Copy V3 group/sum response into experimental format
mergeApiResponses(json, workPackageCollection.getElements());
mergeApiResponses(json, workPackageCollection);
setupWorkPackagesTable(json);
});
});
}
function mergeApiResponses(exJson, workPackages) {
exJson.work_packages = workPackages;
exJson.work_packages = workPackages.elements;
if (workPackages.totalSums) {
exJson.meta.sums = exJson.meta.columns.map(column => workPackages.totalSums[column.name]);
} else {
exJson.meta.sums = new Array(exJson.meta.columns.length);
}
// TODO: no longer use detour over $source once the properties are available
// directly on the CollectionResource
exJson.meta.total_entries = workPackages.$source.total;
}
// Go

Loading…
Cancel
Save