diff --git a/src/js/client.js b/src/js/client.js index 8b22ef8f9..504c5a895 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1948,6 +1948,21 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }; // Email + Client.prototype.getMailEventLogs = function (page, perPage, callback) { + var config = { + params: { + page: page, + per_page: perPage + } + }; + + get('/api/v1/mailserver/eventlog', config, function (error, data, status) { + if (error) return callback(error); + if (status !== 200) return callback(new ClientError(status, data)); + callback(null, data.eventlogs); + }); + }; + Client.prototype.getMailConfigForDomain = function (domain, callback) { get('/api/v1/mail/' + domain, null, function (error, data, status) { if (error) return callback(error); diff --git a/src/views/emails.html b/src/views/emails.html index 039725674..f15d7f6e6 100644 --- a/src/views/emails.html +++ b/src/views/emails.html @@ -1,10 +1,14 @@

- Email + Mail Server

+
+

Domains

+
+
@@ -13,7 +17,6 @@
-

Select a Domain to configure mailboxes and how mails are sent.

@@ -32,8 +35,6 @@
-
- Show Logs
@@ -41,7 +42,7 @@
-

Black/White Listing

+

Event Log

@@ -52,27 +53,32 @@
- TBD + + + + + + + + + + + + + + + + + + + +
TimeTypeDetails
{{ eventlog.ts }}{{ eventlog.type }}
{{ eventlog.raw.data | json }}
+ +
+ Show Logs +
-
- -
-

Mail Log

-
- -
-
-
-

-
-
-
-
- TBD -
-
-
diff --git a/src/views/emails.js b/src/views/emails.js index eb4342205..81b184a95 100644 --- a/src/views/emails.js +++ b/src/views/emails.js @@ -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(); }); });