@deix/rossini-identity-management 4.1.1 → 5.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/src/app/[locale]/groups/page.d.ts.map +1 -0
- package/lib/{app → src/app}/[locale]/layout.d.ts +1 -1
- package/lib/src/app/[locale]/layout.d.ts.map +1 -0
- package/lib/src/app/[locale]/users/page.d.ts +4 -0
- package/lib/src/app/[locale]/users/page.d.ts.map +1 -0
- package/lib/{app → src/app}/layout.d.ts +1 -1
- package/lib/src/app/layout.d.ts.map +1 -0
- package/lib/{components → src/components}/AddItemDialog.d.ts +2 -1
- package/lib/src/components/AddItemDialog.d.ts.map +1 -0
- package/lib/{components → src/components}/AddItemDialog.js +7 -20
- package/lib/{components → src/components}/DeleteConfirmationDialog.d.ts +2 -1
- package/lib/src/components/DeleteConfirmationDialog.d.ts.map +1 -0
- package/lib/src/components/DeleteConfirmationDialog.js +12 -0
- package/lib/{components → src/components}/SearchField.d.ts +2 -1
- package/lib/src/components/SearchField.d.ts.map +1 -0
- package/lib/{components → src/components}/SearchField.js +5 -3
- package/lib/{components → src/components}/groups/CreateGroupDialog.d.ts +2 -1
- package/lib/src/components/groups/CreateGroupDialog.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/CreateGroupDialog.js +3 -3
- package/lib/{components → src/components}/groups/GroupDetails.d.ts +2 -1
- package/lib/src/components/groups/GroupDetails.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupDetails.js +1 -1
- package/lib/{components → src/components}/groups/GroupForm.d.ts +2 -1
- package/lib/src/components/groups/GroupForm.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupForm.js +4 -4
- package/lib/{components → src/components}/groups/GroupTabs.d.ts +1 -1
- package/lib/src/components/groups/GroupTabs.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupTabs.js +3 -3
- package/lib/src/components/groups/GroupUsers.d.ts +8 -0
- package/lib/src/components/groups/GroupUsers.d.ts.map +1 -0
- package/lib/src/components/groups/GroupUsers.js +46 -0
- package/lib/{components → src/components}/groups/Groups.d.ts +2 -1
- package/lib/src/components/groups/Groups.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/Groups.js +8 -6
- package/lib/{components → src/components}/groups/GroupsTable.d.ts +2 -1
- package/lib/src/components/groups/GroupsTable.d.ts.map +1 -0
- package/lib/{components → src/components}/groups/GroupsTable.js +6 -7
- package/lib/src/components/index.d.ts.map +1 -0
- package/lib/src/components/tables/Table.d.ts +29 -0
- package/lib/src/components/tables/Table.d.ts.map +1 -0
- package/lib/src/components/tables/Table.js +96 -0
- package/lib/{components → src/components}/users/CreateUserDialog.d.ts +2 -1
- package/lib/src/components/users/CreateUserDialog.d.ts.map +1 -0
- package/lib/{components → src/components}/users/CreateUserDialog.js +3 -3
- package/lib/{components → src/components}/users/UserCredentials.d.ts +2 -1
- package/lib/src/components/users/UserCredentials.d.ts.map +1 -0
- package/lib/{components → src/components}/users/UserCredentials.js +3 -3
- package/lib/{components → src/components}/users/UserDetails.d.ts +2 -1
- package/lib/src/components/users/UserDetails.d.ts.map +1 -0
- package/lib/{components → src/components}/users/UserDetails.js +1 -1
- package/lib/{components → src/components}/users/UserForm.d.ts +2 -1
- package/lib/src/components/users/UserForm.d.ts.map +1 -0
- package/lib/src/components/users/UserForm.js +48 -0
- package/lib/src/components/users/UserGroups.d.ts +8 -0
- package/lib/src/components/users/UserGroups.d.ts.map +1 -0
- package/lib/{components → src/components}/users/UserGroups.js +6 -8
- package/lib/{components → src/components}/users/Users.d.ts +2 -1
- package/lib/src/components/users/Users.d.ts.map +1 -0
- package/lib/{components → src/components}/users/Users.js +17 -7
- package/lib/{components → src/components}/users/UsersTable.d.ts +5 -1
- package/lib/src/components/users/UsersTable.d.ts.map +1 -0
- package/lib/src/components/users/UsersTable.js +25 -0
- package/lib/{components → src/components}/users/UsersTabs.d.ts +1 -1
- package/lib/src/components/users/UsersTabs.d.ts.map +1 -0
- package/lib/src/components/users/UsersTabs.js +22 -0
- package/lib/src/config/i18n.d.ts.map +1 -0
- package/lib/{config → src/config}/index.d.ts +1 -1
- package/lib/src/config/index.d.ts.map +1 -0
- package/lib/src/config/palette.d.ts.map +1 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/lang/common.d.ts +6 -0
- package/lib/src/lang/common.d.ts.map +1 -0
- package/lib/src/lang/common.js +35 -0
- package/lib/src/lang/groups.d.ts.map +1 -0
- package/lib/{lang → src/lang}/groups.js +4 -0
- package/lib/src/lang/home.d.ts.map +1 -0
- package/lib/src/lang/tables.d.ts +6 -0
- package/lib/src/lang/tables.d.ts.map +1 -0
- package/lib/src/lang/tables.js +11 -0
- package/lib/src/lang/users.d.ts.map +1 -0
- package/lib/{lang → src/lang}/users.js +16 -0
- package/lib/src/proxy.d.ts.map +1 -0
- package/lib/src/types/config.d.ts.map +1 -0
- package/lib/src/types/groups.d.ts.map +1 -0
- package/lib/{utils → src/types}/index.d.ts.map +1 -1
- package/lib/src/types/tables.d.ts.map +1 -0
- package/lib/src/types/users.d.ts.map +1 -0
- package/lib/{utils/hooks → src/utils/helpers}/index.d.ts.map +1 -1
- package/lib/src/utils/hooks/groups.d.ts.map +1 -0
- package/lib/{utils → src/utils}/hooks/groups.js +10 -10
- package/lib/{utils/helpers → src/utils/hooks}/index.d.ts.map +1 -1
- package/lib/{utils → src/utils}/hooks/useAPIClient.d.ts +1 -1
- package/lib/src/utils/hooks/useAPIClient.d.ts.map +1 -0
- package/lib/src/utils/hooks/useTranslate.d.ts +6 -0
- package/lib/src/utils/hooks/useTranslate.d.ts.map +1 -0
- package/lib/src/utils/hooks/useTranslate.js +16 -0
- package/lib/src/utils/hooks/users.d.ts.map +1 -0
- package/lib/{utils → src/utils}/hooks/users.js +19 -19
- package/lib/{types → src/utils}/index.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -41
- package/lib/app/[locale]/groups/page.d.ts.map +0 -1
- package/lib/app/[locale]/layout.d.ts.map +0 -1
- package/lib/app/[locale]/users/page.d.ts +0 -3
- package/lib/app/[locale]/users/page.d.ts.map +0 -1
- package/lib/app/layout.d.ts.map +0 -1
- package/lib/components/AddItemDialog.d.ts.map +0 -1
- package/lib/components/DeleteConfirmationDialog.d.ts.map +0 -1
- package/lib/components/DeleteConfirmationDialog.js +0 -29
- package/lib/components/SearchField.d.ts.map +0 -1
- package/lib/components/groups/CreateGroupDialog.d.ts.map +0 -1
- package/lib/components/groups/GroupDetails.d.ts.map +0 -1
- package/lib/components/groups/GroupForm.d.ts.map +0 -1
- package/lib/components/groups/GroupTabs.d.ts.map +0 -1
- package/lib/components/groups/GroupUsers.d.ts +0 -7
- package/lib/components/groups/GroupUsers.d.ts.map +0 -1
- package/lib/components/groups/GroupUsers.js +0 -56
- package/lib/components/groups/Groups.d.ts.map +0 -1
- package/lib/components/groups/GroupsTable.d.ts.map +0 -1
- package/lib/components/index.d.ts.map +0 -1
- package/lib/components/users/CreateUserDialog.d.ts.map +0 -1
- package/lib/components/users/UserCredentials.d.ts.map +0 -1
- package/lib/components/users/UserDetails.d.ts.map +0 -1
- package/lib/components/users/UserForm.d.ts.map +0 -1
- package/lib/components/users/UserForm.js +0 -50
- package/lib/components/users/UserGroups.d.ts +0 -7
- package/lib/components/users/UserGroups.d.ts.map +0 -1
- package/lib/components/users/Users.d.ts.map +0 -1
- package/lib/components/users/UsersTable.d.ts.map +0 -1
- package/lib/components/users/UsersTable.js +0 -48
- package/lib/components/users/UsersTabs.d.ts.map +0 -1
- package/lib/components/users/UsersTabs.js +0 -22
- package/lib/config/i18n.d.ts.map +0 -1
- package/lib/config/index.d.ts.map +0 -1
- package/lib/config/palette.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/lang/groups.d.ts.map +0 -1
- package/lib/lang/home.d.ts.map +0 -1
- package/lib/lang/users.d.ts.map +0 -1
- package/lib/proxy.d.ts.map +0 -1
- package/lib/types/config.d.ts.map +0 -1
- package/lib/types/groups.d.ts.map +0 -1
- package/lib/types/tables.d.ts.map +0 -1
- package/lib/types/users.d.ts.map +0 -1
- package/lib/utils/hooks/groups.d.ts.map +0 -1
- package/lib/utils/hooks/useAPIClient.d.ts.map +0 -1
- package/lib/utils/hooks/users.d.ts.map +0 -1
- /package/lib/{app → src/app}/[locale]/groups/page.d.ts +0 -0
- /package/lib/{app → src/app}/[locale]/groups/page.js +0 -0
- /package/lib/{app → src/app}/[locale]/layout.js +0 -0
- /package/lib/{app → src/app}/[locale]/users/page.js +0 -0
- /package/lib/{app → src/app}/layout.js +0 -0
- /package/lib/{components → src/components}/index.d.ts +0 -0
- /package/lib/{components → src/components}/index.js +0 -0
- /package/lib/{config → src/config}/i18n.d.ts +0 -0
- /package/lib/{config → src/config}/i18n.js +0 -0
- /package/lib/{config → src/config}/index.js +0 -0
- /package/lib/{config → src/config}/palette.d.ts +0 -0
- /package/lib/{config → src/config}/palette.js +0 -0
- /package/lib/{index.d.ts → src/index.d.ts} +0 -0
- /package/lib/{index.js → src/index.js} +0 -0
- /package/lib/{lang → src/lang}/groups.d.ts +0 -0
- /package/lib/{lang → src/lang}/home.d.ts +0 -0
- /package/lib/{lang → src/lang}/home.js +0 -0
- /package/lib/{lang → src/lang}/users.d.ts +0 -0
- /package/lib/{proxy.d.ts → src/proxy.d.ts} +0 -0
- /package/lib/{proxy.js → src/proxy.js} +0 -0
- /package/lib/{types → src/types}/config.d.ts +0 -0
- /package/lib/{types → src/types}/config.js +0 -0
- /package/lib/{types → src/types}/groups.d.ts +0 -0
- /package/lib/{types → src/types}/groups.js +0 -0
- /package/lib/{types → src/types}/index.d.ts +0 -0
- /package/lib/{types → src/types}/index.js +0 -0
- /package/lib/{types → src/types}/tables.d.ts +0 -0
- /package/lib/{types → src/types}/tables.js +0 -0
- /package/lib/{types → src/types}/users.d.ts +0 -0
- /package/lib/{types → src/types}/users.js +0 -0
- /package/lib/{utils → src/utils}/helpers/index.d.ts +0 -0
- /package/lib/{utils → src/utils}/helpers/index.js +0 -0
- /package/lib/{utils → src/utils}/hooks/groups.d.ts +0 -0
- /package/lib/{utils → src/utils}/hooks/index.d.ts +0 -0
- /package/lib/{utils → src/utils}/hooks/index.js +0 -0
- /package/lib/{utils → src/utils}/hooks/useAPIClient.js +0 -0
- /package/lib/{utils → src/utils}/hooks/users.d.ts +0 -0
- /package/lib/{utils → src/utils}/index.d.ts +0 -0
- /package/lib/{utils → src/utils}/index.js +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useLocale } from '@deix/rossini-core';
|
|
5
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
6
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
7
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
8
|
+
import { Tooltip, useTheme } from '@mui/material';
|
|
9
|
+
import { DataGrid, GridActionsCell, GridActionsCellItem, } from '@mui/x-data-grid';
|
|
10
|
+
import { enUS, itIT } from '@mui/x-data-grid/locales';
|
|
11
|
+
import DeleteConfirmationDialog from '../DeleteConfirmationDialog';
|
|
12
|
+
import tablesTranslations from '../../lang/tables';
|
|
13
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
14
|
+
// DataGrid built-in texts (pagination, sorting, ...); English is the default
|
|
15
|
+
const dataGridLocales = {
|
|
16
|
+
en: enUS.components.MuiDataGrid.defaultProps.localeText,
|
|
17
|
+
it: itIT.components.MuiDataGrid.defaultProps.localeText,
|
|
18
|
+
};
|
|
19
|
+
const Table = ({ rows = [], columns, rowIdColumn = 'id', pageSizeOptions = [25, 50, 100], onRowClick, selectedRowId, onDelete, additionalActions, noDataLabel = tablesTranslations.noData, initialState, localeText, sx, ...props }) => {
|
|
20
|
+
const locale = useLocale();
|
|
21
|
+
const t = useTranslate();
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
|
|
24
|
+
const [deleteRow, setDeleteRow] = useState();
|
|
25
|
+
const gridColumns = columns.map((col) => ({
|
|
26
|
+
field: col.field,
|
|
27
|
+
headerName: t(col.label),
|
|
28
|
+
type: col.type,
|
|
29
|
+
align: col.align,
|
|
30
|
+
headerAlign: col.align,
|
|
31
|
+
width: col.width,
|
|
32
|
+
minWidth: col.minWidth,
|
|
33
|
+
flex: col.width ? undefined : (col.flex ?? 1),
|
|
34
|
+
sortable: col.sortable ?? true,
|
|
35
|
+
valueGetter: col.valueGetter
|
|
36
|
+
? (_value, row) => col.valueGetter?.(row)
|
|
37
|
+
: undefined,
|
|
38
|
+
renderCell: (params) => {
|
|
39
|
+
if (col.renderCell) {
|
|
40
|
+
return col.renderCell(params.row);
|
|
41
|
+
}
|
|
42
|
+
if (col.type === 'boolean') {
|
|
43
|
+
return params.value ? _jsx(CheckIcon, {}) : _jsx(CloseIcon, {});
|
|
44
|
+
}
|
|
45
|
+
return (_jsx(Tooltip, { title: String(params.formattedValue ?? ''), children: _jsx("span", { children: params.formattedValue }) }));
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
if (onDelete || additionalActions) {
|
|
49
|
+
gridColumns.push({
|
|
50
|
+
field: 'actions',
|
|
51
|
+
type: 'actions',
|
|
52
|
+
renderCell: (params) => {
|
|
53
|
+
const actionItems = [];
|
|
54
|
+
if (additionalActions) {
|
|
55
|
+
actionItems.push(...additionalActions(params.row));
|
|
56
|
+
}
|
|
57
|
+
if (onDelete) {
|
|
58
|
+
actionItems.push(_jsx(GridActionsCellItem, { icon: _jsx(DeleteIcon, {}), label: t(tablesTranslations.delete), onClick: (evt) => {
|
|
59
|
+
evt.stopPropagation();
|
|
60
|
+
setDeleteRow(params.row);
|
|
61
|
+
setOpenConfirmationDialog(true);
|
|
62
|
+
} }, 'delete'));
|
|
63
|
+
}
|
|
64
|
+
return _jsx(GridActionsCell, { ...params, children: actionItems });
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return (_jsxs(_Fragment, { children: [_jsx(DataGrid, { rows: rows, columns: gridColumns, getRowId: (row) => row[rowIdColumn], pageSizeOptions: pageSizeOptions, initialState: {
|
|
69
|
+
...initialState,
|
|
70
|
+
pagination: {
|
|
71
|
+
paginationModel: { page: 0, pageSize: pageSizeOptions[0] },
|
|
72
|
+
...initialState?.pagination,
|
|
73
|
+
},
|
|
74
|
+
}, onRowClick: onRowClick ? (params) => onRowClick(params.row) : undefined, getRowClassName: (params) => selectedRowId !== undefined && params.id === selectedRowId
|
|
75
|
+
? 'Table-selectedRow'
|
|
76
|
+
: '', localeText: {
|
|
77
|
+
...(dataGridLocales[locale] ?? dataGridLocales.en),
|
|
78
|
+
noRowsLabel: t(noDataLabel),
|
|
79
|
+
...localeText,
|
|
80
|
+
}, density: 'compact', autoHeight: true, disableColumnMenu: true, disableRowSelectionOnClick: true, sx: {
|
|
81
|
+
'& .Table-selectedRow': {
|
|
82
|
+
backgroundColor: theme.palette.primary.light,
|
|
83
|
+
},
|
|
84
|
+
...(!!onRowClick && {
|
|
85
|
+
'& .MuiDataGrid-row:hover': {
|
|
86
|
+
cursor: 'pointer',
|
|
87
|
+
backgroundColor: theme.palette.primary.light,
|
|
88
|
+
},
|
|
89
|
+
'.MuiDataGrid-cell:focus, .MuiDataGrid-cell:focus-within': {
|
|
90
|
+
outline: 'none',
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
...sx,
|
|
94
|
+
}, ...props }), onDelete && (_jsx(DeleteConfirmationDialog, { open: openConfirmationDialog, onClose: () => setOpenConfirmationDialog(false), onConfirm: () => (deleteRow ? onDelete(deleteRow) : {}) }))] }));
|
|
95
|
+
};
|
|
96
|
+
export default Table;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { User } from '../../types/users';
|
|
2
3
|
export interface CreateUserDialogProps {
|
|
3
4
|
open: boolean;
|
|
@@ -6,6 +7,6 @@ export interface CreateUserDialogProps {
|
|
|
6
7
|
filteredGroup?: string;
|
|
7
8
|
emailAsUsername?: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare const CreateUserDialog: ({ open, onClose, onUserCreate, filteredGroup, emailAsUsername, }: CreateUserDialogProps) =>
|
|
10
|
+
declare const CreateUserDialog: ({ open, onClose, onUserCreate, filteredGroup, emailAsUsername, }: CreateUserDialogProps) => React.JSX.Element;
|
|
10
11
|
export default CreateUserDialog;
|
|
11
12
|
//# sourceMappingURL=CreateUserDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateUserDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/users/CreateUserDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,QAAA,MAAM,gBAAgB,qEAMnB,qBAAqB,sBA6CvB,CAAC;eAEa,gBAAgB"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLocale } from '@deix/rossini-core';
|
|
3
2
|
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
|
|
4
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
5
4
|
import { getUsers, useAddUser } from '../../utils/hooks/users';
|
|
6
5
|
import UserForm from './UserForm';
|
|
7
6
|
import usersTranslations from '../../lang/users';
|
|
8
7
|
import { useAPIClient } from '../../utils/hooks/useAPIClient';
|
|
8
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
9
9
|
const CreateUserDialog = ({ open, onClose, onUserCreate, filteredGroup, emailAsUsername, }) => {
|
|
10
|
-
const
|
|
10
|
+
const t = useTranslate();
|
|
11
11
|
const apiClient = useAPIClient();
|
|
12
12
|
const queryClient = useQueryClient();
|
|
13
13
|
const addUserMutation = useAddUser(queryClient, apiClient);
|
|
@@ -31,6 +31,6 @@ const CreateUserDialog = ({ open, onClose, onUserCreate, filteredGroup, emailAsU
|
|
|
31
31
|
});
|
|
32
32
|
onClose();
|
|
33
33
|
};
|
|
34
|
-
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: usersTranslations.create
|
|
34
|
+
return (_jsxs(Dialog, { open: open, fullWidth: true, maxWidth: 'sm', onClose: onClose, children: [_jsx(DialogTitle, { children: t(usersTranslations.create) }), _jsx(DialogContent, { children: _jsx(UserForm, { mode: 'create', onSave: handleSave, onCancel: onClose, emailAsUsername: emailAsUsername }) })] }));
|
|
35
35
|
};
|
|
36
36
|
export default CreateUserDialog;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { User } from '../../types/users';
|
|
2
3
|
interface UserCredentialsProps {
|
|
3
4
|
user: User;
|
|
4
5
|
}
|
|
5
|
-
declare const UserCredentials: ({ user }: UserCredentialsProps) =>
|
|
6
|
+
declare const UserCredentials: ({ user }: UserCredentialsProps) => React.JSX.Element;
|
|
6
7
|
export default UserCredentials;
|
|
7
8
|
//# sourceMappingURL=UserCredentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserCredentials.d.ts","sourceRoot":"","sources":["../../../../src/components/users/UserCredentials.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAQzC,UAAU,oBAAoB;IAC5B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,QAAA,MAAM,eAAe,aAAc,oBAAoB,sBAkBtD,CAAC;eAEa,eAAe"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useLocale } from '@deix/rossini-core';
|
|
3
2
|
import { Box, Button } from '@mui/material';
|
|
4
3
|
import usersTranslations from '../../lang/users';
|
|
5
4
|
import { useSendUpdatePasswordEmail } from '../../utils/hooks/users';
|
|
6
5
|
import { useQueryClient } from '@tanstack/react-query';
|
|
7
6
|
import { useAPIClient } from '../../utils/hooks/useAPIClient';
|
|
7
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
8
8
|
const UserCredentials = ({ user }) => {
|
|
9
|
-
const
|
|
9
|
+
const t = useTranslate();
|
|
10
10
|
const apiClient = useAPIClient();
|
|
11
11
|
const queryClient = useQueryClient();
|
|
12
12
|
const { mutate: sendResetPasswordEmail } = useSendUpdatePasswordEmail(queryClient, apiClient);
|
|
13
|
-
return (_jsx(Box, { sx: { mt: 2 }, children: _jsx(Button, { variant: 'contained', onClick: () => sendResetPasswordEmail(user.id), children: usersTranslations.sendResetPasswordEmail
|
|
13
|
+
return (_jsx(Box, { sx: { mt: 2 }, children: _jsx(Button, { variant: 'contained', onClick: () => sendResetPasswordEmail(user.id), children: t(usersTranslations.sendResetPasswordEmail) }) }));
|
|
14
14
|
};
|
|
15
15
|
export default UserCredentials;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { User } from '../../types/users';
|
|
2
3
|
export interface UserDetailsProps {
|
|
3
4
|
user: User;
|
|
@@ -5,6 +6,6 @@ export interface UserDetailsProps {
|
|
|
5
6
|
editUsername?: boolean;
|
|
6
7
|
emailAsUsername?: boolean;
|
|
7
8
|
}
|
|
8
|
-
declare const UserDetails: ({ user, onUserUpdate, editUsername, emailAsUsername, }: UserDetailsProps) =>
|
|
9
|
+
declare const UserDetails: ({ user, onUserUpdate, editUsername, emailAsUsername, }: UserDetailsProps) => React.JSX.Element;
|
|
9
10
|
export default UserDetails;
|
|
10
11
|
//# sourceMappingURL=UserDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/users/UserDetails.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAKzC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,QAAA,MAAM,WAAW,2DAKd,gBAAgB,sBA2BlB,CAAC;eAEa,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { useUpdateUser } from '../../utils/hooks/users';
|
|
4
4
|
import UserForm from './UserForm';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { User } from '../../types/users';
|
|
2
3
|
export interface UserFormFields extends User {
|
|
3
4
|
sendEmailOnCreation: boolean;
|
|
@@ -10,6 +11,6 @@ export interface UserFormProps {
|
|
|
10
11
|
editUsername?: boolean;
|
|
11
12
|
emailAsUsername?: boolean;
|
|
12
13
|
}
|
|
13
|
-
declare const UserForm: ({ user, onSave, onCancel, mode, editUsername, emailAsUsername, }: UserFormProps) =>
|
|
14
|
+
declare const UserForm: ({ user, onSave, onCancel, mode, editUsername, emailAsUsername, }: UserFormProps) => React.JSX.Element;
|
|
14
15
|
export default UserForm;
|
|
15
16
|
//# sourceMappingURL=UserForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserForm.d.ts","sourceRoot":"","sources":["../../../../src/components/users/UserForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,MAAM,WAAW,cAAe,SAAQ,IAAI;IAC1C,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,QAAA,MAAM,QAAQ,qEAOX,aAAa,sBA0Kf,CAAC;eAEa,QAAQ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, FormControlLabel, Grid, Switch, TextField, } from '@mui/material';
|
|
3
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
4
|
+
import { useEffect } from 'react';
|
|
5
|
+
import usersTranslations from '../../lang/users';
|
|
6
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
7
|
+
const UserForm = ({ user, onSave, onCancel, mode = 'create', editUsername, emailAsUsername = false, }) => {
|
|
8
|
+
const t = useTranslate();
|
|
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 (_jsx("form", { onSubmit: (event) => void handleSubmit(onSubmit)(event), children: _jsxs(Grid, { container: true, spacing: 2, sx: { mt: 2, maxWidth: 'sm', justifyContent: 'stretch' }, children: [!emailAsUsername && (_jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'username', control: control, render: ({ field }) => (_jsx(TextField, { size: 'small', fullWidth: true, label: t(usersTranslations.username), disabled: mode === 'modify' && !editUsername, sx: { flexShrink: 0 }, ...field })) }) })), _jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'firstName', control: control, render: ({ field }) => (_jsx(TextField, { size: 'small', fullWidth: true, label: t(usersTranslations.firstName), sx: { flexShrink: 0 }, ...field })) }) }), _jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'lastName', control: control, render: ({ field }) => (_jsx(TextField, { size: 'small', fullWidth: true, label: t(usersTranslations.lastName), sx: { flexShrink: 0 }, ...field })) }) }), _jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'email', control: control, rules: { required: true }, render: ({ field }) => (_jsx(TextField, { size: 'small', fullWidth: true, error: !!errors.email, helperText: errors.email ? t(usersTranslations.requiredField) : undefined, label: t(usersTranslations.email), sx: { flexShrink: 0 }, ...field })) }) }), _jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'enabled', control: control, render: ({ field }) => (_jsx(FormControlLabel, { sx: { ml: 1 }, control: _jsx(Switch, { checked: field.value, size: 'small', ...field }), label: t(usersTranslations.enabled) })) }) }), mode === 'create' && (_jsx(Grid, { size: { xs: 12 }, children: _jsx(Controller, { name: 'sendEmailOnCreation', control: control, render: ({ field }) => (_jsx(FormControlLabel, { sx: { ml: 1 }, control: _jsx(Switch, { checked: field.value, size: 'small', ...field }), label: t(usersTranslations.sendResetPasswordEmail) })) }) })), _jsxs(Grid, { sx: {
|
|
41
|
+
mt: 2,
|
|
42
|
+
display: 'flex',
|
|
43
|
+
justifyContent: 'flex-end',
|
|
44
|
+
gap: 2,
|
|
45
|
+
width: '100%',
|
|
46
|
+
}, children: [mode === 'create' && (_jsx(Button, { variant: 'outlined', onClick: onCancel, children: t(usersTranslations.cancel) })), _jsx(Button, { variant: 'contained', type: 'submit', children: t(usersTranslations.save) })] })] }) }));
|
|
47
|
+
};
|
|
48
|
+
export default UserForm;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { User } from '../../types/users';
|
|
3
|
+
interface UserGroupsProps {
|
|
4
|
+
user: User;
|
|
5
|
+
}
|
|
6
|
+
declare const UserGroups: ({ user }: UserGroupsProps) => React.JSX.Element;
|
|
7
|
+
export default UserGroups;
|
|
8
|
+
//# sourceMappingURL=UserGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserGroups.d.ts","sourceRoot":"","sources":["../../../../src/components/users/UserGroups.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAe1B,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAuBzC,UAAU,eAAe;IACvB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,QAAA,MAAM,UAAU,aAAc,eAAe,sBA0F5C,CAAC;eAEa,UAAU"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Button, IconButton, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, } from '@mui/material';
|
|
3
3
|
import AddIcon from '@mui/icons-material/Add';
|
|
4
4
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
5
|
-
import { isStringTranslation, useLocale } from '@deix/rossini-core';
|
|
6
5
|
import { useAddUserToGroup, useRemoveUserFromGroup, useUserGroups, } from '../../utils/hooks/users';
|
|
7
6
|
import { useState } from 'react';
|
|
8
7
|
import DeleteConfirmationDialog from '../DeleteConfirmationDialog';
|
|
@@ -11,14 +10,15 @@ import usersTranslations from '../../lang/users';
|
|
|
11
10
|
import AddItemDialog from '../AddItemDialog';
|
|
12
11
|
import { useGroups } from '../../utils/hooks/groups';
|
|
13
12
|
import { useAPIClient } from '../../utils/hooks/useAPIClient';
|
|
13
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
14
14
|
const userGroupsTableColumns = [
|
|
15
15
|
{
|
|
16
16
|
id: 'name',
|
|
17
|
-
label:
|
|
17
|
+
label: usersTranslations.group,
|
|
18
18
|
},
|
|
19
19
|
];
|
|
20
20
|
const UserGroups = ({ user }) => {
|
|
21
|
-
const
|
|
21
|
+
const t = useTranslate();
|
|
22
22
|
const apiClient = useAPIClient();
|
|
23
23
|
const queryClient = useQueryClient();
|
|
24
24
|
const { data: groups } = useGroups(apiClient);
|
|
@@ -28,13 +28,11 @@ const UserGroups = ({ user }) => {
|
|
|
28
28
|
const [openAddGroupDialog, setOpenAddGroupDialog] = useState(false);
|
|
29
29
|
const [openConfirmationDialog, setOpenConfirmationDialog] = useState(false);
|
|
30
30
|
const [deleteId, setDeleteId] = useState();
|
|
31
|
-
return (_jsxs(_Fragment, { children: [userGroups && userGroups.length > 0 && (_jsx(Box, { maxWidth: 'sm', children: _jsx(TableContainer, { children: _jsxs(Table, { size: 'small', children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [userGroupsTableColumns.map((col) => (_jsx(TableCell, { align: col.align || 'inherit', children:
|
|
32
|
-
? col.label[locale]
|
|
33
|
-
: col.label }, col.id))), _jsx(TableCell, { padding: 'none', children: '' })] }) }), _jsx(TableBody, { children: userGroups?.map((group, rowIdx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: group.name }), _jsx(TableCell, { padding: 'none', align: 'right', children: _jsx(IconButton, { size: 'small', onClick: (evt) => {
|
|
31
|
+
return (_jsxs(_Fragment, { children: [userGroups && userGroups.length > 0 && (_jsx(Box, { sx: { maxWidth: 'sm' }, children: _jsx(TableContainer, { children: _jsxs(Table, { size: 'small', children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [userGroupsTableColumns.map((col) => (_jsx(TableCell, { align: col.align || 'inherit', children: t(col.label) }, col.id))), _jsx(TableCell, { padding: 'none', children: '' })] }) }), _jsx(TableBody, { children: userGroups?.map((group, rowIdx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: group.name }), _jsx(TableCell, { padding: 'none', align: 'right', children: _jsx(IconButton, { size: 'small', onClick: (evt) => {
|
|
34
32
|
evt.stopPropagation();
|
|
35
33
|
setOpenConfirmationDialog(true);
|
|
36
34
|
setDeleteId(group.id);
|
|
37
|
-
}, children: _jsx(DeleteIcon, {}) }) })] }, rowIdx))) })] }) }) })), _jsx(Button, { variant: 'outlined', startIcon: _jsx(AddIcon, {}), onClick: () => setOpenAddGroupDialog(true), sx: { marginTop: 2 }, children: usersTranslations.addGroup
|
|
35
|
+
}, children: _jsx(DeleteIcon, {}) }) })] }, rowIdx))) })] }) }) })), _jsx(Button, { variant: 'outlined', startIcon: _jsx(AddIcon, {}), onClick: () => setOpenAddGroupDialog(true), sx: { marginTop: 2 }, children: t(usersTranslations.addGroup) }), _jsx(AddItemDialog, { open: openAddGroupDialog, onClose: () => setOpenAddGroupDialog(false), onConfirm: (value) => {
|
|
38
36
|
if (value) {
|
|
39
37
|
addUserToGroup({ userId: user.id, groupId: value?.value });
|
|
40
38
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { User } from '../../types/users';
|
|
2
3
|
import { UserTab } from './UsersTabs';
|
|
3
4
|
interface UsersProps {
|
|
@@ -12,6 +13,6 @@ interface UsersProps {
|
|
|
12
13
|
hideGroupsSelection?: boolean;
|
|
13
14
|
disableDelete?: boolean;
|
|
14
15
|
}
|
|
15
|
-
declare const Users: ({ apiUrl, additionalTabs, onUserCreate, onUserUpdate, onUserDelete, editUsername, filteredGroup, emailAsUsername, hideGroupsSelection, disableDelete, }: UsersProps) =>
|
|
16
|
+
declare const Users: ({ apiUrl, additionalTabs, onUserCreate, onUserUpdate, onUserDelete, editUsername, filteredGroup, emailAsUsername, hideGroupsSelection, disableDelete, }: UsersProps) => React.JSX.Element;
|
|
16
17
|
export default Users;
|
|
17
18
|
//# sourceMappingURL=Users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Users.d.ts","sourceRoot":"","sources":["../../../../src/components/users/Users.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAYnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAiB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKhD,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;IAE3B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IAEtD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IAEvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAEpC,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,QAAA,MAAM,KAAK,4JAWR,UAAU,sBAyKZ,CAAC;eAEa,KAAK"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import PersonAddIcon from '@mui/icons-material/PersonAdd';
|
|
5
5
|
import { Box, Button, Grid, IconButton, Link } from '@mui/material';
|
|
6
6
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
7
7
|
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
|
8
|
-
import { useAPI
|
|
8
|
+
import { useAPI } from '@deix/rossini-core';
|
|
9
9
|
import { useQueryClient } from '@tanstack/react-query';
|
|
10
10
|
import { SearchField } from '../../components';
|
|
11
11
|
import CreateUserDialog from './CreateUserDialog';
|
|
@@ -14,8 +14,10 @@ import usersTranslations from '../../lang/users';
|
|
|
14
14
|
import { useDeleteUser, useUsers } from '../../utils/hooks/users';
|
|
15
15
|
import UserTabs from './UsersTabs';
|
|
16
16
|
import { APIClientProvider } from '../../utils/hooks/useAPIClient';
|
|
17
|
+
import commonTranslations from '../../lang/common';
|
|
18
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
17
19
|
const Users = ({ apiUrl, additionalTabs = [], onUserCreate, onUserUpdate, onUserDelete, editUsername, filteredGroup, emailAsUsername = false, hideGroupsSelection = false, disableDelete = false, }) => {
|
|
18
|
-
const
|
|
20
|
+
const t = useTranslate();
|
|
19
21
|
const apiClient = useAPI(apiUrl);
|
|
20
22
|
const queryClient = useQueryClient();
|
|
21
23
|
const { data: users } = useUsers(apiClient, filteredGroup);
|
|
@@ -24,6 +26,11 @@ const Users = ({ apiUrl, additionalTabs = [], onUserCreate, onUserUpdate, onUser
|
|
|
24
26
|
const [filteredUsers, setFilteredUsers] = useState();
|
|
25
27
|
const [selectedUser, setSelectedUser] = useState();
|
|
26
28
|
const [openCreateUserDialog, setOpenCreateUserDialog] = useState(false);
|
|
29
|
+
// Kept here so the current page survives opening a user's details
|
|
30
|
+
const [paginationModel, setPaginationModel] = useState({
|
|
31
|
+
page: 0,
|
|
32
|
+
pageSize: 25,
|
|
33
|
+
});
|
|
27
34
|
// Update the filtered users using the search string
|
|
28
35
|
useEffect(() => {
|
|
29
36
|
if (users && searchString === '') {
|
|
@@ -66,12 +73,15 @@ const Users = ({ apiUrl, additionalTabs = [], onUserCreate, onUserUpdate, onUser
|
|
|
66
73
|
paddingTop: 3,
|
|
67
74
|
paddingLeft: 3,
|
|
68
75
|
paddingRight: 3,
|
|
69
|
-
}, children: [!selectedUser && (_jsxs(_Fragment, { children: [_jsxs(Grid, { container: true, spacing: 2, sx: { marginBottom: 2 }, children: [_jsx(Grid, { children: _jsx(SearchField, { placeholder: usersTranslations.search
|
|
76
|
+
}, children: [!selectedUser && (_jsxs(_Fragment, { children: [_jsxs(Grid, { container: true, spacing: 2, sx: { marginBottom: 2 }, children: [_jsx(Grid, { children: _jsx(SearchField, { placeholder: t(usersTranslations.search), onSearch: (value) => {
|
|
77
|
+
setSearchString(value);
|
|
78
|
+
setPaginationModel((model) => ({ ...model, page: 0 }));
|
|
79
|
+
} }) }), _jsx(Grid, { children: _jsx(Button, { variant: 'contained', startIcon: _jsx(PersonAddIcon, {}), onClick: () => {
|
|
70
80
|
setOpenCreateUserDialog(true);
|
|
71
81
|
setSelectedUser(undefined);
|
|
72
|
-
}, children: usersTranslations.new
|
|
82
|
+
}, children: t(usersTranslations.new) }) })] }), _jsx(UsersTable, { users: filteredUsers, selectedUser: selectedUser, setSelectedUser: (user) => {
|
|
73
83
|
setSelectedUser(user);
|
|
74
|
-
}, onDelete: handleDelete, emailAsUsername: emailAsUsername, disableDelete: disableDelete })] })), selectedUser && (_jsxs(Box, { sx: {
|
|
84
|
+
}, onDelete: handleDelete, emailAsUsername: emailAsUsername, disableDelete: disableDelete, paginationModel: paginationModel, onPaginationModelChange: setPaginationModel })] })), selectedUser && (_jsxs(Box, { sx: {
|
|
75
85
|
display: 'flex',
|
|
76
86
|
flexDirection: 'column',
|
|
77
87
|
alignItems: 'flex-start',
|
|
@@ -80,7 +90,7 @@ const Users = ({ apiUrl, additionalTabs = [], onUserCreate, onUserUpdate, onUser
|
|
|
80
90
|
display: 'flex',
|
|
81
91
|
flexDirection: 'row',
|
|
82
92
|
alignItems: 'center',
|
|
83
|
-
}, children: [_jsx(IconButton, { "aria-label":
|
|
93
|
+
}, children: [_jsx(IconButton, { "aria-label": t(commonTranslations.back), color: 'primary', onClick: () => setSelectedUser(undefined), sx: { mr: 2 }, children: _jsx(ArrowBackIcon, {}) }), _jsx(Link, { underline: 'none', href: '#', onClick: () => setSelectedUser(undefined), children: t(usersTranslations.title) }), _jsx(KeyboardArrowRightIcon, {}), selectedUser.username] }), _jsx(UserTabs, { user: selectedUser, additionalTabs: additionalTabs, onUserUpdate: onUserUpdate, editUsername: editUsername, emailAsUsername: emailAsUsername, hideGroupsSelection: hideGroupsSelection })] })), _jsx(CreateUserDialog, { open: openCreateUserDialog, onClose: () => {
|
|
84
94
|
setOpenCreateUserDialog(false);
|
|
85
95
|
}, onUserCreate: onUserCreate, filteredGroup: filteredGroup, emailAsUsername: emailAsUsername })] }) }));
|
|
86
96
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridPaginationModel } from '@mui/x-data-grid';
|
|
1
3
|
import { Group } from '../../types/groups';
|
|
2
4
|
import { User } from '../../types/users';
|
|
3
5
|
export interface TableProps {
|
|
@@ -8,7 +10,9 @@ export interface TableProps {
|
|
|
8
10
|
onDelete: (user: User) => void;
|
|
9
11
|
emailAsUsername?: boolean;
|
|
10
12
|
disableDelete?: boolean;
|
|
13
|
+
paginationModel?: GridPaginationModel;
|
|
14
|
+
onPaginationModelChange?: (model: GridPaginationModel) => void;
|
|
11
15
|
}
|
|
12
|
-
declare const UsersTable: ({ users, selectedUser, setSelectedUser, onDelete, emailAsUsername, disableDelete, }: TableProps) =>
|
|
16
|
+
declare const UsersTable: ({ users, selectedUser, setSelectedUser, onDelete, emailAsUsername, disableDelete, paginationModel, onPaginationModelChange, }: TableProps) => React.JSX.Element;
|
|
13
17
|
export default UsersTable;
|
|
14
18
|
//# sourceMappingURL=UsersTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsersTable.d.ts","sourceRoot":"","sources":["../../../../src/components/users/UsersTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAyBzC,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAChE;AAED,QAAA,MAAM,UAAU,kIASb,UAAU,sBAYZ,CAAC;eAEa,UAAU"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import usersTranslations from '../../lang/users';
|
|
3
|
+
import Table from '../tables/Table';
|
|
4
|
+
const usersTableColumns = [
|
|
5
|
+
{
|
|
6
|
+
field: 'firstName',
|
|
7
|
+
label: usersTranslations.firstName,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
field: 'lastName',
|
|
11
|
+
label: usersTranslations.lastName,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
field: 'username',
|
|
15
|
+
label: usersTranslations.username,
|
|
16
|
+
},
|
|
17
|
+
{ field: 'email', label: usersTranslations.emailColumn },
|
|
18
|
+
{
|
|
19
|
+
field: 'enabled',
|
|
20
|
+
label: usersTranslations.userEnabled,
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
const UsersTable = ({ users = [], selectedUser, setSelectedUser, onDelete, emailAsUsername = false, disableDelete = false, paginationModel, onPaginationModelChange, }) => (_jsx(Table, { rows: users, columns: usersTableColumns.filter((c) => c.field !== 'username' || !emailAsUsername), selectedRowId: selectedUser?.id, onRowClick: setSelectedUser, onDelete: disableDelete ? undefined : onDelete, paginationModel: paginationModel, onPaginationModelChange: onPaginationModelChange }));
|
|
25
|
+
export default UsersTable;
|
|
@@ -15,6 +15,6 @@ export interface UserTabsProps {
|
|
|
15
15
|
emailAsUsername?: boolean;
|
|
16
16
|
hideGroupsSelection?: boolean;
|
|
17
17
|
}
|
|
18
|
-
declare const UserTabs: ({ user, additionalTabs, onUserUpdate, editUsername, emailAsUsername, hideGroupsSelection, }: UserTabsProps) =>
|
|
18
|
+
declare const UserTabs: ({ user, additionalTabs, onUserUpdate, editUsername, emailAsUsername, hideGroupsSelection, }: UserTabsProps) => React.JSX.Element;
|
|
19
19
|
export default UserTabs;
|
|
20
20
|
//# sourceMappingURL=UsersTabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsersTabs.d.ts","sourceRoot":"","sources":["../../../../src/components/users/UsersTabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAMzC,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,iBAAiB,CAAC;IACzB,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,QAAA,MAAM,QAAQ,gGAOX,aAAa,sBAyDf,CAAC;eAEa,QAAQ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Box, Tab, Tabs } from '@mui/material';
|
|
5
|
+
import usersTranslations from '../../lang/users';
|
|
6
|
+
import UserDetails from './UserDetails';
|
|
7
|
+
import UserGroups from './UserGroups';
|
|
8
|
+
import UserCredentials from './UserCredentials';
|
|
9
|
+
import useTranslate from '../../utils/hooks/useTranslate';
|
|
10
|
+
const UserTabs = ({ user, additionalTabs = [], onUserUpdate, editUsername, emailAsUsername = false, hideGroupsSelection = false, }) => {
|
|
11
|
+
const t = useTranslate();
|
|
12
|
+
const [selectedTab, setSelectedTab] = useState('DETAILS');
|
|
13
|
+
return (_jsxs(Box, { sx: {
|
|
14
|
+
flexGrow: 1,
|
|
15
|
+
maxWidth: '100%',
|
|
16
|
+
overflowX: 'hidden',
|
|
17
|
+
alignSelf: 'stretch',
|
|
18
|
+
}, children: [_jsx(Box, { sx: { borderBottom: 1, borderColor: 'divider' }, children: _jsxs(Tabs, { value: selectedTab, onChange: (_evt, newValue) => {
|
|
19
|
+
setSelectedTab(newValue);
|
|
20
|
+
}, "aria-label": t(usersTranslations.details), children: [_jsx(Tab, { label: t(usersTranslations.details), value: 'DETAILS' }), !hideGroupsSelection && (_jsx(Tab, { label: t(usersTranslations.userGroups), value: 'USER_GROUPS' })), _jsx(Tab, { label: t(usersTranslations.credentials), value: 'CREDENTIALS' }), additionalTabs.map((tab, index) => (_jsx(Tab, { label: t(tab.title), value: `ADDITIONAL_TAB_${index}` }, `tab${index}`)))] }) }), _jsxs(Box, { sx: { p: 1 }, children: [selectedTab === 'DETAILS' && (_jsx(UserDetails, { user: user, onUserUpdate: onUserUpdate, editUsername: editUsername, emailAsUsername: emailAsUsername })), selectedTab === 'USER_GROUPS' && !hideGroupsSelection && (_jsx(UserGroups, { user: user })), selectedTab === 'CREDENTIALS' && _jsx(UserCredentials, { user: user }), additionalTabs.map((tab, index) => selectedTab === `ADDITIONAL_TAB_${index}` && (_jsx(tab.component, { user: user }, `tab${index}`)))] })] }));
|
|
21
|
+
};
|
|
22
|
+
export default UserTabs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/config/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,QAAQ,EAa/B,CAAC"}
|
|
@@ -5,7 +5,7 @@ interface ConfigProviderProps {
|
|
|
5
5
|
publicRuntimeEnv: Record<string, string>;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const ConfigProvider: ({ publicRuntimeEnv, children, }: ConfigProviderProps) =>
|
|
8
|
+
export declare const ConfigProvider: ({ publicRuntimeEnv, children, }: ConfigProviderProps) => React.JSX.Element;
|
|
9
9
|
export declare const useConfig: () => Config;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,eAAO,MAAM,SAAS,qBACF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACvC,MAKD,CAAC;AAQH,UAAU,mBAAmB;IAC3B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,oCAGxB,mBAAmB,sBAMrB,CAAC;AAEF,eAAO,MAAM,SAAS,cAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../../src/config/palette.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,sCAAsC,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,cAyC1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAsCzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/lang/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,kBAAkB,EAiCnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;eAE3B,kBAAkB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const commonTranslations = {
|
|
2
|
+
add: {
|
|
3
|
+
en: 'Add',
|
|
4
|
+
it: 'Aggiungi',
|
|
5
|
+
},
|
|
6
|
+
cancel: {
|
|
7
|
+
en: 'Cancel',
|
|
8
|
+
it: 'Annulla',
|
|
9
|
+
},
|
|
10
|
+
search: {
|
|
11
|
+
en: 'Search...',
|
|
12
|
+
it: 'Cerca...',
|
|
13
|
+
},
|
|
14
|
+
back: {
|
|
15
|
+
en: 'Back',
|
|
16
|
+
it: 'Indietro',
|
|
17
|
+
},
|
|
18
|
+
yes: {
|
|
19
|
+
en: 'Yes',
|
|
20
|
+
it: 'Si',
|
|
21
|
+
},
|
|
22
|
+
no: {
|
|
23
|
+
en: 'No',
|
|
24
|
+
it: 'No',
|
|
25
|
+
},
|
|
26
|
+
deleteTitle: {
|
|
27
|
+
en: 'Delete item?',
|
|
28
|
+
it: 'Cancellare elemento?',
|
|
29
|
+
},
|
|
30
|
+
deleteMessage: {
|
|
31
|
+
en: 'This is a permanent action',
|
|
32
|
+
it: "Questa è un'azione permanente",
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export default commonTranslations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/lang/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,kBAAkB,EAyEnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;eAE3B,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../../src/lang/home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,gBAAgB,EASjB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;eAE3B,gBAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/lang/tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,QAAA,MAAM,kBAAkB,EASnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,CAAC;eAE3B,kBAAkB"}
|