Show mail status per domain in overview

This commit is contained in:
Johannes Zellner
2020-02-12 14:10:21 +01:00
parent 135548a03b
commit fa630a6cb5
2 changed files with 20 additions and 1 deletions

View File

@@ -20,12 +20,17 @@
<table class="table table-hover" style="margin: 0;">
<thead>
<tr>
<th style="width: 90%">Domain</th>
<th style="width: 5%"></th>
<th style="width: 85%">Domain</th>
<th style="width: 10%">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="domain in domains">
<td>
<i class="fa fa-circle" ng-style="{ color: domain.statusOk ? '#27CE65' : '#d9534f' }" ng-show="domain.status"></i>
<i class="fa fa-circle-notch fa-spin" ng-hide="domain.status"></i>
</td>
<td class="elide-table-cell no-padding">
<a href="/#/email/{{ domain.domain }}" class="email-domain-list-item">{{ domain.domain }}</a>
</td>

View File

@@ -34,6 +34,19 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
}
};
function refreshDomainStatuses() {
$scope.domains.forEach(function (domain) {
Client.getMailStatusForDomain(domain.domain, function (error, result) {
if (error) return console.error('Failed to fetch mail status for domain', domain.domain, error);
domain.status = result;
domain.statusOk = result.rbl.status && result.relay.status && result.dns.dkim.status && result.dns.dmarc.status && result.dns.mx.status && result.dns.ptr.status && result.dns.spf.status;
console.log(domain)
});
});
}
Client.onReady(function () {
Client.getDomains(function (error, domains) {
if (error) return console.error('Unable to get domain listing.', error);
@@ -42,6 +55,7 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
$scope.ready = true;
$scope.activity.fetchEventLogs();
refreshDomainStatuses();
});
});