Give feedback if the relay settings have successfully saved

This commit is contained in:
Johannes Zellner
2017-08-30 11:02:13 +02:00
parent 257e594de0
commit e4760a07f0
2 changed files with 7 additions and 6 deletions

View File

@@ -135,11 +135,11 @@
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="col-md-12">
<button class="btn btn-primary" ng-click="mailRelay.submit()" ng-disabled="(mailRelay.preset.provider !== 'cloudron-smtp' && (!mailRelayForm.$dirty || mailRelayForm.$invalid)) || mailRelay.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="mailRelay.busy"></i> Save</button>
</div>
<div class="col-md-10">
<span class="has-error text-center" ng-show="mailRelay.error">{{ mailRelay.error }}</span>
<span class="text-success text-center text-bold" ng-show="mailRelay.success">Saved</span>
</div>
</div>
</div>

View File

@@ -100,6 +100,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
$scope.mailRelay = {
error: null,
success: false,
busy: false,
preset: $scope.mailRelayPresets[0],
@@ -127,6 +128,7 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
submit: function () {
$scope.mailRelay.error = null;
$scope.mailRelay.busy = true;
$scope.mailRelay.success = false;
var data = {
provider: $scope.mailRelay.relay.provider,
@@ -144,9 +146,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
}
Client.setMailRelay(data, function (error) {
if (error) {
$scope.mailRelay.error = error.message;
}
if (error) $scope.mailRelay.error = error.message;
else $scope.mailRelay.success = true;
$scope.mailRelay.busy = false;
});