mail: add js code to get eventlog

This commit is contained in:
Girish Ramakrishnan
2020-02-11 22:07:58 -08:00
parent 304c930f95
commit 135548a03b
3 changed files with 71 additions and 24 deletions

View File

@@ -10,12 +10,38 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
$scope.config = Client.getConfig();
$scope.domains = [];
$scope.activity = {
eventlogs: [],
currentPage: 1,
perPage: 20,
fetchEventLogs: function () {
Client.getMailEventLogs($scope.activity.currentPage, $scope.activity.perPage, function (error, result) {
if (error) return console.error(error);
$scope.activity.eventlogs = result;
});
},
showNextPage: function () {
$scope.activity.currentPage++;
$scope.activity.fetchEventLogs();
},
showPrevPage: function () {
if ($scope.activity.currentPage > 1) $scope.activity.currentPage--;
else $scope.activity.currentPage = 1;
$scope.activity.fetchEventLogs();
}
};
Client.onReady(function () {
Client.getDomains(function (error, domains) {
if (error) return console.error('Unable to get domain listing.', error);
$scope.domains = domains;
$scope.ready = true;
$scope.activity.fetchEventLogs();
});
});