mirror of
https://github.com/sismics/docs.git
synced 2024-11-25 15:17:57 +01:00
Closes #244: feedback when saving inbox scanning configuration
This commit is contained in:
parent
d4fe719a2c
commit
8fff672d2f
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Settings inbox page controller.
|
||||
*/
|
||||
angular.module('docs').controller('SettingsInbox', function($scope, $rootScope, Restangular) {
|
||||
angular.module('docs').controller('SettingsInbox', function($scope, $rootScope, Restangular, $translate, $timeout) {
|
||||
// Get the inbox configuration
|
||||
Restangular.one('app/config_inbox').get().then(function (data) {
|
||||
$scope.inbox = data;
|
||||
@ -15,8 +15,14 @@ angular.module('docs').controller('SettingsInbox', function($scope, $rootScope,
|
||||
});
|
||||
|
||||
// Save the inbox configuration
|
||||
$scope.saveResult = undefined;
|
||||
$scope.editInboxConfig = function () {
|
||||
return Restangular.one('app').post('config_inbox', $scope.inbox);
|
||||
return Restangular.one('app').post('config_inbox', $scope.inbox).then(function () {
|
||||
$scope.saveResult = $translate.instant('settings.inbox.saved');
|
||||
$timeout(function() {
|
||||
$scope.saveResult = undefined;
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.testInboxConfig = function () {
|
||||
@ -26,6 +32,9 @@ angular.module('docs').controller('SettingsInbox', function($scope, $rootScope,
|
||||
Restangular.one('app').post('test_inbox').then(function (data) {
|
||||
$scope.testResult = data;
|
||||
$scope.testLoading = false;
|
||||
$timeout(function() {
|
||||
$scope.testResult = undefined;
|
||||
}, 5000);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -397,7 +397,8 @@
|
||||
"test": "Test the parameters",
|
||||
"last_sync": "Last synchronization: {{ data.date | date: 'medium' }}, {{ data.count }} message{{ data.count > 1 ? 's' : '' }} imported",
|
||||
"test_success": "The connection to the inbox is successful ({{ count }} <strong>unread</strong> message{{ count > 1 ? 's' : '' }})",
|
||||
"test_fail": "An error occurred while connecting to the inbox, please check the parameters"
|
||||
"test_fail": "An error occurred while connecting to the inbox, please check the parameters",
|
||||
"saved": "IMAP configuration saved successfully"
|
||||
},
|
||||
"monitoring": {
|
||||
"background_tasks": "Background tasks",
|
||||
|
@ -71,6 +71,11 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="alert col-sm-9 alert-success"
|
||||
ng-show="saveResult">
|
||||
{{ saveResult }}
|
||||
</div>
|
||||
|
||||
<div class="alert col-sm-9"
|
||||
ng-class="{ 'alert-success': testResult.count >= 0, 'alert-danger': testResult.count == -1 }"
|
||||
ng-show="testResult"
|
||||
|
Loading…
Reference in New Issue
Block a user