From 331dd2b429b718552dc2ee90ea5285cbaeeaf248 Mon Sep 17 00:00:00 2001 From: Misha Bragin Date: Fri, 19 May 2023 12:40:08 +0200 Subject: [PATCH] Make it more visible that user can be blocked (#184) --- src/components/UserEdit.tsx | 8 +++----- src/views/RegularUsers.tsx | 16 +++++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/UserEdit.tsx b/src/components/UserEdit.tsx index f5c4b3a9..b19818e9 100644 --- a/src/components/UserEdit.tsx +++ b/src/components/UserEdit.tsx @@ -89,7 +89,7 @@ const UserEdit = () => { groupsToCreate: groupsToCreate, auto_groups: autoGroups, is_service_user: isServiceUser, - is_blocked: !values.is_active + is_blocked: values.is_blocked } as UserToSave } @@ -286,7 +286,6 @@ const UserEdit = () => { role: user.role, email: user.email, is_blocked: user.is_blocked, - is_active: !user.is_blocked, autoGroupsNames: currentGroups, }) } @@ -328,7 +327,6 @@ const UserEdit = () => { role: formUser.role, email: formUser.email, is_blocked: formUser.is_blocked, - is_active: !formUser.is_blocked, autoGroupsNames: formUser.autoGroupsNames, }} > @@ -391,8 +389,8 @@ const UserEdit = () => { diff --git a/src/views/RegularUsers.tsx b/src/views/RegularUsers.tsx index 3c31f62a..4eb0b846 100644 --- a/src/views/RegularUsers.tsx +++ b/src/views/RegularUsers.tsx @@ -268,10 +268,10 @@ export const RegularUsers = () => { if (block) { confirmModal.confirm({ icon: , - title: "Are you sure you want to deactivate \"" + user.name + "\"?", + title: "Are you sure you want to block " + user.name + "?", width: 600, content: - Disabling this user will disconnect their devices and block dashboard access. + Blocking this user will disconnect their devices and disable dashboard access. , onOk() { let userToSave = createUserToSave(user, block) @@ -380,6 +380,12 @@ export const RegularUsers = () => { } + if ((record as User).status === "blocked") { + return
{btn} + blocked +
+ } + return btn }} /> @@ -395,12 +401,12 @@ export const RegularUsers = () => { onFilter={(value: string | number | boolean, record) => (record as any).role.includes(value)} sorter={(a, b) => ((a as any).role.localeCompare((b as any).role))}/> {isAdmin && ( - { - let witch = { - handleBlockUser(!active, record) + handleBlockUser(active, record) }} />