From 8fff672d2f0abee5d56ab72ad3818d0111235cb0 Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Fri, 19 Oct 2018 16:10:39 +0200 Subject: [PATCH] Closes #244: feedback when saving inbox scanning configuration --- .../app/docs/controller/settings/SettingsInbox.js | 13 +++++++++++-- docs-web/src/main/webapp/src/locale/en.json | 3 ++- .../webapp/src/partial/docs/settings.inbox.html | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsInbox.js b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsInbox.js index 7d3a6b54..da9404a0 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsInbox.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/settings/SettingsInbox.js @@ -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); }); }); }; diff --git a/docs-web/src/main/webapp/src/locale/en.json b/docs-web/src/main/webapp/src/locale/en.json index e23b5b89..7d83ef1d 100644 --- a/docs-web/src/main/webapp/src/locale/en.json +++ b/docs-web/src/main/webapp/src/locale/en.json @@ -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 }} unread 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", diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html b/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html index e63175a9..4cb4c109 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.inbox.html @@ -71,6 +71,11 @@ +
+ {{ saveResult }} +
+