diff --git a/webapps/frontend/ui/admin/client/scripts/pages/generic-confirmation.html b/webapps/frontend/ui/admin/client/scripts/pages/generic-confirmation.html index 0e9e93e7d72..62b4d9bc76b 100644 --- a/webapps/frontend/ui/admin/client/scripts/pages/generic-confirmation.html +++ b/webapps/frontend/ui/admin/client/scripts/pages/generic-confirmation.html @@ -12,7 +12,7 @@
+ ng-click="delete()">{{ 'GENERIC_CONFIRMATION_PROCEED' | translate }}
diff --git a/webapps/frontend/ui/admin/client/scripts/pages/groupEdit.js b/webapps/frontend/ui/admin/client/scripts/pages/groupEdit.js index 978dd67ff87..3c4af7a3af4 100644 --- a/webapps/frontend/ui/admin/client/scripts/pages/groupEdit.js +++ b/webapps/frontend/ui/admin/client/scripts/pages/groupEdit.js @@ -323,40 +323,51 @@ var Controller = [ template: confirmationTemplate, controller: [ '$scope', - function($dialogScope) { + '$timeout', + function($dialogScope, $timeout) { $dialogScope.question = $translate.instant( 'GROUP_EDIT_DELETE_CONFIRM', {group: $scope.group.id} ); + $dialogScope.delete = () => { + GroupResource.delete({id: $scope.decodedGroupId}, function( + err + ) { + if (err === null) { + $timeout(() => { + Notifications.addMessage({ + type: 'success', + status: $translate.instant( + 'NOTIFICATIONS_STATUS_SUCCESS' + ), + message: $translate.instant( + 'GROUP_EDIT_DELETE_SUCCESS', + { + group: $scope.group.id + } + ) + }); + }, 200); + $location.path('/groups'); + $dialogScope.$close(); + } else { + const { + response: { + body: {message} + } + } = err; + Notifications.addError({ + status: $translate.instant('NOTIFICATIONS_STATUS_FAILED'), + message: $translate.instant('GROUP_EDIT_DELETE_FAILED', { + message + }) + }); + } + }); + }; } ] }) - .result.then(function() { - GroupResource.delete({id: $scope.decodedGroupId}, function(err) { - if (err === null) { - Notifications.addMessage({ - type: 'success', - status: $translate.instant('NOTIFICATIONS_STATUS_SUCCESS'), - message: $translate.instant('GROUP_EDIT_DELETE_SUCCESS', { - group: $scope.group.id - }) - }); - $location.path('/groups'); - } else { - const { - response: { - body: {message} - } - } = err; - Notifications.addError({ - status: $translate.instant('NOTIFICATIONS_STATUS_FAILED'), - message: $translate.instant('GROUP_EDIT_DELETE_FAILED', { - message - }) - }); - } - }); - }) .catch(angular.noop); }; diff --git a/webapps/frontend/ui/admin/client/scripts/pages/tenantEdit.js b/webapps/frontend/ui/admin/client/scripts/pages/tenantEdit.js index 9fd3d43ea84..4c2be3639ad 100644 --- a/webapps/frontend/ui/admin/client/scripts/pages/tenantEdit.js +++ b/webapps/frontend/ui/admin/client/scripts/pages/tenantEdit.js @@ -63,6 +63,7 @@ var Controller = [ } ]); } + refreshBreadcrumbs(); $scope.tenant = null; @@ -219,6 +220,7 @@ var Controller = [ } $scope.canSortUserEntries = true; + function updateTenantUserView() { var prep = prepareTenantMemberView(tenantUserPages); @@ -291,47 +293,59 @@ var Controller = [ // delete group form ///////////////////////////// $scope.deleteTenant = function() { - $modal - .open({ - template: confirmationTemplate, - controller: [ - '$scope', - function($dialogScope) { - $dialogScope.question = $translate.instant( - 'TENANTS_TENANT_DELETE_CONFIRM', - {tenant: $scope.tenant.id} - ); - } - ] - }) - .result.then(function() { - TenantResource.delete({id: $scope.decodedTenantId}, function(err) { - if (err === null) { - Notifications.addMessage({ - type: 'success', - status: $translate.instant('NOTIFICATIONS_STATUS_SUCCESS'), - message: $translate.instant('TENANTS_TENANT_DELETE_SUCCESS', { - tenant: $scope.tenant.id - }) - }); - $location.path('/tenants'); - } else { - const { - response: { - body: {message} + $modal.open({ + template: confirmationTemplate, + controller: [ + '$scope', + '$timeout', + function($dialogScope, $timeout) { + $dialogScope.question = $translate.instant( + 'TENANTS_TENANT_DELETE_CONFIRM', + {tenant: $scope.tenant.id} + ); + $dialogScope.delete = () => { + TenantResource.delete({id: $scope.decodedTenantId}, function( + err + ) { + if (err === null) { + $timeout(() => { + Notifications.addMessage({ + type: 'success', + status: $translate.instant( + 'NOTIFICATIONS_STATUS_SUCCESS' + ), + message: $translate.instant( + 'TENANTS_TENANT_DELETE_SUCCESS', + { + tenant: $scope.tenant.id + } + ) + }); + }, 200); + $location.path('/tenants'); + $dialogScope.$close(); + } else { + const { + response: { + body: {message} + } + } = err; + Notifications.addError({ + status: $translate.instant('NOTIFICATIONS_STATUS_FAILED'), + message: $translate.instant( + 'TENANTS_TENANT_DELETE_FAILED', + { + tenant: $scope.tenant.id, + message + } + ) + }); } - } = err; - Notifications.addError({ - status: $translate.instant('NOTIFICATIONS_STATUS_FAILED'), - message: $translate.instant('TENANTS_TENANT_DELETE_FAILED', { - tenant: $scope.tenant.id, - message - }) }); - } - }); - }) - .catch(angular.noop); + }; + } + ] + }); }; // page controls //////////////////////////////////// diff --git a/webapps/frontend/ui/admin/client/scripts/pages/userEdit.js b/webapps/frontend/ui/admin/client/scripts/pages/userEdit.js index d5b76133935..e5f2be7d7fa 100644 --- a/webapps/frontend/ui/admin/client/scripts/pages/userEdit.js +++ b/webapps/frontend/ui/admin/client/scripts/pages/userEdit.js @@ -256,75 +256,82 @@ module.exports = [ // delete user form ///////////////////////////// $scope.deleteUser = function() { - $modal - .open({ - template: confirmationTemplate, - controller: [ - '$scope', - '$timeout', - function($dialogScope, $timeout) { - $dialogScope.question = $translate.instant( - 'USERS_USER_DELETE_CONFIRM', - {user: $scope.user.id} - ); - $timeout(() => - Notifications.addMessage({ - type: 'info', - status: 'Warning', - unsafe: true, - message: $translate.instant('USERS_USER_DELETE_INFO') - }) - ); - } - ] - }) - .result.then(function() { - UserResource.delete({id: $scope.decodedUserId}, function(err) { - if (err === null) { - if ($scope.authenticatedUser.name !== $scope.user.id) { - Notifications.addMessage({ - type: 'success', - status: $translate.instant( - 'NOTIFICATIONS_STATUS_SUCCESS' - ), - message: $translate.instant( - 'USERS_USER_DELETE_SUCCESS', - { - user: $scope.user.id + $modal.open({ + template: confirmationTemplate, + controller: [ + '$scope', + '$timeout', + function($dialogScope, $timeout) { + $dialogScope.question = $translate.instant( + 'USERS_USER_DELETE_CONFIRM', + {user: $scope.user.id} + ); + $dialogScope.delete = () => { + UserResource.delete({id: $scope.decodedUserId}, function( + err + ) { + if (err === null) { + if ($scope.authenticatedUser.name !== $scope.user.id) { + $timeout(() => { + Notifications.addMessage({ + type: 'success', + status: $translate.instant( + 'NOTIFICATIONS_STATUS_SUCCESS' + ), + message: $translate.instant( + 'USERS_USER_DELETE_SUCCESS', + { + user: $scope.user.id + } + ) + }); + }, 200); + $location.path('/users'); + } else { + $http + .get(Uri.appUri('engine://engine/')) + .then(function(response) { + var engines = response.data; + + engines.forEach(function(engine) { + AuthenticationService.logout(engine.name); + }); + }) + .catch(angular.noop); + } + $dialogScope.$close(); + } else { + const { + response: { + body: {message} } - ) - }); - - $location.path('/users'); - } else { - $http - .get(Uri.appUri('engine://engine/')) - .then(function(response) { - var engines = response.data; - - engines.forEach(function(engine) { - AuthenticationService.logout(engine.name); - }); - }) - .catch(angular.noop); - } - } else { - const { - response: { - body: {message} + } = err; + Notifications.addError({ + status: $translate.instant( + 'NOTIFICATIONS_STATUS_ERROR' + ), + message: $translate.instant( + 'USERS_USER_DELETE_FAILED', + { + user: $scope.user.id, + message + } + ) + }); } - } = err; - Notifications.addError({ - status: $translate.instant('NOTIFICATIONS_STATUS_ERROR'), - message: $translate.instant('USERS_USER_DELETE_FAILED', { - user: $scope.user.id, - message - }) }); - } - }); - }) - .catch(angular.noop); + }; + $timeout(() => + Notifications.addMessage({ + type: 'info', + status: $translate.instant('USERS_WARNING'), + unsafe: true, + message: $translate.instant('USERS_USER_DELETE_INFO') + }) + ); + } + ] + }); }; // Unlock User