@gen-epix/ui-client-common 4.6.1 → 4.7.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/README.md +2 -2
- package/dist/_chunks/Breadcrumbs.js +4 -4
- package/dist/_chunks/CrudPage.js +166 -166
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/Notifications.js +16 -16
- package/dist/_chunks/QueryClientProvider.js +1 -1
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +73 -72
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Table.js +853 -744
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +38 -38
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +131 -131
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +12 -12
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseIteratee.js +78 -78
- package/dist/_chunks/_baseIteratee.js.map +1 -1
- package/dist/_chunks/decorate.js +1 -1
- package/dist/_chunks/decorateParam.js +1 -1
- package/dist/_chunks/middleware.js +66 -70
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/omit.js +98 -98
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/query.js +108 -92
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/tableStore.js +61 -58
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/useColumnsMenu.js +73 -71
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +2 -2
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +15 -16
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -2
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/services/AuthenticationService/index.js +8 -8
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/index.js +4 -4
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/index.js +4 -4
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/index.js +30 -30
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/index.js +15 -15
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/components/app/App/index.js +26 -24
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +18 -18
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +18 -18
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +15 -15
- package/dist/components/app/AuthorizationWrapper/index.js +16 -16
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +33 -33
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +4 -4
- package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
- package/dist/components/ui/ApplicationBar/index.js +234 -234
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +13 -13
- package/dist/components/ui/LicensesDialog/index.js +6 -6
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +11 -11
- package/dist/components/ui/OutagesDialog/index.js +4 -4
- package/dist/components/ui/OutagesDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/index.js +5 -5
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/ResponseHandler/index.js +4 -4
- package/dist/components/ui/SortableList/SortableList.d.ts +5 -3
- package/dist/components/ui/Table/Table.d.ts +5 -2
- package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +13 -2
- package/dist/components/ui/Table/index.d.ts +1 -0
- package/dist/components/ui/Table/index.js +1 -1
- package/dist/components/ui/UserFeedbackDialog/index.js +15 -15
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +11 -11
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +5 -5
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +15 -15
- package/dist/dataHooks/useOrganizationsQuery/index.js +7 -7
- package/dist/dataHooks/useUsersQuery/index.js +10 -10
- package/dist/hooks/useCreateMutation/index.js +14 -14
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/index.js +17 -17
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/index.js +22 -22
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useInitializeTableStore/index.js +6 -6
- package/dist/hooks/useInitializeTableStore/index.js.map +1 -1
- package/dist/locale/en.json +13 -5
- package/dist/locale/nl.json +13 -5
- package/dist/pages/AcceptInvitationPage/index.js +10 -10
- package/dist/pages/AdminPage/index.js +19 -19
- package/dist/pages/ChooseIdentityProviderPage/index.js +5 -5
- package/dist/pages/ErrorPage/index.js +4 -4
- package/dist/pages/IdentifierIssuersAdminPage/index.js +7 -7
- package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +16 -16
- package/dist/pages/OrganizationContactsAdminPage/index.js +10 -10
- package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationSitesAdminPage/index.js +12 -12
- package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationsAdminPage/index.js +20 -20
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +11 -11
- package/dist/pages/OutagesAdminPage/index.js.map +1 -1
- package/dist/pages/RouterErrorPage/index.js +4 -4
- package/dist/pages/UsersAdminPage/index.js +34 -34
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/setup/setup.js +4 -4
- package/dist/setup/setup.js.map +1 -1
- package/dist/stores/oidcStore/oidcStore.d.ts +1 -1
- package/dist/utils/StandardConfigUtil/index.js +2 -2
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/package.json +33 -33
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { API_ORGANIZATION_TOKEN as e } from "../../constants/api.constants.js";
|
|
2
|
+
import { useOrganizationOptionsQuery as t } from "../../dataHooks/useOrganizationsQuery/index.js";
|
|
3
|
+
import { t as n } from "../../_chunks/TableUtil.js";
|
|
4
|
+
import { t as r } from "../../_chunks/CrudPage.js";
|
|
5
|
+
import { AuthorizationService as i } from "../../classes/services/AuthorizationService/index.js";
|
|
6
|
+
import { useInviteUserConstraintsQuery as a } from "../../dataHooks/useInviteUserConstraintsQuery/index.js";
|
|
7
7
|
import { COMMON_QUERY_KEY as o } from "../../constants/query.constants.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { NotificationService as s } from "../../classes/services/NotificationService/index.js";
|
|
9
|
+
import { t as c } from "../../_chunks/QueryClientService.js";
|
|
10
10
|
import { container as l } from "tsyringe";
|
|
11
11
|
import { CommonDbCommandName as u, CommonDbPermissionType as d } from "@gen-epix/api-commondb";
|
|
12
12
|
import { ListItemIcon as f, ListItemText as p, MenuItem as m } from "@mui/material";
|
|
@@ -22,35 +22,35 @@ import j from "@mui/icons-material/PersonOff";
|
|
|
22
22
|
import { Confirmation as M } from "@gen-epix/ui-core-components/components/Confirmation";
|
|
23
23
|
// src/pages/UsersAdminPage/UsersAdminPage.tsx
|
|
24
24
|
var N = ({ subPages: N }) => {
|
|
25
|
-
let { t: P } = S(), F = _(null), I =
|
|
25
|
+
let { t: P } = S(), F = _(null), I = t(), L = a(), [R, z] = v([]), [B, V] = v([]), H = _(null), U = A([I, L]), W = l.resolve(i).user.roles, G = h((e) => {
|
|
26
26
|
let t = /* @__PURE__ */ new Set();
|
|
27
27
|
e.forEach((e) => {
|
|
28
28
|
e.roles.forEach((e) => t.add(e));
|
|
29
29
|
});
|
|
30
|
-
let
|
|
30
|
+
let n = Array.from(t).map((e) => ({
|
|
31
31
|
label: e,
|
|
32
32
|
value: e
|
|
33
33
|
}));
|
|
34
|
-
z(
|
|
35
|
-
let
|
|
36
|
-
|
|
34
|
+
z(n);
|
|
35
|
+
let r;
|
|
36
|
+
r = l.resolve(i).doesUserHavePermission([{
|
|
37
37
|
command_name: u.RetrieveInviteUserConstraintsCommand,
|
|
38
38
|
permission_type: d.EXECUTE
|
|
39
39
|
}]) && L?.data ? L.data.roles.map((e) => ({
|
|
40
40
|
label: e,
|
|
41
41
|
value: e
|
|
42
|
-
})) :
|
|
43
|
-
let a = W.filter((e) => !
|
|
44
|
-
|
|
42
|
+
})) : n;
|
|
43
|
+
let a = W.filter((e) => !r.some((t) => t.value === e));
|
|
44
|
+
r.push(...a.map((e) => ({
|
|
45
45
|
disabled: !0,
|
|
46
46
|
label: e,
|
|
47
47
|
value: e
|
|
48
|
-
}))), V(
|
|
49
|
-
}, [L.data, W]), K = h(async (
|
|
50
|
-
is_active:
|
|
48
|
+
}))), V(r);
|
|
49
|
+
}, [L.data, W]), K = h(async (t) => (await l.resolve(e).usersGetAll(null, null, { signal: t }))?.data, []), q = h(async (t, n) => (await l.resolve(e).updateUser(n.id, {
|
|
50
|
+
is_active: t.is_active,
|
|
51
51
|
organization_id: n.organization_id,
|
|
52
|
-
roles:
|
|
53
|
-
})).data, []), J = h(async (
|
|
52
|
+
roles: t.roles
|
|
53
|
+
})).data, []), J = h(async (t) => await l.resolve(e).usersDeleteOne(t.id), []), Y = h((e) => e.email, []), X = h((e) => l.resolve(i).user.email !== e.email, []), Z = g(() => T().shape({
|
|
54
54
|
description: k.description,
|
|
55
55
|
email: E().email().nullable(),
|
|
56
56
|
is_active: w().required(),
|
|
@@ -97,34 +97,34 @@ var N = ({ subPages: N }) => {
|
|
|
97
97
|
B,
|
|
98
98
|
L.isLoading
|
|
99
99
|
]), $ = g(() => [
|
|
100
|
-
|
|
100
|
+
n.createOptionsColumn({
|
|
101
101
|
id: "organization_id",
|
|
102
102
|
name: P`Organization`,
|
|
103
103
|
options: I.options
|
|
104
104
|
}),
|
|
105
|
-
|
|
105
|
+
n.createTextColumn({
|
|
106
106
|
id: "key",
|
|
107
107
|
name: P`Key`
|
|
108
108
|
}),
|
|
109
|
-
|
|
109
|
+
n.createTextColumn({
|
|
110
110
|
id: "email",
|
|
111
111
|
name: P`E-Mail`
|
|
112
112
|
}),
|
|
113
|
-
|
|
113
|
+
n.createTextColumn({
|
|
114
114
|
advancedSort: !0,
|
|
115
115
|
id: "name",
|
|
116
116
|
name: P`Name`
|
|
117
117
|
}),
|
|
118
|
-
|
|
118
|
+
n.createTextColumn({
|
|
119
119
|
id: "description",
|
|
120
120
|
name: P`Description`
|
|
121
121
|
}),
|
|
122
|
-
|
|
122
|
+
n.createOptionsColumn({
|
|
123
123
|
id: "roles",
|
|
124
124
|
name: P`Roles`,
|
|
125
125
|
options: R
|
|
126
126
|
}),
|
|
127
|
-
|
|
127
|
+
n.createBooleanColumn({
|
|
128
128
|
id: "is_active",
|
|
129
129
|
name: P`Is active`
|
|
130
130
|
})
|
|
@@ -147,19 +147,19 @@ var N = ({ subPages: N }) => {
|
|
|
147
147
|
command_name: u.UserCrudCommand,
|
|
148
148
|
permission_type: d.DELETE
|
|
149
149
|
}], []), re = h(async () => {
|
|
150
|
-
let
|
|
150
|
+
let t = H.current?.email ?? H.current?.key, n = l.resolve(s).showNotification({
|
|
151
151
|
isLoading: !0,
|
|
152
|
-
message: P("Anonymizing user: {{userName}}", { userName:
|
|
152
|
+
message: P("Anonymizing user: {{userName}}", { userName: t }),
|
|
153
153
|
severity: "info"
|
|
154
154
|
});
|
|
155
155
|
try {
|
|
156
|
-
await l.resolve(
|
|
156
|
+
await l.resolve(e).anonymizeUser(H.current.id), await l.resolve(c).invalidateQueryKeys(l.resolve(c).getQueryKeyDependencies([o.USERS], !0)), l.resolve(s).fulfillNotification(n, P("User anonymized successfully: {{userName}}", { userName: t }), "success");
|
|
157
157
|
} catch {
|
|
158
|
-
l.resolve(
|
|
158
|
+
l.resolve(s).fulfillNotification(n, P("Error anonymizing user: {{userName}}", { userName: t }), "error");
|
|
159
159
|
}
|
|
160
160
|
}, [P]), ie = h((e) => {
|
|
161
161
|
let t = [];
|
|
162
|
-
return l.resolve(
|
|
162
|
+
return l.resolve(i).doesUserHavePermission([{
|
|
163
163
|
command_name: u.AnonymizeUserCommand,
|
|
164
164
|
permission_type: d.EXECUTE
|
|
165
165
|
}]) && t.push(/* @__PURE__ */ x(m, {
|
|
@@ -169,7 +169,7 @@ var N = ({ subPages: N }) => {
|
|
|
169
169
|
children: [/* @__PURE__ */ b(f, { children: /* @__PURE__ */ b(j, { fontSize: "small" }) }), /* @__PURE__ */ b(p, { children: P`Anonymize user` })]
|
|
170
170
|
}, "custom-action-1")), t;
|
|
171
171
|
}, [P]);
|
|
172
|
-
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(
|
|
172
|
+
return /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(r, {
|
|
173
173
|
canEditItem: X,
|
|
174
174
|
createItemDialogTitle: P`Create new user`,
|
|
175
175
|
defaultSortByField: "name",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","TableUtil","QueryClientService","CrudPage","Fragment$1","PersonOffIcon","UsersAdminPage","useTranslation","anonymizeUserConfirmationRef","useRef","organizationOptionsQuery","useOrganizationOptionsQuery","inviteUserConstraintsQuery","useInviteUserConstraintsQuery","tableRoleOptions","setTableRoleOptions","useState","formRoleOptions","setFormRoleOptions","selectedUserRef","loadables","useArray","userRoles","container","AuthorizationService","onRowsChange","useCallback","roles","role","_tableRoleOptions","_formRoleOptions","CommonDbCommandName","CommonDbPermissionType","extraRolesFromUser","option","fetchAll","API_ORGANIZATION_TOKEN","updateOne","item","variables","deleteOne","getName","canEditItem","schema","useMemo","object","SchemaUtil","string","boolean","array","formFieldDefinitions","FORM_FIELD_DEFINITION_TYPE","t","tableColumns","getOptimisticUpdateIntermediateItem","previousItem","extraUpdateOnePermissions","extraDeleteOnePermissions","onAnonymizeUserConfirmationConfirm","userName","notificationId","NotificationService","COMMON_QUERY_KEY","extraActionsFactory","menuItems","MenuItem","params","ListItemIcon","ListItemText","TestIdUtil","Confirmation"],"sources":["../../../src/pages/UsersAdminPage/UsersAdminPage.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n array,\n boolean,\n object,\n string,\n} from 'yup';\nimport type {\n CommonDbApiPermission,\n CommonDbUser,\n} from '@gen-epix/api-commondb';\nimport {\n CommonDbCommandName,\n CommonDbPermissionType,\n} from '@gen-epix/api-commondb';\nimport {\n ListItemIcon,\n ListItemText,\n MenuItem,\n} from '@mui/material';\nimport PersonOffIcon from '@mui/icons-material/PersonOff';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport type {\n FormFieldDefinition,\n OptionBase,\n} from '@gen-epix/ui-core-form/models/form.models';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form.models';\nimport { SchemaUtil } from '@gen-epix/ui-core-form/utils/SchemaUtil';\nimport type { ConfirmationRefMethods } from '@gen-epix/ui-core-components/components/Confirmation';\nimport { Confirmation } from '@gen-epix/ui-core-components/components/Confirmation';\n\nimport { API_ORGANIZATION_TOKEN } from '../../constants/api.constants';\nimport { useOrganizationOptionsQuery } from '../../dataHooks/useOrganizationsQuery';\nimport type {\n TableColumn,\n TableRowParams,\n} from '../../models/table.models';\nimport { TableUtil } from '../../utils/TableUtil';\nimport type { CrudPageProps } from '../CrudPage';\nimport { CrudPage } from '../CrudPage';\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\nimport { useInviteUserConstraintsQuery } from '../../dataHooks/useInviteUserConstraintsQuery';\nimport type { OmitWithMetaData } from '../../models/data.models';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UsersAdminPageProps = {\n subPages?: CrudPageProps<OmitWithMetaData<CommonDbUser, 'organization_id' | 'organization'>, CommonDbUser>['subPages'];\n};\n\ntype FormFields = OmitWithMetaData<CommonDbUser, 'organization_id' | 'organization'>;\n\nexport const UsersAdminPage = ({\n subPages,\n}: UsersAdminPageProps) => {\n const { t } = useTranslation();\n const anonymizeUserConfirmationRef = useRef<ConfirmationRefMethods>(null);\n const organizationOptionsQuery = useOrganizationOptionsQuery();\n const inviteUserConstraintsQuery = useInviteUserConstraintsQuery();\n const [tableRoleOptions, setTableRoleOptions] = useState<OptionBase<string>[]>([]);\n const [formRoleOptions, setFormRoleOptions] = useState<OptionBase<string>[]>([]);\n const selectedUserRef = useRef<CommonDbUser | null>(null);\n\n const loadables = useArray([\n organizationOptionsQuery,\n inviteUserConstraintsQuery,\n ]);\n\n const userRoles = container.resolve(AuthorizationService).user.roles;\n\n const onRowsChange = useCallback((items: CommonDbUser[]) => {\n // Because roles are a string array (instead of an enum or similar), we need to dynamically determine the options for the roles column in the table and in the form.\n // The options for the form are determined by the invite user constraints endpoint, but if the user doesn't have access to that endpoint, we fall back to using the roles that are currently in use by users in the system.\n const roles = new Set<string>();\n items.forEach((user) => {\n user.roles.forEach((role) => roles.add(role));\n });\n const _tableRoleOptions = Array.from(roles).map((role) => ({\n label: role,\n value: role,\n }));\n setTableRoleOptions(_tableRoleOptions);\n let _formRoleOptions: OptionBase<string>[];\n if (container.resolve(AuthorizationService).doesUserHavePermission([\n { command_name: CommonDbCommandName.RetrieveInviteUserConstraintsCommand, permission_type: CommonDbPermissionType.EXECUTE },\n ])) {\n _formRoleOptions = inviteUserConstraintsQuery?.data ? inviteUserConstraintsQuery.data.roles.map(role => ({\n label: role,\n value: role,\n })) : _tableRoleOptions;\n } else {\n _formRoleOptions = _tableRoleOptions;\n }\n // The users own roles may not be included in the options from the invite user constraints endpoint (if they don't have permission to view that endpoint),\n // so we need to add those to the options as well, but disable them since the user doesn't have permission to assign those roles to other users.\n const extraRolesFromUser = userRoles.filter(role => !_formRoleOptions.some(option => option.value === role));\n _formRoleOptions.push(...extraRolesFromUser.map(role => ({\n disabled: true,\n label: role,\n value: role,\n })));\n setFormRoleOptions(_formRoleOptions);\n }, [inviteUserConstraintsQuery.data, userRoles]);\n\n const fetchAll = useCallback(async (signal: AbortSignal) => {\n const users = (await container.resolve(API_ORGANIZATION_TOKEN).usersGetAll(null, null, { signal }))?.data;\n\n return users;\n }, []);\n\n const updateOne = useCallback(async (variables: FormFields, item: CommonDbUser) => {\n return (await container.resolve(API_ORGANIZATION_TOKEN).updateUser(item.id, {\n is_active: variables.is_active,\n organization_id: item.organization_id,\n roles: variables.roles,\n })).data;\n }, []);\n\n const deleteOne = useCallback(async (item: CommonDbUser) => {\n return await container.resolve(API_ORGANIZATION_TOKEN).usersDeleteOne(item.id);\n }, []);\n\n const getName = useCallback((item: FormFields) => {\n return item.email;\n }, []);\n\n const canEditItem = useCallback((item: CommonDbUser) => {\n return container.resolve(AuthorizationService).user.email !== item.email;\n }, []);\n\n const schema = useMemo(() => {\n return object<FormFields>().shape({\n description: SchemaUtil.description,\n email: string().email().nullable(),\n is_active: boolean().required(),\n key: string().optional(),\n name: string().nullable(),\n roles: array().required().min(1),\n });\n }, []);\n\n const formFieldDefinitions = useMemo<FormFieldDefinition<FormFields>[]>(() => {\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n disabled: true,\n label: t`Key`,\n name: 'key',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Email`,\n name: 'email',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Name`,\n name: 'name',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n label: t`Roles`,\n loading: inviteUserConstraintsQuery.isLoading,\n multiple: true,\n name: 'roles',\n options: formRoleOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.BOOLEAN,\n label: t`Is active`,\n name: 'is_active',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Description`,\n name: 'description',\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const;\n }, [t, formRoleOptions, inviteUserConstraintsQuery.isLoading]);\n\n const tableColumns = useMemo((): TableColumn<CommonDbUser>[] => {\n return [\n TableUtil.createOptionsColumn<CommonDbUser>({ id: 'organization_id', name: t`Organization`, options: organizationOptionsQuery.options }),\n TableUtil.createTextColumn<CommonDbUser>({ id: 'key', name: t`Key` }),\n TableUtil.createTextColumn<CommonDbUser>({ id: 'email', name: t`E-Mail` }),\n TableUtil.createTextColumn<CommonDbUser>({ advancedSort: true, id: 'name', name: t`Name` }),\n TableUtil.createTextColumn<CommonDbUser>({ id: 'description', name: t`Description` }),\n TableUtil.createOptionsColumn<CommonDbUser>({ id: 'roles', name: t`Roles`, options: tableRoleOptions }),\n TableUtil.createBooleanColumn<CommonDbUser>({ id: 'is_active', name: t`Is active` }),\n ];\n }, [organizationOptionsQuery.options, tableRoleOptions, t]);\n\n const getOptimisticUpdateIntermediateItem = useCallback((variables: FormFields, previousItem: CommonDbUser): CommonDbUser => {\n return {\n email: previousItem.email,\n id: previousItem.id,\n is_active: previousItem.is_active,\n key: previousItem.email,\n name: previousItem.name,\n organization_id: previousItem.organization_id,\n ...variables,\n };\n }, []);\n\n const extraUpdateOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.UpdateUserCommand, permission_type: CommonDbPermissionType.EXECUTE },\n ], []);\n const extraDeleteOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.UserCrudCommand, permission_type: CommonDbPermissionType.DELETE },\n ], []);\n\n const onAnonymizeUserConfirmationConfirm = useCallback(async () => {\n const userName = selectedUserRef.current?.email ?? selectedUserRef.current?.key;\n const notificationId = container.resolve(NotificationService).showNotification({\n isLoading: true,\n message: t('Anonymizing user: {{userName}}', { userName }),\n severity: 'info',\n });\n try {\n // Anonymize the user\n await container.resolve(API_ORGANIZATION_TOKEN).anonymizeUser(selectedUserRef.current.id);\n // Invalidate the users query key so that the users list is refreshed and the anonymized user is no longer visible in the list.\n await container.resolve(QueryClientService).invalidateQueryKeys(\n container.resolve(QueryClientService).getQueryKeyDependencies([COMMON_QUERY_KEY.USERS], true),\n );\n container.resolve(NotificationService).fulfillNotification(notificationId, t('User anonymized successfully: {{userName}}', { userName }), 'success');\n } catch (_error) {\n container.resolve(NotificationService).fulfillNotification(notificationId, t('Error anonymizing user: {{userName}}', { userName }), 'error');\n }\n }, [t]);\n\n const extraActionsFactory = useCallback((params: TableRowParams<CommonDbUser, null>) => {\n const menuItems: ReactElement[] = [];\n\n if (container.resolve(AuthorizationService).doesUserHavePermission([\n { command_name: CommonDbCommandName.AnonymizeUserCommand, permission_type: CommonDbPermissionType.EXECUTE },\n ])) {\n menuItems.push(\n <MenuItem\n key={'custom-action-1'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => {\n selectedUserRef.current = params.row;\n anonymizeUserConfirmationRef.current.open();\n }}\n >\n <ListItemIcon>\n <PersonOffIcon fontSize={'small'} />\n </ListItemIcon>\n <ListItemText>\n {t`Anonymize user`}\n </ListItemText>\n </MenuItem>,\n );\n }\n\n return menuItems;\n }, [t]);\n\n return (\n <>\n <CrudPage<FormFields, CommonDbUser>\n canEditItem={canEditItem}\n createItemDialogTitle={t`Create new user`}\n defaultSortByField={'name'}\n defaultSortDirection={'asc'}\n deleteOne={deleteOne}\n extraActionsFactory={extraActionsFactory}\n extraDeleteOnePermissions={extraDeleteOnePermissions}\n extraUpdateOnePermissions={extraUpdateOnePermissions}\n fetchAll={fetchAll}\n formFieldDefinitions={formFieldDefinitions}\n getName={getName}\n getOptimisticUpdateIntermediateItem={getOptimisticUpdateIntermediateItem}\n itemName={t`User`}\n loadables={loadables}\n onRowsChange={onRowsChange}\n resourceQueryKeyBase={COMMON_QUERY_KEY.USERS}\n schema={schema}\n subPages={subPages}\n tableColumns={tableColumns}\n testIdAttributes={TestIdUtil.createAttributes('UsersAdminPage')}\n title={t`Users`}\n updateOne={updateOne}\n />\n <Confirmation\n body={t`Click the anonymize button to anonymize the user`}\n cancelLabel={t`Cancel`}\n confirmLabel={t`Anonymize`}\n onConfirm={onAnonymizeUserConfirmationConfirm}\n ref={anonymizeUserConfirmationRef}\n title={t`Are you sure you want to anonymize this user?`}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAaM,KAAkB,EAC7B,kBACyB;CACzB,IAAM,EAAE,SAAMC,EAAe,GACvBC,IAA+BC,EAA+B,IAAI,GA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Z,CAAA,GACD,kBAACC,GAAD;EACE,MAAM,CAAC;EACP,aAAa,CAAC;EACd,cAAc,CAAC;EACf,WAAWZ;EACX,KAAKlD;EACL,OAAO,CAAC;CACT,CAAA,CACD,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","TableUtil","CrudPage","QueryClientService","Fragment$1","PersonOffIcon","UsersAdminPage","useTranslation","anonymizeUserConfirmationRef","useRef","organizationOptionsQuery","useOrganizationOptionsQuery","inviteUserConstraintsQuery","useInviteUserConstraintsQuery","tableRoleOptions","setTableRoleOptions","useState","formRoleOptions","setFormRoleOptions","selectedUserRef","loadables","useArray","userRoles","container","AuthorizationService","onRowsChange","useCallback","roles","role","_tableRoleOptions","_formRoleOptions","CommonDbCommandName","CommonDbPermissionType","extraRolesFromUser","option","fetchAll","API_ORGANIZATION_TOKEN","updateOne","item","variables","deleteOne","getName","canEditItem","schema","useMemo","object","SchemaUtil","string","boolean","array","formFieldDefinitions","FORM_FIELD_DEFINITION_TYPE","t","tableColumns","getOptimisticUpdateIntermediateItem","previousItem","extraUpdateOnePermissions","extraDeleteOnePermissions","onAnonymizeUserConfirmationConfirm","userName","notificationId","NotificationService","COMMON_QUERY_KEY","extraActionsFactory","menuItems","MenuItem","params","ListItemIcon","ListItemText","TestIdUtil","Confirmation"],"sources":["../../../src/pages/UsersAdminPage/UsersAdminPage.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n array,\n boolean,\n object,\n string,\n} from 'yup';\nimport type {\n CommonDbApiPermission,\n CommonDbUser,\n} from '@gen-epix/api-commondb';\nimport {\n CommonDbCommandName,\n CommonDbPermissionType,\n} from '@gen-epix/api-commondb';\nimport {\n ListItemIcon,\n ListItemText,\n MenuItem,\n} from '@mui/material';\nimport PersonOffIcon from '@mui/icons-material/PersonOff';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport type {\n FormFieldDefinition,\n OptionBase,\n} from '@gen-epix/ui-core-form/models/form.models';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form.models';\nimport { SchemaUtil } from '@gen-epix/ui-core-form/utils/SchemaUtil';\nimport type { ConfirmationRefMethods } from '@gen-epix/ui-core-components/components/Confirmation';\nimport { Confirmation } from '@gen-epix/ui-core-components/components/Confirmation';\n\nimport { API_ORGANIZATION_TOKEN } from '../../constants/api.constants';\nimport { useOrganizationOptionsQuery } from '../../dataHooks/useOrganizationsQuery';\nimport type {\n TableColumn,\n TableRowParams,\n} from '../../models/table.models';\nimport { TableUtil } from '../../utils/TableUtil';\nimport type { CrudPageProps } from '../CrudPage';\nimport { CrudPage } from '../CrudPage';\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\nimport { useInviteUserConstraintsQuery } from '../../dataHooks/useInviteUserConstraintsQuery';\nimport type { OmitWithMetaData } from '../../models/data.models';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UsersAdminPageProps = {\n subPages?: CrudPageProps<OmitWithMetaData<CommonDbUser, 'organization_id' | 'organization'>, CommonDbUser>['subPages'];\n};\n\ntype FormFields = OmitWithMetaData<CommonDbUser, 'organization_id' | 'organization'>;\n\nexport const UsersAdminPage = ({\n subPages,\n}: UsersAdminPageProps) => {\n const { t } = useTranslation();\n const anonymizeUserConfirmationRef = useRef<ConfirmationRefMethods>(null);\n const organizationOptionsQuery = useOrganizationOptionsQuery();\n const inviteUserConstraintsQuery = useInviteUserConstraintsQuery();\n const [tableRoleOptions, setTableRoleOptions] = useState<OptionBase<string>[]>([]);\n const [formRoleOptions, setFormRoleOptions] = useState<OptionBase<string>[]>([]);\n const selectedUserRef = useRef<CommonDbUser | null>(null);\n\n const loadables = useArray([\n organizationOptionsQuery,\n inviteUserConstraintsQuery,\n ]);\n\n const userRoles = container.resolve(AuthorizationService).user.roles;\n\n const onRowsChange = useCallback((items: CommonDbUser[]) => {\n // Because roles are a string array (instead of an enum or similar), we need to dynamically determine the options for the roles column in the table and in the form.\n // The options for the form are determined by the invite user constraints endpoint, but if the user doesn't have access to that endpoint, we fall back to using the roles that are currently in use by users in the system.\n const roles = new Set<string>();\n items.forEach((user) => {\n user.roles.forEach((role) => roles.add(role));\n });\n const _tableRoleOptions = Array.from(roles).map((role) => ({\n label: role,\n value: role,\n }));\n setTableRoleOptions(_tableRoleOptions);\n let _formRoleOptions: OptionBase<string>[];\n if (container.resolve(AuthorizationService).doesUserHavePermission([\n { command_name: CommonDbCommandName.RetrieveInviteUserConstraintsCommand, permission_type: CommonDbPermissionType.EXECUTE },\n ])) {\n _formRoleOptions = inviteUserConstraintsQuery?.data ? inviteUserConstraintsQuery.data.roles.map(role => ({\n label: role,\n value: role,\n })) : _tableRoleOptions;\n } else {\n _formRoleOptions = _tableRoleOptions;\n }\n // The users own roles may not be included in the options from the invite user constraints endpoint (if they don't have permission to view that endpoint),\n // so we need to add those to the options as well, but disable them since the user doesn't have permission to assign those roles to other users.\n const extraRolesFromUser = userRoles.filter(role => !_formRoleOptions.some(option => option.value === role));\n _formRoleOptions.push(...extraRolesFromUser.map(role => ({\n disabled: true,\n label: role,\n value: role,\n })));\n setFormRoleOptions(_formRoleOptions);\n }, [inviteUserConstraintsQuery.data, userRoles]);\n\n const fetchAll = useCallback(async (signal: AbortSignal) => {\n const users = (await container.resolve(API_ORGANIZATION_TOKEN).usersGetAll(null, null, { signal }))?.data;\n\n return users;\n }, []);\n\n const updateOne = useCallback(async (variables: FormFields, item: CommonDbUser) => {\n return (await container.resolve(API_ORGANIZATION_TOKEN).updateUser(item.id, {\n is_active: variables.is_active,\n organization_id: item.organization_id,\n roles: variables.roles,\n })).data;\n }, []);\n\n const deleteOne = useCallback(async (item: CommonDbUser) => {\n return await container.resolve(API_ORGANIZATION_TOKEN).usersDeleteOne(item.id);\n }, []);\n\n const getName = useCallback((item: FormFields) => {\n return item.email;\n }, []);\n\n const canEditItem = useCallback((item: CommonDbUser) => {\n return container.resolve(AuthorizationService).user.email !== item.email;\n }, []);\n\n const schema = useMemo(() => {\n return object<FormFields>().shape({\n description: SchemaUtil.description,\n email: string().email().nullable(),\n is_active: boolean().required(),\n key: string().optional(),\n name: string().nullable(),\n roles: array().required().min(1),\n });\n }, []);\n\n const formFieldDefinitions = useMemo<FormFieldDefinition<FormFields>[]>(() => {\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n disabled: true,\n label: t`Key`,\n name: 'key',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Email`,\n name: 'email',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Name`,\n name: 'name',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n label: t`Roles`,\n loading: inviteUserConstraintsQuery.isLoading,\n multiple: true,\n name: 'roles',\n options: formRoleOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.BOOLEAN,\n label: t`Is active`,\n name: 'is_active',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Description`,\n name: 'description',\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const;\n }, [t, formRoleOptions, inviteUserConstraintsQuery.isLoading]);\n\n const tableColumns = useMemo((): TableColumn<CommonDbUser>[] => {\n return [\n TableUtil.createOptionsColumn<CommonDbUser>({ id: 'organization_id', name: t`Organization`, options: organizationOptionsQuery.options }),\n TableUtil.createTextColumn<CommonDbUser>({ id: 'key', name: t`Key` }),\n TableUtil.createTextColumn<CommonDbUser>({ id: 'email', name: t`E-Mail` }),\n TableUtil.createTextColumn<CommonDbUser>({ advancedSort: true, id: 'name', name: t`Name` }),\n TableUtil.createTextColumn<CommonDbUser>({ id: 'description', name: t`Description` }),\n TableUtil.createOptionsColumn<CommonDbUser>({ id: 'roles', name: t`Roles`, options: tableRoleOptions }),\n TableUtil.createBooleanColumn<CommonDbUser>({ id: 'is_active', name: t`Is active` }),\n ];\n }, [organizationOptionsQuery.options, tableRoleOptions, t]);\n\n const getOptimisticUpdateIntermediateItem = useCallback((variables: FormFields, previousItem: CommonDbUser): CommonDbUser => {\n return {\n email: previousItem.email,\n id: previousItem.id,\n is_active: previousItem.is_active,\n key: previousItem.email,\n name: previousItem.name,\n organization_id: previousItem.organization_id,\n ...variables,\n };\n }, []);\n\n const extraUpdateOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.UpdateUserCommand, permission_type: CommonDbPermissionType.EXECUTE },\n ], []);\n const extraDeleteOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.UserCrudCommand, permission_type: CommonDbPermissionType.DELETE },\n ], []);\n\n const onAnonymizeUserConfirmationConfirm = useCallback(async () => {\n const userName = selectedUserRef.current?.email ?? selectedUserRef.current?.key;\n const notificationId = container.resolve(NotificationService).showNotification({\n isLoading: true,\n message: t('Anonymizing user: {{userName}}', { userName }),\n severity: 'info',\n });\n try {\n // Anonymize the user\n await container.resolve(API_ORGANIZATION_TOKEN).anonymizeUser(selectedUserRef.current.id);\n // Invalidate the users query key so that the users list is refreshed and the anonymized user is no longer visible in the list.\n await container.resolve(QueryClientService).invalidateQueryKeys(\n container.resolve(QueryClientService).getQueryKeyDependencies([COMMON_QUERY_KEY.USERS], true),\n );\n container.resolve(NotificationService).fulfillNotification(notificationId, t('User anonymized successfully: {{userName}}', { userName }), 'success');\n } catch (_error) {\n container.resolve(NotificationService).fulfillNotification(notificationId, t('Error anonymizing user: {{userName}}', { userName }), 'error');\n }\n }, [t]);\n\n const extraActionsFactory = useCallback((params: TableRowParams<CommonDbUser, null>) => {\n const menuItems: ReactElement[] = [];\n\n if (container.resolve(AuthorizationService).doesUserHavePermission([\n { command_name: CommonDbCommandName.AnonymizeUserCommand, permission_type: CommonDbPermissionType.EXECUTE },\n ])) {\n menuItems.push(\n <MenuItem\n key={'custom-action-1'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => {\n selectedUserRef.current = params.row;\n anonymizeUserConfirmationRef.current.open();\n }}\n >\n <ListItemIcon>\n <PersonOffIcon fontSize={'small'} />\n </ListItemIcon>\n <ListItemText>\n {t`Anonymize user`}\n </ListItemText>\n </MenuItem>,\n );\n }\n\n return menuItems;\n }, [t]);\n\n return (\n <>\n <CrudPage<FormFields, CommonDbUser>\n canEditItem={canEditItem}\n createItemDialogTitle={t`Create new user`}\n defaultSortByField={'name'}\n defaultSortDirection={'asc'}\n deleteOne={deleteOne}\n extraActionsFactory={extraActionsFactory}\n extraDeleteOnePermissions={extraDeleteOnePermissions}\n extraUpdateOnePermissions={extraUpdateOnePermissions}\n fetchAll={fetchAll}\n formFieldDefinitions={formFieldDefinitions}\n getName={getName}\n getOptimisticUpdateIntermediateItem={getOptimisticUpdateIntermediateItem}\n itemName={t`User`}\n loadables={loadables}\n onRowsChange={onRowsChange}\n resourceQueryKeyBase={COMMON_QUERY_KEY.USERS}\n schema={schema}\n subPages={subPages}\n tableColumns={tableColumns}\n testIdAttributes={TestIdUtil.createAttributes('UsersAdminPage')}\n title={t`Users`}\n updateOne={updateOne}\n />\n <Confirmation\n body={t`Click the anonymize button to anonymize the user`}\n cancelLabel={t`Cancel`}\n confirmLabel={t`Anonymize`}\n onConfirm={onAnonymizeUserConfirmationConfirm}\n ref={anonymizeUserConfirmationRef}\n title={t`Are you sure you want to anonymize this user?`}\n />\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8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AsB4D,EAAiB;EAC/B;EACE;EACI;EACd,kBAAkBO,EAAW,iBAAiB,gBAAgB;EAC9D,OAAO,CAAC;EACG;CACZ,CAAA,GACD,kBAACC,GAAD;EACE,MAAM,CAAC;EACP,aAAa,CAAC;EACd,cAAc,CAAC;EACf,WAAWZ;EACX,KAAKlD;EACL,OAAO,CAAC;CACT,CAAA,CACD,EAAA,CAAA;AAEN"}
|
package/dist/setup/setup.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../
|
|
1
|
+
import { t as e } from "../_chunks/QueryClientService.js";
|
|
2
|
+
import { CONFIG_TOKEN as t } from "../constants/config.constants.js";
|
|
3
3
|
import { container as n } from "tsyringe";
|
|
4
4
|
import { setupUiCoreForm as r } from "@gen-epix/ui-core-form/setup/setup";
|
|
5
5
|
import { setupUiCore as i } from "@gen-epix/ui-core/setup/setup";
|
|
6
6
|
// src/setup/setup.ts
|
|
7
7
|
var a = () => {
|
|
8
|
-
i(), r(), n.register(
|
|
9
|
-
config: n.resolve(
|
|
8
|
+
i(), r(), n.register(e, { useFactory: () => new e({
|
|
9
|
+
config: n.resolve(t),
|
|
10
10
|
queryKeyDependencies: []
|
|
11
11
|
}) });
|
|
12
12
|
};
|
package/dist/setup/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","names":["setupClientCommon","setupUiCore","setupUiCoreForm","container","
|
|
1
|
+
{"version":3,"file":"setup.js","names":["QueryClientService","setupClientCommon","setupUiCore","setupUiCoreForm","container","CONFIG_TOKEN"],"sources":["../../src/setup/setup.ts"],"sourcesContent":["import { setupUiCoreForm } from '@gen-epix/ui-core-form/setup/setup';\nimport { setupUiCore } from '@gen-epix/ui-core/setup/setup';\nimport { container } from 'tsyringe';\n\nimport { QueryClientService } from '../classes/services/QueryClientService';\nimport { CONFIG_TOKEN } from '../constants/config.constants';\n\n\nexport const setupClientCommon = () => {\n setupUiCore();\n setupUiCoreForm();\n\n container.register(QueryClientService, {\n // eslint-disable-next-line @eslint-react/no-unnecessary-use-prefix\n useFactory: () => new QueryClientService({\n config: container.resolve(CONFIG_TOKEN),\n queryKeyDependencies: [],\n }),\n });\n};\n"],"mappings":";;;;;;AAQA,IAAaC,UAA0B;CAIrC,AAHAC,EAAY,GACZC,EAAgB,GAEhBC,EAAU,SAASJ,GAAoB,EAErC,kBAAkB,IAAIA,EAAmB;EACvC,QAAQI,EAAU,QAAQC,CAAY;EACtC,sBAAsB,CAAC;CACzB,CAAC,EACH,CAAC;AACH"}
|
|
@@ -13,7 +13,7 @@ export declare const oidcStore: Omit<import('zustand').StoreApi<OidcStore>, "per
|
|
|
13
13
|
persist: {
|
|
14
14
|
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<OidcStore, unknown, unknown>>) => void;
|
|
15
15
|
clearStorage: () => void;
|
|
16
|
-
rehydrate: () => Promise<void
|
|
16
|
+
rehydrate: () => Promise<void>;
|
|
17
17
|
hasHydrated: () => boolean;
|
|
18
18
|
onHydrate: (fn: (state: OidcStore) => void) => () => void;
|
|
19
19
|
onFinishHydration: (fn: (state: OidcStore) => void) => () => void;
|
|
@@ -55,8 +55,8 @@ var t = () => null, n = () => null, r = () => null, i = () => null, a = class {
|
|
|
55
55
|
},
|
|
56
56
|
table: {
|
|
57
57
|
CONDENSED_WIDTH_PX: 150,
|
|
58
|
-
DEFAULT_OVERSCAN_MAIN:
|
|
59
|
-
DEFAULT_OVERSCAN_REVERSE:
|
|
58
|
+
DEFAULT_OVERSCAN_MAIN: 30,
|
|
59
|
+
DEFAULT_OVERSCAN_REVERSE: 30
|
|
60
60
|
},
|
|
61
61
|
userFeedback: { SHOW_USER_FEEDBACK_TOOLTIP_AFTER_MS: 12e4 },
|
|
62
62
|
userInactivityConfirmation: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ApplicationHeader","ConsentDialogContent","HomePageIntroduction","LicenseInformation","StandardConfigUtil","AxiosUtil","error","failureCount","attempt"],"sources":["../../../src/utils/StandardConfigUtil/StandardConfigUtil.ts"],"sourcesContent":["import type { ConfigBase } from '../../models/config.models';\nimport { AxiosUtil } from '../AxiosUtil';\n\nconst ApplicationHeader = (): ReturnType<ConfigBase['ApplicationHeader']> => null;\nconst ConsentDialogContent = (): ReturnType<ConfigBase['consentDialog']['Content']> => null;\nconst HomePageIntroduction = (): ReturnType<ConfigBase['HomePageIntroduction']> => null;\nconst LicenseInformation = (): ReturnType<ConfigBase['LicenseInformation']> => null;\n\nexport class StandardConfigUtil {\n public static createConfig(): Omit<ConfigBase, 'theme'> {\n const config: Omit<ConfigBase, 'theme'> = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ApplicationHeader,\n applicationName: 'Gen-EpiX',\n consentDialog: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Content: ConsentDialogContent,\n getButtonLabel: () => 'I consent',\n getShouldShow: () => !import.meta.env.DEV,\n getTitle: () => 'Consent',\n },\n\n createFooter: () => ({\n sections: [\n {\n header: 'Contact',\n items: [\n {\n href: 'mailto:ids-bioinformatics@rivm.nl',\n label: 'ids-bioinformatics@rivm.nl',\n },\n ],\n },\n {\n header: 'About',\n items: [\n {\n href: 'https://github.com/RIVM-bioinformatics/gen-epix',\n label: 'Copyright',\n },\n ],\n },\n {\n header: 'Languages',\n items: [\n {\n label: 'English',\n onClick: () => null,\n },\n ],\n },\n ],\n }),\n defaultRequestTimeout: 30000,\n enablePageEvents: true,\n getAPIBaseUrl: () => {\n return 'development';\n },\n getEnvironmentMessage: () => {\n return 'development';\n },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n getSoftwareVersion: () => 'development',\n getTouchIconUrl: () => {\n return '/touch-icon.png';\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n HomePageIntroduction,\n layout: {\n MAIN_CONTENT_ID: 'main-content',\n SIDEBAR_MENU_WIDTH: 4,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n LicenseInformation,\n log: {\n LOG_INTERVAL_MS: 30000,\n },\n notifications: {\n autoHideAfterMs: 5000,\n },\n outages: {\n NUM_HOURS_TO_SHOW_SOON_ACTIVE_OUTAGES: 8,\n },\n queryClient: {\n retry: (import.meta.env.DEV)\n ? () => false\n : (failureCount: number, error: unknown) => {\n if (AxiosUtil.isAxiosInternalServerError(error) || AxiosUtil.isAxiosTimeoutError(error)) {\n return failureCount < 3;\n }\n return false;\n },\n retryDelay: attempt => Math.min(attempt > 1 ? 2 ** attempt * 3000 : 3000, 30 * 1000),\n },\n table: {\n CONDENSED_WIDTH_PX: 150,\n DEFAULT_OVERSCAN_MAIN:
|
|
1
|
+
{"version":3,"file":"index.js","names":["ApplicationHeader","ConsentDialogContent","HomePageIntroduction","LicenseInformation","StandardConfigUtil","AxiosUtil","error","failureCount","attempt"],"sources":["../../../src/utils/StandardConfigUtil/StandardConfigUtil.ts"],"sourcesContent":["import type { ConfigBase } from '../../models/config.models';\nimport { AxiosUtil } from '../AxiosUtil';\n\nconst ApplicationHeader = (): ReturnType<ConfigBase['ApplicationHeader']> => null;\nconst ConsentDialogContent = (): ReturnType<ConfigBase['consentDialog']['Content']> => null;\nconst HomePageIntroduction = (): ReturnType<ConfigBase['HomePageIntroduction']> => null;\nconst LicenseInformation = (): ReturnType<ConfigBase['LicenseInformation']> => null;\n\nexport class StandardConfigUtil {\n public static createConfig(): Omit<ConfigBase, 'theme'> {\n const config: Omit<ConfigBase, 'theme'> = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ApplicationHeader,\n applicationName: 'Gen-EpiX',\n consentDialog: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Content: ConsentDialogContent,\n getButtonLabel: () => 'I consent',\n getShouldShow: () => !import.meta.env.DEV,\n getTitle: () => 'Consent',\n },\n\n createFooter: () => ({\n sections: [\n {\n header: 'Contact',\n items: [\n {\n href: 'mailto:ids-bioinformatics@rivm.nl',\n label: 'ids-bioinformatics@rivm.nl',\n },\n ],\n },\n {\n header: 'About',\n items: [\n {\n href: 'https://github.com/RIVM-bioinformatics/gen-epix',\n label: 'Copyright',\n },\n ],\n },\n {\n header: 'Languages',\n items: [\n {\n label: 'English',\n onClick: () => null,\n },\n ],\n },\n ],\n }),\n defaultRequestTimeout: 30000,\n enablePageEvents: true,\n getAPIBaseUrl: () => {\n return 'development';\n },\n getEnvironmentMessage: () => {\n return 'development';\n },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n getSoftwareVersion: () => 'development',\n getTouchIconUrl: () => {\n return '/touch-icon.png';\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n HomePageIntroduction,\n layout: {\n MAIN_CONTENT_ID: 'main-content',\n SIDEBAR_MENU_WIDTH: 4,\n },\n // eslint-disable-next-line @typescript-eslint/naming-convention\n LicenseInformation,\n log: {\n LOG_INTERVAL_MS: 30000,\n },\n notifications: {\n autoHideAfterMs: 5000,\n },\n outages: {\n NUM_HOURS_TO_SHOW_SOON_ACTIVE_OUTAGES: 8,\n },\n queryClient: {\n retry: (import.meta.env.DEV)\n ? () => false\n : (failureCount: number, error: unknown) => {\n if (AxiosUtil.isAxiosInternalServerError(error) || AxiosUtil.isAxiosTimeoutError(error)) {\n return failureCount < 3;\n }\n return false;\n },\n retryDelay: attempt => Math.min(attempt > 1 ? 2 ** attempt * 3000 : 3000, 30 * 1000),\n },\n table: {\n CONDENSED_WIDTH_PX: 150,\n DEFAULT_OVERSCAN_MAIN: 30,\n DEFAULT_OVERSCAN_REVERSE: 30,\n },\n userFeedback: {\n SHOW_USER_FEEDBACK_TOOLTIP_AFTER_MS: 2 * 60 * 1000, // 2 minutes\n },\n userInactivityConfirmation: {\n ALLOWED_IDLE_TIME_MS: 25 * 60 * 1000, // 25 minutes\n NOTIFICATION_TIME_MS: 5 * 60 * 1000, // 5 minutes\n },\n };\n return config;\n }\n}\n"],"mappings":";;AAGA,IAAMA,UAAuE,MACvEC,UAAiF,MACjFC,UAA6E,MAC7EC,UAAyE,MAElEC,IAAb,MAAgC;CAC9B,OAAc,eAA0C;EAmGtD,OAAO;GAhGL;GACA,iBAAiB;GACjB,eAAe;IAEb,SAASH;IACT,sBAAsB;IACtB,qBAAqB;IACrB,gBAAgB;GAClB;GAEA,qBAAqB,EACnB,UAAU;IACR;KACE,QAAQ;KACR,OAAO,CACL;MACE,MAAM;MACN,OAAO;KACT,CACF;IACF;IACA;KACE,QAAQ;KACR,OAAO,CACL;MACE,MAAM;MACN,OAAO;KACT,CACF;IACF;IACA;KACE,QAAQ;KACR,OAAO,CACL;MACE,OAAO;MACP,eAAe;KACjB,CACF;IACF;GACF,EACF;GACA,uBAAuB;GACvB,kBAAkB;GAClB,qBACS;GAET,6BACS;GAIT,0BAA0B;GAC1B,uBACS;GAGT;GACA,QAAQ;IACN,iBAAiB;IACjB,oBAAoB;GACtB;GAEA;GACA,KAAK,EACH,iBAAiB,IACnB;GACA,eAAe,EACb,iBAAiB,IACnB;GACA,SAAS,EACP,uCAAuC,EACzC;GACA,aAAa;IACX,QAEK,GAAsB,MACnBI,EAAU,2BAA2BC,CAAK,KAAKD,EAAU,oBAAoBC,CAAK,IAC7EC,IAAe,IAEjB;IAEX,aAAY,MAAW,KAAK,IAAIC,IAAU,IAAI,KAAKA,IAAU,MAAO,KAAM,GAAS;GACrF;GACA,OAAO;IACL,oBAAoB;IACpB,uBAAuB;IACvB,0BAA0B;GAC5B;GACA,cAAc,EACZ,qCAAqC,KACvC;GACA,4BAA4B;IAC1B,sBAAsB;IACtB,sBAAsB;GACxB;EAEK;CACT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gen-epix/ui-client-common",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"homepage": "https://github.com/RIVM-bioinformatics/gen-epix",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -482,18 +482,18 @@
|
|
|
482
482
|
"last 2 Chrome versions"
|
|
483
483
|
],
|
|
484
484
|
"dependencies": {
|
|
485
|
-
"@hookform/resolvers": "
|
|
486
|
-
"@tanstack/react-query": "5.
|
|
485
|
+
"@hookform/resolvers": "7.0.6",
|
|
486
|
+
"@tanstack/react-query": "5.107.1",
|
|
487
487
|
"classnames": "2.5.1",
|
|
488
488
|
"clsx": "2.1.1",
|
|
489
489
|
"date-fns": "4.4.0",
|
|
490
|
-
"immer": "11.2.
|
|
490
|
+
"immer": "11.2.10",
|
|
491
491
|
"lodash": "4.18.1",
|
|
492
492
|
"oidc-client-ts": "3.5.0",
|
|
493
493
|
"reflect-metadata": "0.2.2",
|
|
494
494
|
"use-debounce": "10.1.1",
|
|
495
495
|
"uuid": "14.0.3",
|
|
496
|
-
"zustand": "5.0
|
|
496
|
+
"zustand": "5.1.0"
|
|
497
497
|
},
|
|
498
498
|
"devDependencies": {
|
|
499
499
|
"@dnd-kit/core": "6.3.1",
|
|
@@ -502,13 +502,13 @@
|
|
|
502
502
|
"@emotion/cache": "11.14.0",
|
|
503
503
|
"@emotion/react": "11.14.0",
|
|
504
504
|
"@emotion/styled": "11.14.1",
|
|
505
|
-
"@gen-epix/api-commondb": "^4.
|
|
506
|
-
"@gen-epix/eslint-config": "0.
|
|
507
|
-
"@gen-epix/translation-util": "0.
|
|
508
|
-
"@gen-epix/ui-core": "^3.
|
|
509
|
-
"@gen-epix/ui-core-components": "^4.
|
|
510
|
-
"@gen-epix/ui-core-form": "^4.
|
|
511
|
-
"@microsoft/api-extractor": "7.
|
|
505
|
+
"@gen-epix/api-commondb": "^4.6.0",
|
|
506
|
+
"@gen-epix/eslint-config": "0.10.0",
|
|
507
|
+
"@gen-epix/translation-util": "0.7.0",
|
|
508
|
+
"@gen-epix/ui-core": "^3.11.0",
|
|
509
|
+
"@gen-epix/ui-core-components": "^4.7.0",
|
|
510
|
+
"@gen-epix/ui-core-form": "^4.6.0",
|
|
511
|
+
"@microsoft/api-extractor": "7.60.1",
|
|
512
512
|
"@mui/icons-material": "9.5.0",
|
|
513
513
|
"@mui/material": "9.5.0",
|
|
514
514
|
"@mui/styled-engine": "9.5.0",
|
|
@@ -516,33 +516,33 @@
|
|
|
516
516
|
"@mui/utils": "9.5.0",
|
|
517
517
|
"@testing-library/react": "^16.3.3",
|
|
518
518
|
"@types/lodash": "4.17.27",
|
|
519
|
-
"@types/node": "26.6.
|
|
519
|
+
"@types/node": "26.6.6",
|
|
520
520
|
"@types/react": "19.3.0",
|
|
521
|
-
"@vitejs/plugin-react": "6.
|
|
522
|
-
"@vitest/browser-playwright": "5.0
|
|
523
|
-
"@vitest/coverage-v8": "5.0
|
|
524
|
-
"axios": "1.21.
|
|
525
|
-
"eslint": "10.
|
|
526
|
-
"i18next": "
|
|
527
|
-
"jsdom": "
|
|
528
|
-
"playwright": "1.
|
|
521
|
+
"@vitejs/plugin-react": "6.3.0",
|
|
522
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
523
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
524
|
+
"axios": "1.21.1",
|
|
525
|
+
"eslint": "10.14.0",
|
|
526
|
+
"i18next": "27.1.1",
|
|
527
|
+
"jsdom": "31.0.0",
|
|
528
|
+
"playwright": "1.65.0",
|
|
529
529
|
"react": "19.3.1",
|
|
530
530
|
"react-dom": "19.3.1",
|
|
531
531
|
"react-error-boundary": "6.1.6",
|
|
532
|
-
"react-hook-form": "7.
|
|
533
|
-
"react-i18next": "
|
|
532
|
+
"react-hook-form": "7.92.0",
|
|
533
|
+
"react-i18next": "18.0.1",
|
|
534
534
|
"react-oidc-context": "3.3.1",
|
|
535
|
-
"react-router": "8.5.
|
|
536
|
-
"react-router-dom": "7.18.
|
|
537
|
-
"react-virtuoso": "4.18.
|
|
535
|
+
"react-router": "8.5.1",
|
|
536
|
+
"react-router-dom": "7.18.5",
|
|
537
|
+
"react-virtuoso": "4.18.21",
|
|
538
538
|
"tsyringe": "4.10.0",
|
|
539
539
|
"typescript": "6.0.3",
|
|
540
|
-
"vite": "8.3.
|
|
540
|
+
"vite": "8.3.8",
|
|
541
541
|
"vite-plugin-dts": "5.1.2",
|
|
542
542
|
"vite-plugin-lib-inject-css": "2.2.2",
|
|
543
543
|
"vite-plugin-static-copy": "4.1.1",
|
|
544
544
|
"vite-plugin-svgr": "5.2.0",
|
|
545
|
-
"vitest": "5.0
|
|
545
|
+
"vitest": "5.1.0",
|
|
546
546
|
"vitest-browser-react": "2.3.0",
|
|
547
547
|
"yup": "1.7.1"
|
|
548
548
|
},
|
|
@@ -553,10 +553,10 @@
|
|
|
553
553
|
"@emotion/cache": "*",
|
|
554
554
|
"@emotion/react": "*",
|
|
555
555
|
"@emotion/styled": "*",
|
|
556
|
-
"@gen-epix/api-commondb": "^4.
|
|
557
|
-
"@gen-epix/ui-core": "^3.
|
|
558
|
-
"@gen-epix/ui-core-components": "^4.
|
|
559
|
-
"@gen-epix/ui-core-form": "^4.
|
|
556
|
+
"@gen-epix/api-commondb": "^4.6.0",
|
|
557
|
+
"@gen-epix/ui-core": "^3.11.0",
|
|
558
|
+
"@gen-epix/ui-core-components": "^4.7.0",
|
|
559
|
+
"@gen-epix/ui-core-form": "^4.6.0",
|
|
560
560
|
"@mui/icons-material": "*",
|
|
561
561
|
"@mui/material": "*",
|
|
562
562
|
"@mui/styled-engine": "*",
|
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
"check-types": "tsc --noemit",
|
|
590
590
|
"lint": "eslint ./src --report-unused-disable-directives --max-warnings 0",
|
|
591
591
|
"lint-fix": "eslint ./src --report-unused-disable-directives --max-warnings 0 --fix",
|
|
592
|
-
"test": "vitest --coverage",
|
|
592
|
+
"test": "pnpm exec playwright install && vitest --coverage",
|
|
593
593
|
"test-missing-translations": "translation-util ./ --dry-run --fail-on-missing --fail-on-stale",
|
|
594
594
|
"test-run": "vitest run --passWithNoTests --coverage",
|
|
595
595
|
"update-exports": "node scripts/update-exports.js",
|