AMBARI-20421. Users->admin page: Failure in Updating admin settings is not shown (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9b52ce58 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9b52ce58 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9b52ce58 Branch: refs/heads/branch-feature-AMBARI-12556 Commit: 9b52ce58270eeda1021bf515a91898ade1920477 Parents: db3c09b Author: Alex Antonenko <hiv...@gmail.com> Authored: Mon Mar 13 17:07:37 2017 +0200 Committer: Alex Antonenko <hiv...@gmail.com> Committed: Mon Mar 13 18:56:31 2017 +0200 ---------------------------------------------------------------------- .../app/scripts/controllers/users/UsersShowCtrl.js | 10 +++++++++- .../resources/ui/admin-web/app/scripts/i18n.config.js | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9b52ce58/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js index 3839876..dcb7418 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/users/UsersShowCtrl.js @@ -146,7 +146,11 @@ angular.module('ambariAdminConsole') status: newStatus }) ).then(function() { - User.setActive($scope.user.user_name, $scope.user.active); + User.setActive($scope.user.user_name, $scope.user.active) + .catch(function(data) { + Alert.error($t('common.alerts.cannotUpdateStatus'), data.data.message); + $scope.user.active = !$scope.user.active; + }); }) .catch(function() { $scope.user.active = !$scope.user.active; @@ -166,6 +170,10 @@ angular.module('ambariAdminConsole') User.setAdmin($scope.user.user_name, $scope.user.admin) .then(function() { loadPrivileges(); + }) + .catch(function (data) { + Alert.error($t('common.alerts.cannotUpdateAdminStatus'), data.data.message); + $scope.user.admin = !$scope.user.admin; }); }) .catch(function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/9b52ce58/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js index c30f134..61420c0 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js @@ -158,7 +158,9 @@ angular.module('ambariAdminConsole') 'onlyText': 'Only lowercase alphanumeric characters are allowed.', 'onlyAnScore': 'Invalid input, only alphanumerics allowed eg: My_default_view', 'passwordRequired':'Password Required', - 'unsavedChanges': 'You have unsaved changes. Save changes or discard?' + 'unsavedChanges': 'You have unsaved changes. Save changes or discard?', + 'cannotUpdateStatus': 'Cannot update User status', + 'cannotUpdateAdminStatus': 'Cannot update User Admin status' } },