Fixup route for setting max email size

This commit is contained in:
Girish Ramakrishnan
2020-08-20 22:07:20 -07:00
parent 4a1f8457cf
commit f6fef21bf7
3 changed files with 42 additions and 6 deletions
+4 -2
View File
@@ -44,7 +44,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success" ng-click="mailDomainChange.submit()" ng-disabled="maxEmailSize.size === maxEmailSize.currentSize"><i class="fa fa-circle-notch fa-spin" ng-show="mailDomainChange.busy"></i> Change</button>
<button type="button" class="btn btn-success" ng-click="maxEmailSize.submit()" ng-disabled="maxEmailSize.size === maxEmailSize.currentSize"><i class="fa fa-circle-notch fa-spin" ng-show="maxEmailSize.busy"></i> Change</button>
</div>
</div>
</div>
@@ -188,7 +188,7 @@
<span class="text-muted">Maximum email size</span>
</div>
<div class="col-xs-6 text-right">
<span>25MB <a href="" ng-click="maxEmailSize.show()"><i class="fa fa-edit text-small"></i></a></span>
<span>{{ maxEmailSize.currentSize | prettyDiskSize }} <a href="" ng-click="maxEmailSize.show()"><i class="fa fa-edit text-small"></i></a></span>
</div>
<div class="col-xs-6">
<span class="text-muted">Always allowed origins</span>
@@ -277,6 +277,7 @@
<i class="fas fa-minus-circle" ng-show="eventlog.type === 'denied'" uib-tooltip="Denied"></i>
<i class="fas fa-hand-paper" ng-show="eventlog.type === 'bounce'" uib-tooltip="Bounce"></i>
<i class="fas fa-filter" ng-show="eventlog.type === 'spam-learn'" uib-tooltip="Spam filter trained"></i>
<i class="fas fa-cog" ng-show="eventlog.type === 'max-email-size'" uib-tooltip="Settings changed"></i>
</td>
<td class="no-wrap"><span uib-tooltip="{{ eventlog.ts | prettyLongDate }}" class="arrow">{{ eventlog.ts | prettyDate }}</span></td>
<td>
@@ -295,6 +296,7 @@
<span ng-show="eventlog.type === 'denied'">Connection from {{ eventlog.remote.ip }} denied. {{ eventlog.details.message || eventlog.details.reason }}</span>
<span ng-show="eventlog.type === 'spam-learn'">Spam filter trained using mailbox content</span>
<span ng-show="eventlog.type === 'max-email-size'">Maximum email size was set to {{ eventlog.size | prettyDiskSize }} </span>
</td>
</tr>
<tr ng-show="activity.activeEventLog === eventlog">
+18 -3
View File
@@ -102,8 +102,7 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
show: function() {
$scope.maxEmailSize.busy = false;
$scope.maxEmailSize.error = null;
$scope.maxEmailSize.size = 25 * 1024 * 1024;
$scope.maxEmailSize.currentSize = 25 * 1024 * 1024;
$scope.maxEmailSize.size = $scope.maxEmailSize.currentSize;
$scope.maxEmailSizeChangeForm.$setUntouched();
$scope.maxEmailSizeChangeForm.$setPristine();
@@ -112,7 +111,18 @@ angular.module('Application').controller('EmailsController', ['$scope', '$locati
},
submit: function () {
console.log('tbd');
$scope.maxEmailSize.busy = true;
Client.setMaxEmailSize($scope.maxEmailSize.size, function (error) {
$scope.maxEmailSize.busy = false;
if (error) return console.error(error);
$scope.maxEmailSize.currentSize = $scope.maxEmailSize.size;
$('#maxEmailSizeChangeModal').modal('hide');
});
}
};
@@ -217,6 +227,11 @@ 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;
});
});
}