Move the refresh functions

This commit is contained in:
Girish Ramakrishnan
2020-08-22 19:34:06 -07:00
parent 8ca344e3bf
commit ae24c1d968
2 changed files with 21 additions and 15 deletions
+19 -13
View File
@@ -79,6 +79,15 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
domain: null,
subdomain: '',
refresh: function () {
Client.getMailLocation(function (error, location) {
if (error) return console.error('Failed to get max email location', error);
$scope.mailLocation.currentLocation.subdomain = location.subdomain;
$scope.mailLocation.currentLocation.domain = $scope.domains.find(function (d) { return location.domain === d.domain; });
});
},
show: function () {
$scope.mailLocation.busy = false;
$scope.mailLocation.error = null;
@@ -118,6 +127,14 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
size: 0,
currentSize: 0,
refresh: function () {
Client.getMaxEmailSize(function (error, size) {
if (error) return console.error('Failed to get max email size', error);
$scope.maxEmailSize.currentSize = size;
});
},
show: function() {
$scope.maxEmailSize.busy = false;
$scope.maxEmailSize.error = null;
@@ -291,12 +308,7 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
});
});
Client.getMaxEmailSize(function (error, size) {
if (error) return console.error('Failed to get max email size', error);
$scope.maxEmailSize.currentSize = size;
});
$scope.maxEmailSize.refresh();
$scope.spamConfig.refresh();
});
}
@@ -310,13 +322,7 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
if ($scope.user.role === 'owner') $scope.activity.refresh();
Client.getMailLocation(function (error, location) {
if (error) return console.error('Failed to get max email location', error);
$scope.mailLocation.currentLocation.subdomain = location.subdomain;
$scope.mailLocation.currentLocation.domain = $scope.domains.find(function (d) { return location.domain === d.domain; });
});
$scope.mailLocation.refresh();
refreshDomainStatuses();
});
});