Add refresh button to retest mail config

This commit is contained in:
Johannes Zellner
2016-12-14 15:41:19 +01:00
parent 66a4abeb50
commit ea4c16604b
2 changed files with 22 additions and 3 deletions

View File

@@ -294,7 +294,10 @@
<div ng-repeat="record in expectedDnsRecordsTypes">
<div class="row">
<div class="col-xs-12">
<h4 class="text-muted">{{ record.name }} record <i ng-class="expectedDnsRecords[record.value].status ? 'fa fa-check-circle text-success' : 'fa fa-exclamation-triangle text-danger'" aria-hidden="true"></i></h4>
<h4 class="text-muted">
{{ record.name }} record <i ng-class="expectedDnsRecords[record.value].status ? 'fa fa-check-circle text-success' : 'fa fa-exclamation-triangle text-danger'" aria-hidden="true"></i>
<button class="btn btn-xs btn-default" ng-click="email.refresh()" ng-disabled="email.refreshBusy" ng-show="!expectedDnsRecords[record.value].status"><i class="fa fa-refresh" ng-class="{ 'fa-pulse': email.refreshBusy }"></i></button>
</h4>
<a href="" data-toggle="collapse" data-parent="#accordion" data-target="#collapse_dns_{{ record.value }}">Advanced</a>
<div id="collapse_dns_{{ record.value }}" class="panel-collapse collapse">
<div class="panel-body">

View File

@@ -271,6 +271,8 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
};
$scope.email = {
refreshBusy: false,
toggle: function () {
if ($scope.mailConfig.enabled) return $scope.email.disable();
@@ -294,6 +296,16 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
$scope.mailConfig.enabled = false;
});
},
refresh: function () {
$scope.email.refreshBusy = true;
getExpectedDnsRecords(function (error) {
if (error) console.error(error);
$scope.email.refreshBusy = false;
});
}
};
@@ -428,11 +440,15 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
});
}
function getExpectedDnsRecords() {
function getExpectedDnsRecords(callback) {
callback = callback || function (error) { if (error) console.error(error); };
Client.getExpectedDnsRecords(function (error, dnsRecords) {
if (error) return console.error(error);
if (error) return callback(error);
$scope.expectedDnsRecords = dnsRecords;
callback(null);
});
}