@deix/rossini-identity-management 1.1.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/[locale]/groups/{page.js → page.jsx} +1 -1
- package/lib/app/[locale]/{layout.js → layout.jsx} +4 -3
- package/lib/app/[locale]/users/{page.js → page.jsx} +1 -1
- package/lib/app/{layout.js → layout.jsx} +7 -3
- package/lib/components/AddItemDialog.jsx +50 -0
- package/lib/components/DeleteConfirmationDialog.jsx +44 -0
- package/lib/components/SearchField.jsx +18 -0
- package/lib/components/groups/{CreateGroupDialog.js → CreateGroupDialog.jsx} +6 -4
- package/lib/components/groups/{GroupDetails.js → GroupDetails.jsx} +3 -2
- package/lib/components/groups/GroupForm.d.ts.map +1 -1
- package/lib/components/groups/GroupForm.jsx +46 -0
- package/lib/components/groups/GroupTabs.jsx +33 -0
- package/lib/components/groups/GroupUsers.jsx +88 -0
- package/lib/components/groups/Groups.jsx +110 -0
- package/lib/components/groups/GroupsTable.jsx +55 -0
- package/lib/components/users/{CreateUserDialog.js → CreateUserDialog.jsx} +6 -4
- package/lib/components/users/{UserCredentials.js → UserCredentials.jsx} +5 -2
- package/lib/components/users/{UserDetails.js → UserDetails.jsx} +3 -2
- package/lib/components/users/UserForm.d.ts.map +1 -1
- package/lib/components/users/UserForm.jsx +79 -0
- package/lib/components/users/UserGroups.jsx +78 -0
- package/lib/components/users/{Users.js → Users.jsx} +54 -41
- package/lib/components/users/UsersTable.jsx +78 -0
- package/lib/components/users/UsersTabs.jsx +36 -0
- package/lib/config/{index.js → index.jsx} +3 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/hooks/{useAPIClient.js → useAPIClient.jsx} +4 -2
- package/package.json +17 -25
- package/lib/components/AddItemDialog.js +0 -45
- package/lib/components/DeleteConfirmationDialog.js +0 -35
- package/lib/components/SearchField.js +0 -16
- package/lib/components/groups/GroupForm.js +0 -38
- package/lib/components/groups/GroupTabs.js +0 -29
- package/lib/components/groups/GroupUsers.js +0 -73
- package/lib/components/groups/Groups.js +0 -97
- package/lib/components/groups/GroupsTable.js +0 -43
- package/lib/components/users/UserForm.js +0 -66
- package/lib/components/users/UserGroups.js +0 -63
- package/lib/components/users/UsersTable.js +0 -64
- package/lib/components/users/UsersTabs.js +0 -32
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLocale } from '@deix/rossini-core';
|
|
3
|
+
import { Button, FormControlLabel, Grid, Switch, TextField, } from '@mui/material';
|
|
4
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import usersTranslations from '../../lang/users';
|
|
7
|
+
const UserForm = ({ user, onSave, onCancel, mode = 'create', editUsername, emailAsUsername = false, }) => {
|
|
8
|
+
const locale = useLocale();
|
|
9
|
+
const { control, formState: { errors }, handleSubmit, setValue, } = useForm({
|
|
10
|
+
defaultValues: {
|
|
11
|
+
id: user?.id,
|
|
12
|
+
username: user?.username || '',
|
|
13
|
+
firstName: user?.firstName || '',
|
|
14
|
+
lastName: user?.lastName || '',
|
|
15
|
+
email: user?.email || '',
|
|
16
|
+
emailVerified: user?.emailVerified || true,
|
|
17
|
+
enabled: user?.enabled || true,
|
|
18
|
+
sendEmailOnCreation: true,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (user) {
|
|
23
|
+
setValue('id', user?.id);
|
|
24
|
+
if (!emailAsUsername) {
|
|
25
|
+
setValue('username', user?.username);
|
|
26
|
+
}
|
|
27
|
+
setValue('firstName', user?.firstName);
|
|
28
|
+
setValue('lastName', user?.lastName);
|
|
29
|
+
setValue('email', user?.email);
|
|
30
|
+
setValue('emailVerified', user?.emailVerified);
|
|
31
|
+
setValue('enabled', user?.enabled);
|
|
32
|
+
setValue('groups', user?.groups);
|
|
33
|
+
// The user already exists, we don't want to send an email
|
|
34
|
+
setValue('sendEmailOnCreation', false);
|
|
35
|
+
}
|
|
36
|
+
}, [user, setValue]);
|
|
37
|
+
const onSubmit = (data) => {
|
|
38
|
+
onSave(data);
|
|
39
|
+
};
|
|
40
|
+
return (<form onSubmit={(event) => void handleSubmit(onSubmit)(event)}>
|
|
41
|
+
<Grid container spacing={2} sx={{ mt: 2, maxWidth: 'sm' }} justifyContent='stretch'>
|
|
42
|
+
{!emailAsUsername && (<Grid size={{ xs: 12 }}>
|
|
43
|
+
<Controller name='username' control={control} render={({ field }) => (<TextField size='small' fullWidth label={usersTranslations.username[locale]} disabled={mode === 'modify' && !editUsername} sx={{ flexShrink: 0 }} {...field}/>)}/>
|
|
44
|
+
</Grid>)}
|
|
45
|
+
<Grid size={{ xs: 12 }}>
|
|
46
|
+
<Controller name='firstName' control={control} render={({ field }) => (<TextField size='small' fullWidth label={usersTranslations.firstName[locale]} sx={{ flexShrink: 0 }} {...field}/>)}/>
|
|
47
|
+
</Grid>
|
|
48
|
+
<Grid size={{ xs: 12 }}>
|
|
49
|
+
<Controller name='lastName' control={control} render={({ field }) => (<TextField size='small' fullWidth label={usersTranslations.lastName[locale]} sx={{ flexShrink: 0 }} {...field}/>)}/>
|
|
50
|
+
</Grid>
|
|
51
|
+
<Grid size={{ xs: 12 }}>
|
|
52
|
+
<Controller name='email' control={control} rules={{ required: true }} render={({ field }) => (<TextField size='small' fullWidth error={!!errors.email} helperText={errors.email
|
|
53
|
+
? usersTranslations.requiredField[locale]
|
|
54
|
+
: undefined} label={usersTranslations.email[locale]} sx={{ flexShrink: 0 }} {...field}/>)}/>
|
|
55
|
+
</Grid>
|
|
56
|
+
<Grid size={{ xs: 12 }}>
|
|
57
|
+
<Controller name='enabled' control={control} render={({ field }) => (<FormControlLabel sx={{ ml: 1 }} control={<Switch checked={field.value} size='small' {...field}/>} label={usersTranslations.enabled[locale]}/>)}/>
|
|
58
|
+
</Grid>
|
|
59
|
+
{mode === 'create' && (<Grid size={{ xs: 12 }}>
|
|
60
|
+
<Controller name='sendEmailOnCreation' control={control} render={({ field }) => (<FormControlLabel sx={{ ml: 1 }} control={<Switch checked={field.value} size='small' {...field}/>} label={usersTranslations.sendResetPasswordEmail[locale]}/>)}/>
|
|
61
|
+
</Grid>)}
|
|
62
|
+
<Grid sx={{
|
|
63
|
+
mt: 2,
|
|
64
|
+
display: 'flex',
|
|
65
|
+
justifyContent: 'flex-end',
|
|
66
|
+
gap: 2,
|
|
67
|
+
width: '100%',
|
|
68
|
+
}}>
|
|
69
|
+
{mode === 'create' && (<Button variant='outlined' onClick={onCancel}>
|
|
70
|
+
{usersTranslations.cancel[locale]}
|
|
71
|
+
</Button>)}
|
|
72
|
+
<Button variant='contained' type='submit'>
|
|
73
|
+
{usersTranslations.save[locale]}
|
|
74
|
+
</Button>
|
|
75
|
+
</Grid>
|
|
76
|
+
</Grid>
|
|
77
|
+
</form>);
|
|
78
|
+
};
|
|
79
|
+
export default UserForm;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, Button, IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, } from '@mui/material';
|
|
3
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
4
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
5
|
+
import { isStringTranslation, useLocale } from '@deix/rossini-core';
|
|
6
|
+
import { useAddUserToGroup, useRemoveUserFromGroup, useUserGroups, } from '../../utils/hooks/users';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import DeleteConfirmationDialog from '../DeleteConfirmationDialog';
|
|
9
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
10
|
+
import usersTranslations from '../../lang/users';
|
|
11
|
+
import AddItemDialog from '../AddItemDialog';
|
|
12
|
+
import { useGroups } from '../../utils/hooks/groups';
|
|
13
|
+
import { useAPIClient } from '../../utils/hooks/useAPIClient';
|
|
14
|
+
const userGroupsTableColumns = [
|
|
15
|
+
{
|
|
16
|
+
id: 'name',
|
|
17
|
+
label: { en: 'Group', it: 'Gruppo' },
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
const UserGroups = ({ user }) => {
|
|
21
|
+
const locale = useLocale();
|
|
22
|
+
const apiClient = useAPIClient();
|
|
23
|
+
const queryClient = useQueryClient();
|
|
24
|
+
const { data: groups } = useGroups(apiClient);
|
|
25
|
+
const { data: userGroups } = useUserGroups(user?.id, apiClient);
|
|
26
|
+
const { mutate: addUserToGroup } = useAddUserToGroup(queryClient, apiClient);
|
|
27
|
+
const { mutate: removeUserFromGroup } = useRemoveUserFromGroup(queryClient, apiClient);
|
|
28
|
+
const [openAddGroupDialog, setOpenAddGroupDialog] = useState(false);
|
|
29
|
+
const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
|
|
30
|
+
const [deleteId, setDeleteId] = useState();
|
|
31
|
+
return (<>
|
|
32
|
+
{userGroups && userGroups.length > 0 && (<Box maxWidth='sm'>
|
|
33
|
+
<TableContainer>
|
|
34
|
+
<Table size='small'>
|
|
35
|
+
<TableHead>
|
|
36
|
+
<TableRow>
|
|
37
|
+
{userGroupsTableColumns.map((col) => (<TableCell key={col.id} align={col.align || 'inherit'}>
|
|
38
|
+
{isStringTranslation(col.label)
|
|
39
|
+
? col.label[locale]
|
|
40
|
+
: col.label}
|
|
41
|
+
</TableCell>))}
|
|
42
|
+
<TableCell padding='none'>{''}</TableCell>
|
|
43
|
+
</TableRow>
|
|
44
|
+
</TableHead>
|
|
45
|
+
<TableBody>
|
|
46
|
+
{userGroups?.map((group, rowIdx) => (<TableRow key={rowIdx}>
|
|
47
|
+
<TableCell>{group.name}</TableCell>
|
|
48
|
+
<TableCell padding='none' align='right'>
|
|
49
|
+
<IconButton size='small' onClick={(evt) => {
|
|
50
|
+
evt.stopPropagation();
|
|
51
|
+
setOpenConfirmationDialog(true);
|
|
52
|
+
setDeleteId(group.id);
|
|
53
|
+
}}>
|
|
54
|
+
<DeleteIcon />
|
|
55
|
+
</IconButton>
|
|
56
|
+
</TableCell>
|
|
57
|
+
</TableRow>))}
|
|
58
|
+
</TableBody>
|
|
59
|
+
</Table>
|
|
60
|
+
</TableContainer>
|
|
61
|
+
</Box>)}
|
|
62
|
+
<Button variant='outlined' startIcon={<AddIcon />} onClick={() => setOpenAddGroupDialog(true)} sx={{ marginTop: 2 }}>
|
|
63
|
+
{usersTranslations.addGroup[locale]}
|
|
64
|
+
</Button>
|
|
65
|
+
<AddItemDialog open={openAddGroupDialog} onClose={() => setOpenAddGroupDialog(false)} onConfirm={(value) => {
|
|
66
|
+
if (value) {
|
|
67
|
+
addUserToGroup({ userId: user.id, groupId: value?.value });
|
|
68
|
+
}
|
|
69
|
+
}} title={usersTranslations.addGroup} options={groups?.map((group) => ({
|
|
70
|
+
value: group.id,
|
|
71
|
+
label: group.name,
|
|
72
|
+
}))}/>
|
|
73
|
+
<DeleteConfirmationDialog open={openConfirmationDialog} onClose={() => setOpenConfirmationDialog(false)} onConfirm={() => deleteId
|
|
74
|
+
? removeUserFromGroup({ userId: user.id, groupId: deleteId })
|
|
75
|
+
: {}}/>
|
|
76
|
+
</>);
|
|
77
|
+
};
|
|
78
|
+
export default UserGroups;
|
|
@@ -58,46 +58,59 @@ const Users = ({ apiUrl, additionalTabs = [], onUserCreate, onUserUpdate, onUser
|
|
|
58
58
|
}
|
|
59
59
|
setSelectedUser(undefined);
|
|
60
60
|
};
|
|
61
|
-
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
61
|
+
return (<APIClientProvider baseURL={apiUrl}>
|
|
62
|
+
<Box sx={{
|
|
63
|
+
flexGrow: 1,
|
|
64
|
+
maxWidth: '100%',
|
|
65
|
+
overflowX: 'hidden',
|
|
66
|
+
paddingTop: 3,
|
|
67
|
+
paddingLeft: 3,
|
|
68
|
+
paddingRight: 3,
|
|
69
|
+
}}>
|
|
70
|
+
{!selectedUser && (<>
|
|
71
|
+
<Grid container spacing={2} sx={{ marginBottom: 2 }}>
|
|
72
|
+
<Grid>
|
|
73
|
+
<SearchField placeholder={usersTranslations.search[locale]} onSearch={(value) => setSearchString(value)}/>
|
|
74
|
+
</Grid>
|
|
75
|
+
<Grid>
|
|
76
|
+
<Button variant='contained' startIcon={<PersonAddIcon />} onClick={() => {
|
|
77
|
+
setOpenCreateUserDialog(true);
|
|
78
|
+
setSelectedUser(undefined);
|
|
79
|
+
}}>
|
|
80
|
+
{usersTranslations.new[locale]}
|
|
81
|
+
</Button>
|
|
82
|
+
</Grid>
|
|
83
|
+
</Grid>
|
|
84
|
+
<UsersTable users={filteredUsers} selectedUser={selectedUser} setSelectedUser={(user) => {
|
|
85
|
+
setSelectedUser(user);
|
|
86
|
+
}} onDelete={handleDelete} emailAsUsername={emailAsUsername} disableDelete={disableDelete}/>
|
|
87
|
+
</>)}
|
|
88
|
+
{selectedUser && (<Box sx={{
|
|
89
|
+
display: 'flex',
|
|
90
|
+
flexDirection: 'column',
|
|
91
|
+
alignItems: 'flex-start',
|
|
92
|
+
width: '100%',
|
|
93
|
+
}}>
|
|
94
|
+
<Box sx={{
|
|
95
|
+
display: 'flex',
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
}}>
|
|
99
|
+
<IconButton aria-label='delete' color='primary' onClick={() => setSelectedUser(undefined)} sx={{ mr: 2 }}>
|
|
100
|
+
<ArrowBackIcon />
|
|
101
|
+
</IconButton>
|
|
102
|
+
<Link underline='none' href='#' onClick={() => setSelectedUser(undefined)}>
|
|
103
|
+
{usersTranslations.title[locale]}
|
|
104
|
+
</Link>
|
|
105
|
+
<KeyboardArrowRightIcon />
|
|
106
|
+
{selectedUser.username}
|
|
107
|
+
</Box>
|
|
108
|
+
<UserTabs user={selectedUser} additionalTabs={additionalTabs} onUserUpdate={onUserUpdate} editUsername={editUsername} emailAsUsername={emailAsUsername} hideGroupsSelection={hideGroupsSelection}/>
|
|
109
|
+
</Box>)}
|
|
110
|
+
<CreateUserDialog open={openCreateUserDialog} onClose={() => {
|
|
111
|
+
setOpenCreateUserDialog(false);
|
|
112
|
+
}} onUserCreate={onUserCreate} filteredGroup={filteredGroup} emailAsUsername/>
|
|
113
|
+
</Box>
|
|
114
|
+
</APIClientProvider>);
|
|
102
115
|
};
|
|
103
116
|
export default Users;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { isStringTranslation, useLocale } from '@deix/rossini-core';
|
|
3
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
4
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
5
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
6
|
+
import { IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, useTheme, } from '@mui/material';
|
|
7
|
+
import { useState } from 'react';
|
|
8
|
+
import DeleteConfirmationDialog from '../DeleteConfirmationDialog';
|
|
9
|
+
const usersTableColumns = [
|
|
10
|
+
{
|
|
11
|
+
id: 'firstName',
|
|
12
|
+
label: { en: 'First Name', it: 'Nome' },
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'lastName',
|
|
16
|
+
label: { en: 'Last Name', it: 'Cognome' },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 'username',
|
|
20
|
+
label: { en: 'Username', it: 'Username' },
|
|
21
|
+
},
|
|
22
|
+
{ id: 'email', label: 'Email' },
|
|
23
|
+
{
|
|
24
|
+
id: 'enabled',
|
|
25
|
+
label: { en: 'Enabled', it: 'Utente Abilitato' },
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
const UsersTable = ({ users = [], selectedUser, setSelectedUser, onDelete, emailAsUsername = false, disableDelete = false, }) => {
|
|
29
|
+
const locale = useLocale();
|
|
30
|
+
const muiTheme = useTheme();
|
|
31
|
+
const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
|
|
32
|
+
const [deleteUser, setDeleteUser] = useState();
|
|
33
|
+
return (<>
|
|
34
|
+
<TableContainer>
|
|
35
|
+
<Table size='small'>
|
|
36
|
+
<TableHead>
|
|
37
|
+
<TableRow>
|
|
38
|
+
{usersTableColumns
|
|
39
|
+
.filter((c) => c.id !== 'username' || !emailAsUsername)
|
|
40
|
+
.map((col) => (<TableCell key={col.id} align={col.align || 'inherit'}>
|
|
41
|
+
{isStringTranslation(col.label)
|
|
42
|
+
? col.label[locale]
|
|
43
|
+
: col.label}
|
|
44
|
+
</TableCell>))}
|
|
45
|
+
<TableCell padding='none'>{''}</TableCell>
|
|
46
|
+
</TableRow>
|
|
47
|
+
</TableHead>
|
|
48
|
+
<TableBody>
|
|
49
|
+
{users.map((user, rowIdx) => (<TableRow key={rowIdx} onClick={() => setSelectedUser(user)} sx={{
|
|
50
|
+
cursor: 'pointer',
|
|
51
|
+
background: selectedUser && user.id === selectedUser.id
|
|
52
|
+
? muiTheme.palette.primary.light
|
|
53
|
+
: undefined,
|
|
54
|
+
}}>
|
|
55
|
+
<TableCell>{user.firstName}</TableCell>
|
|
56
|
+
<TableCell>{user.lastName}</TableCell>
|
|
57
|
+
{!emailAsUsername && <TableCell>{user.username}</TableCell>}
|
|
58
|
+
<TableCell>{user.email}</TableCell>
|
|
59
|
+
<TableCell>
|
|
60
|
+
{user.enabled ? <CheckIcon /> : <CloseIcon />}
|
|
61
|
+
</TableCell>
|
|
62
|
+
{!disableDelete && (<TableCell padding='none' align='right'>
|
|
63
|
+
<IconButton size='small' onClick={(evt) => {
|
|
64
|
+
evt.stopPropagation();
|
|
65
|
+
setOpenConfirmationDialog(true);
|
|
66
|
+
setDeleteUser(user);
|
|
67
|
+
}}>
|
|
68
|
+
<DeleteIcon />
|
|
69
|
+
</IconButton>
|
|
70
|
+
</TableCell>)}
|
|
71
|
+
</TableRow>))}
|
|
72
|
+
</TableBody>
|
|
73
|
+
</Table>
|
|
74
|
+
</TableContainer>
|
|
75
|
+
<DeleteConfirmationDialog open={openConfirmationDialog} onClose={() => setOpenConfirmationDialog(false)} onConfirm={() => (deleteUser ? onDelete(deleteUser) : {})}/>
|
|
76
|
+
</>);
|
|
77
|
+
};
|
|
78
|
+
export default UsersTable;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Box, Tab, Tabs } from '@mui/material';
|
|
4
|
+
import { useLocale } from '@deix/rossini-core';
|
|
5
|
+
import usersTranslations from '../../lang/users';
|
|
6
|
+
import UserDetails from './UserDetails';
|
|
7
|
+
import UserGroups from './UserGroups';
|
|
8
|
+
import UserCredentials from './UserCredentials';
|
|
9
|
+
const UserTabs = ({ user, additionalTabs = [], onUserUpdate, editUsername, emailAsUsername = false, hideGroupsSelection = false, }) => {
|
|
10
|
+
const locale = useLocale();
|
|
11
|
+
const [selectedTab, setSelectedTab] = useState('DETAILS');
|
|
12
|
+
return (<Box sx={{
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
maxWidth: '100%',
|
|
15
|
+
overflowX: 'hidden',
|
|
16
|
+
alignSelf: 'stretch',
|
|
17
|
+
}}>
|
|
18
|
+
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
|
19
|
+
<Tabs value={selectedTab} onChange={(_evt, newValue) => {
|
|
20
|
+
setSelectedTab(newValue);
|
|
21
|
+
}} aria-label='basic tabs example'>
|
|
22
|
+
<Tab label={usersTranslations.details[locale]} value='DETAILS'/>
|
|
23
|
+
{!hideGroupsSelection && (<Tab label={usersTranslations.userGroups[locale]} value='USER_GROUPS'/>)}
|
|
24
|
+
<Tab label={usersTranslations.credentials[locale]} value='CREDENTIALS'/>
|
|
25
|
+
{additionalTabs.map((tab, index) => (<Tab key={`tab${index}`} label={tab.title[locale]} value={`ADDITIONAL_TAB_${index}`}/>))}
|
|
26
|
+
</Tabs>
|
|
27
|
+
</Box>
|
|
28
|
+
<Box sx={{ p: 1 }}>
|
|
29
|
+
{selectedTab === 'DETAILS' && (<UserDetails user={user} onUserUpdate={onUserUpdate} editUsername={editUsername} emailAsUsername={emailAsUsername}/>)}
|
|
30
|
+
{selectedTab === 'USER_GROUPS' && !hideGroupsSelection && (<UserGroups user={user}/>)}
|
|
31
|
+
{selectedTab === 'CREDENTIALS' && <UserCredentials user={user}/>}
|
|
32
|
+
{additionalTabs.map((tab, index) => selectedTab === `ADDITIONAL_TAB_${index}` && (<tab.component key={`tab${index}`} user={user}/>))}
|
|
33
|
+
</Box>
|
|
34
|
+
</Box>);
|
|
35
|
+
};
|
|
36
|
+
export default UserTabs;
|
|
@@ -13,6 +13,8 @@ export const getConfig = (publicRuntimeEnv) => ({
|
|
|
13
13
|
// read at runtime
|
|
14
14
|
const ConfigContext = createContext(getConfig({}));
|
|
15
15
|
export const ConfigProvider = ({ publicRuntimeEnv, children, }) => {
|
|
16
|
-
return (
|
|
16
|
+
return (<ConfigContext.Provider value={getConfig(publicRuntimeEnv)}>
|
|
17
|
+
{children}
|
|
18
|
+
</ConfigContext.Provider>);
|
|
17
19
|
};
|
|
18
20
|
export const useConfig = () => useContext(ConfigContext);
|