mail: add banner ui

part of cloudron/box#341
This commit is contained in:
Girish Ramakrishnan
2020-08-24 10:16:11 -07:00
parent ae24c1d968
commit 566f0f7783
3 changed files with 84 additions and 11 deletions
+37 -11
View File
@@ -238,6 +238,29 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
}
};
$scope.banner = {
busy: false,
text: '',
html: '',
submit: function () {
$scope.banner.busy = true;
Client.setMailBanner($scope.domain.domain, { text: $scope.banner.text, html: $scope.banner.html }, function (error) {
if (error) {
$scope.banner.busy = false;
return console.error(error);
}
// give sometime for the mail container to restart
$timeout(function () {
$scope.banner.busy = false;
$scope.refreshDomain();
}, 5000);
});
}
};
$scope.incomingEmail = {
busy: false,
setupDns: true,
@@ -525,6 +548,17 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
busy: false,
preset: $scope.mailRelayPresets[0],
// form data to be set on load
relay: {
provider: 'cloudron-smtp',
host: '',
port: 25,
username: '',
password: '',
serverApiToken: '',
acceptSelfSignedCerts: false
},
presetChanged: function () {
$scope.mailRelay.error = null;
@@ -537,17 +571,6 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
$scope.mailRelay.relay.acceptSelfSignedCerts = false;
},
// form data to be set on load
relay: {
provider: 'cloudron-smtp',
host: '',
port: 25,
username: '',
password: '',
serverApiToken: '',
acceptSelfSignedCerts: false
},
submit: function () {
$scope.mailRelay.error = null;
$scope.mailRelay.busy = true;
@@ -685,6 +708,9 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
}
}
$scope.banner.text = mailConfig.banner.text || '';
$scope.banner.html = mailConfig.banner.html || '';
// amend to selected domain to be available for the UI
$scope.domain.mailConfig = mailConfig;
$scope.domain.mailStatus = {};