Skip to content

Commit

Permalink
Add a confirmation modal for disabling users
Browse files Browse the repository at this point in the history
Add a confirmation modal in the user management table when users
are disabled.

Change-Id: I06bb1c96abdc7fa895aec2fe2025e9039577ae1d
Signed-off-by: Farah Rasheed <[email protected]>
  • Loading branch information
FarahRasheed1 committed Aug 14, 2024
1 parent 6de0341 commit b2acbca
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,15 @@
"accountPolicySettings": "Account policy settings",
"addUser": "Add user",
"deleteUser": "Delete user | Delete users",
"disableUser": "Disable user | Disable users",
"editUser": "Edit user",
"viewPrivilegeRoleDescriptions": "View privilege role descriptions",
"modal": {
"accountLocked": "Account locked",
"accountStatus": "Account status",
"automaticAfterTimeout": "Automatic after timeout",
"batchDeleteConfirmMessage": "Are you sure you want to delete %{count} user? This action cannot be undone. | Are you sure you want to delete %{count} users? This action cannot be undone.",
"batchDisableConfirmMessage": "Are you sure you want to disable %{count} user? | Are you sure you want to disable %{count} users?",
"cannotStartWithANumber": "Cannot start with a number",
"clickSaveToUnlockAccount": "Click \"Save\" to unlock account",
"confirmUserPassword": "Confirm user password",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,15 @@
"accountPolicySettings": "Настройки политики учётной записи",
"addUser": "Добавить пользователя",
"deleteUser": "Удалить пользователя | Удалить пользователей",
"disableUser": "Отключить пользователя | Отключить пользователей",
"editUser": "Редактировать пользователя",
"viewPrivilegeRoleDescriptions": "Просмотр описаний привилегий ролей",
"modal": {
"accountLocked": "Учётная запись заблокирована",
"accountStatus": "Статус учётной записи",
"automaticAfterTimeout": "Автоматически после истечения таймаута",
"batchDeleteConfirmMessage": "Вы уверены, что хотите удалить %{count} пользователя? Это действие нельзя отменить. | Вы уверены, что хотите удалить %{count} пользователей? Это действие нельзя отменить.",
"batchDisableConfirmMessage": "Вы уверены, что хотите отключить пользователя %{count}? | Вы уверены, что хотите отключить пользователей %{count}?",
"cannotStartWithANumber": "Не может начинаться с цифры",
"clickSaveToUnlockAccount": "Нажмите \"Сохранить\" для разблокировки учётной записи",
"confirmUserPassword": "Подтвердите пароль пользователя",
Expand Down
43 changes: 33 additions & 10 deletions src/views/SecurityAndAccess/UserManagement/UserManagement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,39 @@ export default {
.finally(() => this.endLoader());
break;
case 'disable':
this.startLoader();
this.$store
.dispatch('userManagement/disableUsers', this.selectedRows)
.then((messages) => {
messages.forEach(({ type, message }) => {
if (type === 'success') this.successToast(message);
if (type === 'error') this.errorToast(message);
});
})
.finally(() => this.endLoader());
this.$bvModal
.msgBoxConfirm(
this.$tc(
'pageUserManagement.modal.batchDisableConfirmMessage',
this.selectedRows.length,
),
{
title: this.$tc(
'pageUserManagement.disableUser',
this.selectedRows.length,
),
okTitle: this.$tc(
'pageUserManagement.disableUser',
this.selectedRows.length,
),
cancelTitle: this.$t('global.action.cancel'),
autoFocusButton: 'ok',
},
)
.then((disableConfirmed) => {
if (disableConfirmed) {
this.startLoader();
this.$store
.dispatch('userManagement/disableUsers', this.selectedRows)
.then((messages) => {
messages.forEach(({ type, message }) => {
if (type === 'success') this.successToast(message);
if (type === 'error') this.errorToast(message);
});
})
.finally(() => this.endLoader());
}
});
break;
}
},
Expand Down

0 comments on commit b2acbca

Please sign in to comment.