@deix/rossini-identity-management 2.0.0 → 2.0.1
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.jsx → page.js} +1 -1
- package/lib/app/[locale]/{layout.jsx → layout.js} +3 -4
- package/lib/app/[locale]/users/{page.jsx → page.js} +1 -1
- package/lib/app/{layout.jsx → layout.js} +3 -7
- package/lib/components/AddItemDialog.js +45 -0
- package/lib/components/DeleteConfirmationDialog.js +35 -0
- package/lib/components/SearchField.js +16 -0
- package/lib/components/groups/{CreateGroupDialog.jsx → CreateGroupDialog.js} +4 -6
- package/lib/components/groups/{GroupDetails.jsx → GroupDetails.js} +2 -3
- package/lib/components/groups/GroupForm.js +38 -0
- package/lib/components/groups/GroupTabs.js +29 -0
- package/lib/components/groups/GroupUsers.js +73 -0
- package/lib/components/groups/Groups.js +97 -0
- package/lib/components/groups/GroupsTable.js +43 -0
- package/lib/components/users/{CreateUserDialog.jsx → CreateUserDialog.js} +4 -6
- package/lib/components/users/{UserCredentials.jsx → UserCredentials.js} +2 -5
- package/lib/components/users/{UserDetails.jsx → UserDetails.js} +2 -3
- package/lib/components/users/UserForm.js +66 -0
- package/lib/components/users/UserGroups.js +63 -0
- package/lib/components/users/{Users.jsx → Users.js} +41 -54
- package/lib/components/users/UsersTable.js +64 -0
- package/lib/components/users/UsersTabs.js +32 -0
- package/lib/config/{index.jsx → index.js} +1 -3
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/hooks/{useAPIClient.jsx → useAPIClient.js} +2 -4
- package/package.json +1 -1
- package/lib/components/AddItemDialog.jsx +0 -50
- package/lib/components/DeleteConfirmationDialog.jsx +0 -44
- package/lib/components/SearchField.jsx +0 -18
- package/lib/components/groups/GroupForm.jsx +0 -46
- package/lib/components/groups/GroupTabs.jsx +0 -33
- package/lib/components/groups/GroupUsers.jsx +0 -88
- package/lib/components/groups/Groups.jsx +0 -110
- package/lib/components/groups/GroupsTable.jsx +0 -55
- package/lib/components/users/UserForm.jsx +0 -79
- package/lib/components/users/UserGroups.jsx +0 -78
- package/lib/components/users/UsersTable.jsx +0 -78
- package/lib/components/users/UsersTabs.jsx +0 -36
|
@@ -58,59 +58,46 @@ 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
|
-
|
|
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>);
|
|
61
|
+
return (React.createElement(APIClientProvider, { baseURL: apiUrl },
|
|
62
|
+
React.createElement(Box, { sx: {
|
|
63
|
+
flexGrow: 1,
|
|
64
|
+
maxWidth: '100%',
|
|
65
|
+
overflowX: 'hidden',
|
|
66
|
+
paddingTop: 3,
|
|
67
|
+
paddingLeft: 3,
|
|
68
|
+
paddingRight: 3,
|
|
69
|
+
} },
|
|
70
|
+
!selectedUser && (React.createElement(React.Fragment, null,
|
|
71
|
+
React.createElement(Grid, { container: true, spacing: 2, sx: { marginBottom: 2 } },
|
|
72
|
+
React.createElement(Grid, null,
|
|
73
|
+
React.createElement(SearchField, { placeholder: usersTranslations.search[locale], onSearch: (value) => setSearchString(value) })),
|
|
74
|
+
React.createElement(Grid, null,
|
|
75
|
+
React.createElement(Button, { variant: 'contained', startIcon: React.createElement(PersonAddIcon, null), onClick: () => {
|
|
76
|
+
setOpenCreateUserDialog(true);
|
|
77
|
+
setSelectedUser(undefined);
|
|
78
|
+
} }, usersTranslations.new[locale]))),
|
|
79
|
+
React.createElement(UsersTable, { users: filteredUsers, selectedUser: selectedUser, setSelectedUser: (user) => {
|
|
80
|
+
setSelectedUser(user);
|
|
81
|
+
}, onDelete: handleDelete, emailAsUsername: emailAsUsername, disableDelete: disableDelete }))),
|
|
82
|
+
selectedUser && (React.createElement(Box, { sx: {
|
|
83
|
+
display: 'flex',
|
|
84
|
+
flexDirection: 'column',
|
|
85
|
+
alignItems: 'flex-start',
|
|
86
|
+
width: '100%',
|
|
87
|
+
} },
|
|
88
|
+
React.createElement(Box, { sx: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
} },
|
|
93
|
+
React.createElement(IconButton, { "aria-label": 'delete', color: 'primary', onClick: () => setSelectedUser(undefined), sx: { mr: 2 } },
|
|
94
|
+
React.createElement(ArrowBackIcon, null)),
|
|
95
|
+
React.createElement(Link, { underline: 'none', href: '#', onClick: () => setSelectedUser(undefined) }, usersTranslations.title[locale]),
|
|
96
|
+
React.createElement(KeyboardArrowRightIcon, null),
|
|
97
|
+
selectedUser.username),
|
|
98
|
+
React.createElement(UserTabs, { user: selectedUser, additionalTabs: additionalTabs, onUserUpdate: onUserUpdate, editUsername: editUsername, emailAsUsername: emailAsUsername, hideGroupsSelection: hideGroupsSelection }))),
|
|
99
|
+
React.createElement(CreateUserDialog, { open: openCreateUserDialog, onClose: () => {
|
|
100
|
+
setOpenCreateUserDialog(false);
|
|
101
|
+
}, onUserCreate: onUserCreate, filteredGroup: filteredGroup, emailAsUsername: true }))));
|
|
115
102
|
};
|
|
116
103
|
export default Users;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 (React.createElement(React.Fragment, null,
|
|
34
|
+
React.createElement(TableContainer, null,
|
|
35
|
+
React.createElement(Table, { size: 'small' },
|
|
36
|
+
React.createElement(TableHead, null,
|
|
37
|
+
React.createElement(TableRow, null,
|
|
38
|
+
usersTableColumns
|
|
39
|
+
.filter((c) => c.id !== 'username' || !emailAsUsername)
|
|
40
|
+
.map((col) => (React.createElement(TableCell, { key: col.id, align: col.align || 'inherit' }, isStringTranslation(col.label)
|
|
41
|
+
? col.label[locale]
|
|
42
|
+
: col.label))),
|
|
43
|
+
React.createElement(TableCell, { padding: 'none' }, ''))),
|
|
44
|
+
React.createElement(TableBody, null, users.map((user, rowIdx) => (React.createElement(TableRow, { key: rowIdx, onClick: () => setSelectedUser(user), sx: {
|
|
45
|
+
cursor: 'pointer',
|
|
46
|
+
background: selectedUser && user.id === selectedUser.id
|
|
47
|
+
? muiTheme.palette.primary.light
|
|
48
|
+
: undefined,
|
|
49
|
+
} },
|
|
50
|
+
React.createElement(TableCell, null, user.firstName),
|
|
51
|
+
React.createElement(TableCell, null, user.lastName),
|
|
52
|
+
!emailAsUsername && React.createElement(TableCell, null, user.username),
|
|
53
|
+
React.createElement(TableCell, null, user.email),
|
|
54
|
+
React.createElement(TableCell, null, user.enabled ? React.createElement(CheckIcon, null) : React.createElement(CloseIcon, null)),
|
|
55
|
+
!disableDelete && (React.createElement(TableCell, { padding: 'none', align: 'right' },
|
|
56
|
+
React.createElement(IconButton, { size: 'small', onClick: (evt) => {
|
|
57
|
+
evt.stopPropagation();
|
|
58
|
+
setOpenConfirmationDialog(true);
|
|
59
|
+
setDeleteUser(user);
|
|
60
|
+
} },
|
|
61
|
+
React.createElement(DeleteIcon, null)))))))))),
|
|
62
|
+
React.createElement(DeleteConfirmationDialog, { open: openConfirmationDialog, onClose: () => setOpenConfirmationDialog(false), onConfirm: () => (deleteUser ? onDelete(deleteUser) : {}) })));
|
|
63
|
+
};
|
|
64
|
+
export default UsersTable;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 (React.createElement(Box, { sx: {
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
maxWidth: '100%',
|
|
15
|
+
overflowX: 'hidden',
|
|
16
|
+
alignSelf: 'stretch',
|
|
17
|
+
} },
|
|
18
|
+
React.createElement(Box, { sx: { borderBottom: 1, borderColor: 'divider' } },
|
|
19
|
+
React.createElement(Tabs, { value: selectedTab, onChange: (_evt, newValue) => {
|
|
20
|
+
setSelectedTab(newValue);
|
|
21
|
+
}, "aria-label": 'basic tabs example' },
|
|
22
|
+
React.createElement(Tab, { label: usersTranslations.details[locale], value: 'DETAILS' }),
|
|
23
|
+
!hideGroupsSelection && (React.createElement(Tab, { label: usersTranslations.userGroups[locale], value: 'USER_GROUPS' })),
|
|
24
|
+
React.createElement(Tab, { label: usersTranslations.credentials[locale], value: 'CREDENTIALS' }),
|
|
25
|
+
additionalTabs.map((tab, index) => (React.createElement(Tab, { key: `tab${index}`, label: tab.title[locale], value: `ADDITIONAL_TAB_${index}` }))))),
|
|
26
|
+
React.createElement(Box, { sx: { p: 1 } },
|
|
27
|
+
selectedTab === 'DETAILS' && (React.createElement(UserDetails, { user: user, onUserUpdate: onUserUpdate, editUsername: editUsername, emailAsUsername: emailAsUsername })),
|
|
28
|
+
selectedTab === 'USER_GROUPS' && !hideGroupsSelection && (React.createElement(UserGroups, { user: user })),
|
|
29
|
+
selectedTab === 'CREDENTIALS' && React.createElement(UserCredentials, { user: user }),
|
|
30
|
+
additionalTabs.map((tab, index) => selectedTab === `ADDITIONAL_TAB_${index}` && (React.createElement(tab.component, { key: `tab${index}`, user: user }))))));
|
|
31
|
+
};
|
|
32
|
+
export default UserTabs;
|
|
@@ -13,8 +13,6 @@ export const getConfig = (publicRuntimeEnv) => ({
|
|
|
13
13
|
// read at runtime
|
|
14
14
|
const ConfigContext = createContext(getConfig({}));
|
|
15
15
|
export const ConfigProvider = ({ publicRuntimeEnv, children, }) => {
|
|
16
|
-
return (
|
|
17
|
-
{children}
|
|
18
|
-
</ConfigContext.Provider>);
|
|
16
|
+
return (React.createElement(ConfigContext.Provider, { value: getConfig(publicRuntimeEnv) }, children));
|
|
19
17
|
};
|
|
20
18
|
export const useConfig = () => useContext(ConfigContext);
|