mail from validation: add busy indicator
This commit is contained in:
@@ -520,7 +520,10 @@
|
||||
Masquerading allows users and apps to send emails with an arbitrary username in the FROM address
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button ng-class="domain.mailConfig.mailFromValidation ? 'btn btn-danger' : 'btn btn-primary'" ng-click="toggleMailFromValidation()">{{ domain.mailConfig.mailFromValidation ? "Enable" : "Disable" }}</button>
|
||||
<button ng-class="domain.mailConfig.mailFromValidation ? 'btn btn-danger' : 'btn btn-primary'" ng-disabled="mailFromValidation.busy" ng-click="mailFromValidation.submit()">
|
||||
<i class="fa fa-circle-notch fa-spin" ng-show="mailFromValidation.busy"></i>
|
||||
{{ domain.mailConfig.mailFromValidation ? "Enable" : "Disable" }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -184,11 +184,25 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleMailFromValidation = function () {
|
||||
Client.setMailFromValidation($scope.domain.domain, !$scope.domain.mailConfig.mailFromValidation, function (error) {
|
||||
if (error) return console.error(error);
|
||||
$scope.refreshDomain();
|
||||
});
|
||||
$scope.mailFromValidation = {
|
||||
busy: false,
|
||||
|
||||
submit: function () {
|
||||
$scope.mailFromValidation.busy = true;
|
||||
|
||||
Client.setMailFromValidation($scope.domain.domain, !$scope.domain.mailConfig.mailFromValidation, function (error) {
|
||||
if (error) {
|
||||
$scope.mailFromValidation.busy = false;
|
||||
return console.error(error);
|
||||
}
|
||||
|
||||
// give sometime for the mail container to restart
|
||||
$timeout(function () {
|
||||
$scope.mailFromValidation.busy = false;
|
||||
$scope.refreshDomain();
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.incomingEmail = {
|
||||
|
||||
Reference in New Issue
Block a user