mail: Add pagination to lists UI

This commit is contained in:
Girish Ramakrishnan
2020-07-05 11:55:17 -07:00
parent a9a9af9ef7
commit f51eccdef7
3 changed files with 30 additions and 6 deletions

View File

@@ -63,6 +63,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
busy: false,
mailinglists: [],
search: '',
currentPage: 1,
perPage: 10,
add: {
busy: false,
@@ -179,13 +181,29 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
refresh: function (callback) {
callback = typeof callback === 'function' ? callback : function (error) { if (error) return console.error(error); };
Client.listMailingLists($scope.domain.domain, function (error, result) {
Client.listMailingLists($scope.domain.domain, $scope.mailinglists.search, $scope.mailinglists.currentPage, $scope.mailinglists.perPage, function (error, result) {
if (error) return callback(error);
$scope.mailinglists.mailinglists = result;
callback();
});
},
showNextPage: function () {
$scope.mailinglists.currentPage++;
$scope.mailinglists.refresh();
},
showPrevPage: function () {
if ($scope.mailinglists.currentPage > 1) $scope.mailinglists.currentPage--;
else $scope.mailinglists.currentPage = 1;
$scope.mailinglists.refresh();
},
updateFilter: function (fresh) {
if (fresh) $scope.mailinglists.currentPage = 1;
$scope.mailinglists.refresh();
}
};