mirror of
https://github.com/netbirdio/dashboard.git
synced 2026-05-22 17:05:00 -07:00
Make it more visible that user can be blocked (#184)
This commit is contained in:
@@ -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 = () => {
|
||||
<Col xs={24} sm={24} md={5} lg={5} xl={5} xxl={5} span={5}>
|
||||
<Form.Item
|
||||
valuePropName="checked"
|
||||
name="is_active"
|
||||
label="Active"
|
||||
name="is_blocked"
|
||||
label="Block user"
|
||||
style={{marginRight: "50px"}}
|
||||
>
|
||||
<Switch/>
|
||||
|
||||
@@ -268,10 +268,10 @@ export const RegularUsers = () => {
|
||||
if (block) {
|
||||
confirmModal.confirm({
|
||||
icon: <ExclamationCircleOutlined/>,
|
||||
title: "Are you sure you want to deactivate \"" + user.name + "\"?",
|
||||
title: "Are you sure you want to block " + user.name + "?",
|
||||
width: 600,
|
||||
content: <Space direction="vertical" size="small">
|
||||
<Paragraph>Disabling this user will disconnect their devices and block dashboard access.</Paragraph>
|
||||
<Paragraph>Blocking this user will disconnect their devices and disable dashboard access.</Paragraph>
|
||||
</Space>,
|
||||
onOk() {
|
||||
let userToSave = createUserToSave(user, block)
|
||||
@@ -380,6 +380,12 @@ export const RegularUsers = () => {
|
||||
</div>
|
||||
}
|
||||
|
||||
if ((record as User).status === "blocked") {
|
||||
return <div>{btn}
|
||||
<Tag color="red">blocked</Tag>
|
||||
</div>
|
||||
}
|
||||
|
||||
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 && (
|
||||
<Column title="Active" align="center" width="150px" dataIndex="is_blocked"
|
||||
<Column title="Block user" align="center" width="150px" dataIndex="is_blocked"
|
||||
render={(e, record: UserDataTable, index) => {
|
||||
let witch = <Switch size={"small"} checked={!e}
|
||||
let witch = <Switch size={"small"} checked={e}
|
||||
disabled={record.is_current}
|
||||
onClick={(active: boolean) => {
|
||||
handleBlockUser(!active, record)
|
||||
handleBlockUser(active, record)
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user