@gen-epix/ui-client-common 4.6.1 → 4.8.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 +233 -232
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js +1 -0
- package/dist/_chunks/GeoFilter.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 +1314 -887
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +5126 -178
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +10 -6
- package/dist/_chunks/TextFilter.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 +123 -107
- 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 +298 -275
- package/dist/_chunks/tableStore.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/abstracts/FilterAbstract/FilterAbstract.d.ts +11 -0
- package/dist/classes/abstracts/FilterAbstract/index.js +48 -3
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/filters/BooleanFilter.d.ts +1 -0
- package/dist/classes/filters/DateFilter.d.ts +1 -1
- package/dist/classes/filters/GeoFilter.d.ts +1 -0
- package/dist/classes/filters/MultiSelectFilter.d.ts +1 -0
- package/dist/classes/filters/NumberRangeFilter.d.ts +1 -0
- package/dist/classes/filters/TextFilter.d.ts +1 -0
- 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 +27 -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/TableDownloadSidebarItem.d.ts +10 -0
- package/dist/components/ui/Table/TableSidebarMenu.d.ts +2 -1
- package/dist/components/ui/Table/index.d.ts +2 -0
- package/dist/components/ui/Table/index.js +1 -1
- package/dist/components/ui/Table/useTableColumnsMenu.d.ts +6 -0
- 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 +27 -5
- package/dist/locale/nl.json +27 -5
- package/dist/models/table.models.d.ts +1 -0
- package/dist/models/table.models.js.map +1 -1
- 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/stores/tableStore/tableStore.d.ts +3 -1
- package/dist/utils/StandardConfigUtil/index.js +2 -2
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TableUtil/TableUtil.d.ts +5 -0
- package/package.json +35 -37
- package/dist/_chunks/useColumnsMenu.js +0 -157
- package/dist/_chunks/useColumnsMenu.js.map +0 -1
- package/dist/hooks/useColumnsMenu/index.d.ts +0 -1
- package/dist/hooks/useColumnsMenu/index.js +0 -1
- package/dist/hooks/useColumnsMenu/useColumnsMenu.d.ts +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { API_SYSTEM_TOKEN as e } from "../../constants/api.constants.js";
|
|
2
|
+
import { t } from "../../_chunks/TableUtil.js";
|
|
3
3
|
import { t as n } from "../../_chunks/CrudPage.js";
|
|
4
4
|
import { COMMON_QUERY_KEY as r } from "../../constants/query.constants.js";
|
|
5
5
|
import { container as i } from "tsyringe";
|
|
@@ -14,10 +14,10 @@ import { FORM_FIELD_DEFINITION_TYPE as h } from "@gen-epix/ui-core-form/models/f
|
|
|
14
14
|
import { SchemaUtil as g } from "@gen-epix/ui-core-form/utils/SchemaUtil";
|
|
15
15
|
// src/pages/OutagesAdminPage/OutagesAdminPage.tsx
|
|
16
16
|
var _ = () => {
|
|
17
|
-
let { t: _ } = d(), v = c(async (
|
|
17
|
+
let { t: _ } = d(), v = c(async (t) => (await i.resolve(e).outagesGetAll(null, null, { signal: t }))?.data, []), y = c(async (t) => await i.resolve(e).outagesDeleteOne(t.id), []), b = c(async (t, n) => (await i.resolve(e).outagesPutOne(n.id, {
|
|
18
18
|
id: n.id,
|
|
19
|
-
...
|
|
20
|
-
})).data, []), x = c(async (
|
|
19
|
+
...t
|
|
20
|
+
})).data, []), x = c(async (t) => (await i.resolve(e).outagesPostOne(t)).data, []), S = c((e) => e.description, []), C = l(() => p().shape({
|
|
21
21
|
active_from: g.isoString,
|
|
22
22
|
active_to: g.isoString,
|
|
23
23
|
description: g.description.required(),
|
|
@@ -68,31 +68,31 @@ var _ = () => {
|
|
|
68
68
|
name: "is_visible"
|
|
69
69
|
}
|
|
70
70
|
], [_]), T = l(() => [
|
|
71
|
-
|
|
71
|
+
t.createDateColumn({
|
|
72
72
|
dateFormat: a.DATE_TIME,
|
|
73
73
|
id: "active_from",
|
|
74
74
|
name: _`Active from`
|
|
75
75
|
}),
|
|
76
|
-
|
|
76
|
+
t.createDateColumn({
|
|
77
77
|
dateFormat: a.DATE_TIME,
|
|
78
78
|
id: "active_to",
|
|
79
79
|
name: _`Active to`
|
|
80
80
|
}),
|
|
81
|
-
|
|
81
|
+
t.createDateColumn({
|
|
82
82
|
dateFormat: a.DATE_TIME,
|
|
83
83
|
id: "visible_from",
|
|
84
84
|
name: _`Visible from`
|
|
85
85
|
}),
|
|
86
|
-
|
|
86
|
+
t.createDateColumn({
|
|
87
87
|
dateFormat: a.DATE_TIME,
|
|
88
88
|
id: "visible_to",
|
|
89
89
|
name: _`Visible to`
|
|
90
90
|
}),
|
|
91
|
-
|
|
91
|
+
t.createBooleanColumn({
|
|
92
92
|
id: "is_active",
|
|
93
93
|
name: _`Is active`
|
|
94
94
|
}),
|
|
95
|
-
|
|
95
|
+
t.createBooleanColumn({
|
|
96
96
|
id: "is_visible",
|
|
97
97
|
name: _`Is visible`
|
|
98
98
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["CrudPage","OutagesAdminPage","useTranslation","fetchAll","useCallback","container","API_SYSTEM_TOKEN","deleteOne","item","updateOne","variables","createOne","getName","schema","useMemo","object","SchemaUtil","boolean","formFieldDefinitions","FORM_FIELD_DEFINITION_TYPE","DATE_FORMAT","t","tableColumns","TableUtil","extraCreateOnePermissions","CommonDbCommandName","CommonDbPermissionType","extraDeleteOnePermissions","extraUpdateOnePermissions","COMMON_QUERY_KEY","TestIdUtil"],"sources":["../../../src/pages/OutagesAdminPage/OutagesAdminPage.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport {\n useCallback,\n useMemo,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n boolean,\n object,\n} from 'yup';\nimport type {\n CommonDbApiPermission,\n CommonDbOutage,\n} from '@gen-epix/api-commondb';\nimport {\n CommonDbCommandName,\n CommonDbPermissionType,\n} from '@gen-epix/api-commondb';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport type { FormFieldDefinition } 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 { DATE_FORMAT } from '@gen-epix/ui-core/constants/date.constants';\n\nimport { API_SYSTEM_TOKEN } from '../../constants/api.constants';\nimport type { TableColumn } from '../../models/table.models';\nimport { TableUtil } from '../../utils/TableUtil';\nimport { CrudPage } from '../CrudPage';\nimport type { OmitWithMetaData } from '../../models/data.models';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\n\ntype FormFields = OmitWithMetaData<CommonDbOutage>;\n\nexport const OutagesAdminPage = () => {\n const { t } = useTranslation();\n\n const fetchAll = useCallback(async (signal: AbortSignal) => {\n return (await container.resolve(API_SYSTEM_TOKEN).outagesGetAll(null, null, { signal }))?.data;\n }, []);\n\n const deleteOne = useCallback(async (item: CommonDbOutage) => {\n return await container.resolve(API_SYSTEM_TOKEN).outagesDeleteOne(item.id);\n }, []);\n\n const updateOne = useCallback(async (variables: FormFields, item: CommonDbOutage) => {\n return (await container.resolve(API_SYSTEM_TOKEN).outagesPutOne(item.id, { id: item.id, ...variables })).data;\n }, []);\n\n const createOne = useCallback(async (variables: FormFields) => {\n return (await container.resolve(API_SYSTEM_TOKEN).outagesPostOne(variables)).data;\n }, []);\n\n const getName = useCallback((item: CommonDbOutage) => {\n return item.description;\n }, []);\n\n const schema = useMemo(() => {\n return object<FormFields>().shape({\n active_from: SchemaUtil.isoString,\n active_to: SchemaUtil.isoString,\n description: SchemaUtil.description.required(),\n is_active: boolean(),\n is_visible: boolean(),\n visible_from: SchemaUtil.isoString,\n visible_to: SchemaUtil.isoString,\n });\n }, []);\n\n const formFieldDefinitions = useMemo<FormFieldDefinition<FormFields>[]>(() => {\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Description`,\n multiline: true,\n name: 'description',\n rows: 5,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Active from`,\n name: 'active_from',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Active to`,\n name: 'active_to',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Visible from`,\n name: 'visible_from',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Visible to`,\n name: 'visible_to',\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.BOOLEAN,\n label: t`Is visible`,\n name: 'is_visible',\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const;\n }, [t]);\n\n const tableColumns = useMemo((): TableColumn<CommonDbOutage>[] => {\n return [\n TableUtil.createDateColumn<CommonDbOutage>({ dateFormat: DATE_FORMAT.DATE_TIME, id: 'active_from', name: t`Active from` }),\n TableUtil.createDateColumn<CommonDbOutage>({ dateFormat: DATE_FORMAT.DATE_TIME, id: 'active_to', name: t`Active to` }),\n TableUtil.createDateColumn<CommonDbOutage>({ dateFormat: DATE_FORMAT.DATE_TIME, id: 'visible_from', name: t`Visible from` }),\n TableUtil.createDateColumn<CommonDbOutage>({ dateFormat: DATE_FORMAT.DATE_TIME, id: 'visible_to', name: t`Visible to` }),\n TableUtil.createBooleanColumn<CommonDbOutage>({ id: 'is_active', name: t`Is active` }),\n TableUtil.createBooleanColumn<CommonDbOutage>({ id: 'is_visible', name: t`Is visible` }),\n ];\n }, [t]);\n\n\n const extraCreateOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.OutageCrudCommand, permission_type: CommonDbPermissionType.CREATE },\n ], []);\n const extraDeleteOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.OutageCrudCommand, permission_type: CommonDbPermissionType.DELETE },\n ], []);\n const extraUpdateOnePermissions = useMemo<CommonDbApiPermission[]>(() => [\n { command_name: CommonDbCommandName.OutageCrudCommand, permission_type: CommonDbPermissionType.UPDATE },\n ], []);\n\n return (\n <CrudPage<FormFields, CommonDbOutage>\n createItemDialogTitle={t`Create new outage`}\n createOne={createOne}\n crudCommandType={CommonDbCommandName.OutageCrudCommand}\n defaultSortByField={'active_from'}\n defaultSortDirection={'asc'}\n deleteOne={deleteOne}\n extraCreateOnePermissions={extraCreateOnePermissions}\n extraDeleteOnePermissions={extraDeleteOnePermissions}\n extraUpdateOnePermissions={extraUpdateOnePermissions}\n fetchAll={fetchAll}\n formFieldDefinitions={formFieldDefinitions}\n getName={getName}\n itemName={t`Outage`}\n resourceQueryKeyBase={COMMON_QUERY_KEY.OUTAGES}\n schema={schema}\n tableColumns={tableColumns}\n testIdAttributes={TestIdUtil.createAttributes('OutagesAdminPage')}\n title={t`Outages`}\n updateOne={updateOne}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,IAAaC,UAAyB;CACpC,IAAM,EAAE,SAAMC,EAAe,GAEvBC,IAAWC,EAAY,OAAO,OAC1B,MAAMC,EAAU,QAAQC,CAAgB,CAAC,CAAC,cAAc,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,EAAI,MACzF,CAAC,CAAC,GAECC,IAAYH,EAAY,OAAO,MAC5B,MAAMC,EAAU,QAA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AY;GAAW,IAAI;GAAe,MAAM,CAAC;EAAc,CAAC;EACzHG,EAAU,iBAAiC;GAAE,YAAYH,EAAY;GAAW,IAAI;GAAa,MAAM,CAAC;EAAY,CAAC;EACrHG,EAAU,iBAAiC;GAAE,YAAYH,EAAY;GAAW,IAAI;GAAgB,MAAM,CAAC;EAAe,CAAC;EAC3HG,EAAU,iBAAiC;GAAE,YAAYH,EAAY;GAAW,IAAI;GAAc,MAAM,CAAC;EAAa,CAAC;EACvHG,EAAU,oBAAoC;GAAE,IAAI;GAAa,MAAM,CAAC;EAAY,CAAC;EACrFA,EAAU,oBAAoC;GAAE,IAAI;GAAc,MAAM,CAAC;EAAa,CAAC;CACzF,GACC,CAACF,CAAC,CAAC,GAGAG,IAA4BV,QAAuC,CACvE;EAAE,cAAcW,EAAoB;EAAmB,iBAAiBC,EAAuB;CAAO,CACxG,GAAG,CAAC,CAAC,GACCC,IAA4Bb,QAAuC,CACvE;EAAE,cAAcW,EAAoB;EAAmB,iBAAiBC,EAAuB;CAAO,CACxG,GAAG,CAAC,CAAC,GACCE,IAA4Bd,QAAuC,CACvE;EAAE,cAAcW,EAAoB;EAAmB,iBAAiBC,EAAuB;CAAO,CACxG,GAAG,CAAC,CAAC;CAEL,OACE,kBAAC1B,GAAD;EACE,uBAAuB,CAAC;EACb;EACX,iBAAiByB,EAAoB;EACrC,oBAAoB;EACpB,sBAAsB;EACX;EACgB;EACA;EACA;EACjB;EACY;EACb;EACT,UAAU,CAAC;EACX,sBAAsBI,EAAiB;EAC/B;EACM;EACd,kBAAkBC,EAAW,iBAAiB,kBAAkB;EAChE,OAAO,CAAC;EACG;CACZ,CAAA;AAEL"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { GenericErrorMessage as e } from "../../components/ui/GenericErrorMessage/index.js";
|
|
2
|
+
import { PageContainer as t } from "../../components/ui/PageContainer/index.js";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
import { useTranslation as r } from "react-i18next";
|
|
5
5
|
import { TestIdUtil as i } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
@@ -7,11 +7,11 @@ import { useRouteError as a } from "react-router-dom";
|
|
|
7
7
|
// src/pages/RouterErrorPage/RouterErrorPage.tsx
|
|
8
8
|
var o = () => {
|
|
9
9
|
let o = a(), { t: s } = r();
|
|
10
|
-
return /* @__PURE__ */ n(
|
|
10
|
+
return /* @__PURE__ */ n(t, {
|
|
11
11
|
singleAction: !0,
|
|
12
12
|
testIdAttributes: i.createAttributes("RouterErrorPage"),
|
|
13
13
|
title: s`Error`,
|
|
14
|
-
children: /* @__PURE__ */ n(
|
|
14
|
+
children: /* @__PURE__ */ n(e, { error: o })
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
export { o as RouterErrorPage };
|
|
@@ -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,GAClEC,IAA2BC,EAA4B,GACv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AD;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":";;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAaM,KAAkB,EAC7B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E;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;
|
|
@@ -9,6 +9,7 @@ export interface CreateTableStoreInitialStateKwArgs<TData, TDataContext = null>
|
|
|
9
9
|
idSelectorCallback: (row: TData) => string;
|
|
10
10
|
isRowEnabledCallback?: (row: TData, dataContext: TDataContext) => boolean;
|
|
11
11
|
navigatorFunction?: NavigateFunction;
|
|
12
|
+
showMissingValuesFilter?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export type CreateTableStoreKwArgs<TData, TDataContext = null> = {
|
|
14
15
|
storageNamePostFix?: string;
|
|
@@ -36,7 +37,7 @@ export interface TableStoreActions<TData, TDataContext = null> {
|
|
|
36
37
|
setColumnVisualSettingsUncondensed: (columnVisualSettingsUncondensed: TableColumnVisualSettings[]) => void;
|
|
37
38
|
setCurrentColumnVisualSettings: (columnVisualSettings: TableColumnVisualSettings[]) => void;
|
|
38
39
|
setFilters: (filters: Filters, filterDimensions: FilterDimension[], frontendFilterPriorities: string[]) => void;
|
|
39
|
-
setFilterValue: (id: string, value: unknown) => Promise<void>;
|
|
40
|
+
setFilterValue: (id: string, value: unknown, includeMissingValues?: boolean) => Promise<void>;
|
|
40
41
|
setFilterValues: (filterValues: FilterValues) => Promise<void>;
|
|
41
42
|
setIsCondensed: (isCondensed: boolean) => void;
|
|
42
43
|
setNavigateFunction: (navigateFunction: NavigateFunction) => void;
|
|
@@ -81,6 +82,7 @@ export interface TableStoreState<TData, TDataContext = null> {
|
|
|
81
82
|
isRowEnabledCallback: (row: TData, dataContext: TDataContext) => boolean;
|
|
82
83
|
navigateFunction: NavigateFunction;
|
|
83
84
|
selectedIds: string[];
|
|
85
|
+
showMissingValuesFilter: boolean;
|
|
84
86
|
sortByField: string;
|
|
85
87
|
sortDirection: TableSortDirection;
|
|
86
88
|
sortedData: TData[];
|
|
@@ -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"}
|
|
@@ -68,6 +68,8 @@ export declare class TableUtil {
|
|
|
68
68
|
id?: keyof TData;
|
|
69
69
|
name: string;
|
|
70
70
|
}): TableColumnText<TData, TDataContext, TColumnContext>;
|
|
71
|
+
static downloadAsCSV<TRowData, TDataContext = null>(sortedData: TRowData[], visibleColumnIds: string[], columns: TableColumn<TRowData, TDataContext>[], fileName: string, dataContext?: TDataContext): void;
|
|
72
|
+
static downloadAsExcel<TRowData, TDataContext = null>(sortedData: TRowData[], visibleColumnIds: string[], columns: TableColumn<TRowData, TDataContext>[], fileName: string, dataContext?: TDataContext): Promise<void>;
|
|
71
73
|
static getColumnIdsWithData<TRowData, TDataContext = null>(params: {
|
|
72
74
|
dataContext: TDataContext;
|
|
73
75
|
hasCellData: HasCellDataFn<TRowData, TDataContext>;
|
|
@@ -85,6 +87,9 @@ export declare class TableUtil {
|
|
|
85
87
|
static handleMoveColumn<TRowData, TDataContext = null>(columnDimensions: TableColumnDimension[], tableColumnVisualSettings: TableColumnVisualSettings[], // Will be mutated
|
|
86
88
|
tableColumns: TableColumn<TRowData, TDataContext>[], elementTableColumn: TableColumn<TRowData, TDataContext>, direction: -1 | 1): boolean;
|
|
87
89
|
static updateColumnSizesInVisualSettings<TRowData, TDataContext = null>(container: HTMLDivElement, scrollbarSize: number, sortedData: TRowData[], tableColumns: TableColumn<TRowData, TDataContext>[], allColumnVisualSettings: TableColumnVisualSettings[]): Map<string, TableColumnVisualSettings>;
|
|
90
|
+
private static getExportColumns;
|
|
91
|
+
private static getExportData;
|
|
88
92
|
private static handleMoveColumnAcrossDimensions;
|
|
89
93
|
private static swapTwoTableColumns;
|
|
94
|
+
private static toExportValue;
|
|
90
95
|
}
|