@gen-epix/ui-client-casedb 4.3.0 → 4.3.2
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/dist/_chunks/Dashboard.js +613 -666
- package/dist/_chunks/Dashboard.js.map +1 -1
- package/dist/_chunks/LegendaItem.js.map +1 -1
- package/dist/_chunks/UploadUtil.js +4 -6
- package/dist/_chunks/UploadUtil.js.map +1 -1
- package/dist/_chunks/_baseClone.js +1 -1
- package/dist/_chunks/_baseClone.js.map +1 -1
- package/dist/_chunks/cloneDeep.js +1 -1
- package/dist/_chunks/cloneDeep.js.map +1 -1
- package/dist/_chunks/esm.js +93 -101
- package/dist/_chunks/esm.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/shallow.js +2 -2
- package/dist/_chunks/shallow.js.map +1 -1
- package/dist/_chunks/sync.js +4 -4
- package/dist/_chunks/sync.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/components/app/CaseDbApp/CaseDbApp.d.ts +1 -1
- package/dist/components/ui/AddCasesToEventDialog/AddCasesToEventDialogSuccessNotificationMessage.d.ts +1 -1
- package/dist/components/ui/CaseContentForm/CaseContentForm.d.ts +1 -1
- package/dist/components/ui/CaseInfoDialog/CaseCaseSetInfo.d.ts +1 -1
- package/dist/components/ui/CaseInfoDialog/CaseContent.d.ts +1 -1
- package/dist/components/ui/CaseInfoDialog/CaseInfoForm.d.ts +1 -1
- package/dist/components/ui/CaseInfoDialog/CaseSharingForm.d.ts +1 -1
- package/dist/components/ui/CaseInfoDialog/CaseSharingInfo.d.ts +1 -1
- package/dist/components/ui/CaseInfoDialog/ReadOnlyCaseContent.d.ts +1 -1
- package/dist/components/ui/CaseSetInfoDialog/CaseSetContent.d.ts +1 -1
- package/dist/components/ui/CaseSetInfoDialog/CaseSetDescription.d.ts +1 -1
- package/dist/components/ui/CaseSetInfoDialog/CaseSetForm.d.ts +1 -1
- package/dist/components/ui/CaseSetInfoDialog/CaseSetSharingForm.d.ts +1 -1
- package/dist/components/ui/CaseSetInfoDialog/CaseSetSharingInfo.d.ts +1 -1
- package/dist/components/ui/CaseSummary/CaseSummary.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoAccessRights.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoColAccessRights.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoData.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialogContent.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoRegions.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoTrees.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoValues.d.ts +1 -1
- package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoVariableDetails.d.ts +1 -1
- package/dist/components/ui/CasesAlreadyInCaseSetWarning/CasesAlreadyInCaseSetWarning.d.ts +1 -1
- package/dist/components/ui/CasesAlreadyInCaseSetWarning/CasesAlreadyInCaseSetWarningCaseSetLink.d.ts +1 -1
- package/dist/components/ui/CompletCaseTypeLoader/CompletCaseTypeLoader.d.ts +1 -1
- package/dist/components/ui/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/components/ui/ContextMenu/index.js +1 -1
- package/dist/components/ui/ContextMenu/index.js.map +1 -1
- package/dist/components/ui/CreateEventDialog/CreateEventDialogSuccessNotificationMessage.d.ts +1 -1
- package/dist/components/ui/CreateEventDialog/index.js +1 -1
- package/dist/components/ui/CreateEventDialog/index.js.map +1 -1
- package/dist/components/ui/CustomTabPanel/CustomTabPanel.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardContent.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardDownloadSidebarItem.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardGeneralSettingsForm.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardLayoutRenderer.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardLayoutSettingsForm.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardSearch.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardSearchSettings.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardSettingsSidebarItem.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardWidget.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardWidgetPlaceHolder.d.ts +1 -1
- package/dist/components/ui/Dashboard/DashboardWidgetSettingsForm.d.ts +1 -1
- package/dist/components/ui/Dashboard/context/DashboardContextProvider.d.ts +1 -1
- package/dist/components/ui/DashboardEditCases/DashboardEditCases.d.ts +1 -1
- package/dist/components/ui/DashboardStoreLoader/DashboardStoreLoader.d.ts +1 -1
- package/dist/components/ui/DashboardStoreLoader/DashboardStoreLoaderContent.d.ts +1 -1
- package/dist/components/ui/DataCollectionAccessInfo/DataCollectionAccessInfo.d.ts +1 -1
- package/dist/components/ui/EpiCurveWidget/EpiCurveBarChart.d.ts +1 -1
- package/dist/components/ui/EpiCurveWidget/EpiCurveStackedAreaChart.d.ts +1 -1
- package/dist/components/ui/EpiCurveWidget/EpiCurveWidget.d.ts +1 -1
- package/dist/components/ui/Grouping/Grouping.d.ts +1 -1
- package/dist/components/ui/HistogramWidget/HistogramWidget.d.ts +1 -1
- package/dist/components/ui/HistogramWidget/index.js +1 -1
- package/dist/components/ui/HistogramWidget/index.js.map +1 -1
- package/dist/components/ui/HomePageTrends/HomePageTrendCard.d.ts +1 -1
- package/dist/components/ui/HomePageTrends/HomePageTrends.d.ts +1 -1
- package/dist/components/ui/LegendaItem/LegendaItem.d.ts +1 -1
- package/dist/components/ui/LineListWidget/LineListWidget.d.ts +1 -1
- package/dist/components/ui/LineListWidget/LineListWidgetIsInEventCell.d.ts +1 -1
- package/dist/components/ui/LineListWidget/LineListWidgetIsOwnCaseCell.d.ts +1 -1
- package/dist/components/ui/LineListWidget/LineListWidgetPrimaryMenu.d.ts +1 -1
- package/dist/components/ui/LineListWidget/LineListWidgetSecondaryMenu.d.ts +1 -1
- package/dist/components/ui/LineListWidget/LineListWidgetTitle.d.ts +1 -1
- package/dist/components/ui/MapWidget/MapWidget.d.ts +1 -1
- package/dist/components/ui/PanelSeparator/PanelSeparatorHorizontal.d.ts +1 -1
- package/dist/components/ui/PanelSeparator/PanelSeparatorVertical.d.ts +1 -1
- package/dist/components/ui/PanelSeparator/index.js +50 -2
- package/dist/components/ui/PanelSeparator/index.js.map +1 -0
- package/dist/components/ui/TreeDescription/TreeDescription.d.ts +1 -1
- package/dist/components/ui/TreeWidget/TreeWidget.d.ts +1 -1
- package/dist/components/ui/Upload/Upload.d.ts +1 -1
- package/dist/components/ui/Upload/UploadCaseResultTable.d.ts +1 -1
- package/dist/components/ui/Upload/UploadCreateCases.d.ts +1 -1
- package/dist/components/ui/Upload/UploadMapColumns.d.ts +1 -1
- package/dist/components/ui/Upload/UploadMapSequences.d.ts +1 -1
- package/dist/components/ui/Upload/UploadNavigation.d.ts +1 -1
- package/dist/components/ui/Upload/UploadPreviewNavigation.d.ts +1 -1
- package/dist/components/ui/Upload/UploadSelectFile.d.ts +1 -1
- package/dist/components/ui/Upload/UploadSelectSequenceFiles.d.ts +1 -1
- package/dist/components/ui/UserRightsDialog/UserRightsDialogCaseAccessPolicy.d.ts +1 -1
- package/dist/components/ui/Warning/Warning.d.ts +1 -1
- package/dist/components/ui/WidgetHeaderIconButton/WidgetHeaderIconButton.d.ts +1 -1
- package/dist/components/ui/WidgetMenu/WidgetMenu.d.ts +1 -1
- package/dist/components/ui/WidgetUnavailable/WidgetUnavailable.d.ts +1 -1
- package/dist/context/caseAbac/CaseAbacContextProvider.d.ts +1 -1
- package/dist/context/caseTypeAbac/CaseTypeAbacContextProvider.d.ts +1 -1
- package/dist/pages/CaseDbUsersAdminPage/CaseDbUsersAdminPage.d.ts +1 -1
- package/dist/pages/CaseSetCategoryAdminPage/CaseSetCategoryAdminPage.d.ts +1 -1
- package/dist/pages/CaseSetStatusAdminPage/CaseSetStatusAdminPage.d.ts +1 -1
- package/dist/pages/CaseTypeSetCategoriesAdminPage/CaseTypeSetCategoriesAdminPage.d.ts +1 -1
- package/dist/pages/CaseTypeSetsAdminPage/CaseTypeSetsAdminPage.d.ts +1 -1
- package/dist/pages/CaseTypesAdminPage/CaseTypesAdminPage.d.ts +1 -1
- package/dist/pages/CasesDetailPage/CasesDetailPage.d.ts +1 -1
- package/dist/pages/CasesDetailPage/index.js +16 -16
- package/dist/pages/CasesPage/CasesPage.d.ts +1 -1
- package/dist/pages/ColSetsAdminPage/ColSetsAdminPage.d.ts +1 -1
- package/dist/pages/ColsAdminPage/ColsAdminPage.d.ts +1 -1
- package/dist/pages/ColsAdminPage/index.js +77 -77
- package/dist/pages/ColsAdminPage/index.js.map +1 -1
- package/dist/pages/ConceptRelationsAdminPage/ConceptRelationsAdminPage.d.ts +1 -1
- package/dist/pages/ConceptSetsAdminPage/ConceptSetsAdminPage.d.ts +1 -1
- package/dist/pages/ConceptsAdminPage/ConceptsAdminPage.d.ts +1 -1
- package/dist/pages/ConceptsAdminPage/index.js +31 -31
- package/dist/pages/DataCollectionSetsAdminPage/DataCollectionSetsAdminPage.d.ts +1 -1
- package/dist/pages/DataCollectionVisualizationPage/DataCollectionVisualizationPage.d.ts +1 -1
- package/dist/pages/DataCollectionVisualizationPage/index.js +1 -1
- package/dist/pages/DataCollectionVisualizationPage/index.js.map +1 -1
- package/dist/pages/DataCollectionsAdminPage/DataCollectionsAdminPage.d.ts +1 -1
- package/dist/pages/DimsAdminPage/DimsAdminPage.d.ts +1 -1
- package/dist/pages/DimsAdminPage/index.js +46 -46
- package/dist/pages/DiseasesAdminPage/DiseasesAdminPage.d.ts +1 -1
- package/dist/pages/EtiologicalAgentsAdminPage/EtiologicalAgentsAdminPage.d.ts +1 -1
- package/dist/pages/EtiologiesAdminPage/EtiologiesAdminPage.d.ts +1 -1
- package/dist/pages/EventsDetailPage/EventsDetailPage.d.ts +1 -1
- package/dist/pages/EventsDetailPage/index.js +18 -18
- package/dist/pages/EventsPage/EventsPage.d.ts +1 -1
- package/dist/pages/HomePage/HomePage.d.ts +1 -1
- package/dist/pages/OrganizationAccessCasePoliciesAdminPage/OrganizationAccessCasePoliciesAdminPage.d.ts +1 -1
- package/dist/pages/OrganizationShareCasePoliciesAdminPage/OrganizationShareCasePoliciesAdminPage.d.ts +1 -1
- package/dist/pages/RefColsAdminPage/RefColsAdminPage.d.ts +1 -1
- package/dist/pages/RefColsAdminPage/index.js +94 -94
- package/dist/pages/RefDimsAdminPage/RefDimsAdminPage.d.ts +1 -1
- package/dist/pages/RegionRelationsAdminPage/RegionRelationsAdminPage.d.ts +1 -1
- package/dist/pages/RegionSetShapesAdminPage/RegionSetShapesAdminPage.d.ts +1 -1
- package/dist/pages/RegionSetShapesAdminPage/index.js +26 -26
- package/dist/pages/RegionSetsAdminPage/RegionSetsAdminPage.d.ts +1 -1
- package/dist/pages/RegionsAdminPage/RegionsAdminPage.d.ts +1 -1
- package/dist/pages/RegionsAdminPage/index.js +33 -33
- package/dist/pages/TrendsPage/TrendsPage.d.ts +1 -1
- package/dist/pages/UploadPage/UploadPage.d.ts +1 -1
- package/dist/pages/UserAccessCasePoliciesAdminPage/UserAccessCasePoliciesAdminPage.d.ts +1 -1
- package/dist/pages/UserEffectiveRightsAdminPage/UserEffectiveRightsAdminPage.d.ts +1 -1
- package/dist/pages/UserEffectiveRightsAdminPage/index.js +56 -56
- package/dist/pages/UserEffectiveRightsAdminPage/index.js.map +1 -1
- package/dist/pages/UserEffectiveRightsTesterAdminPage/UserEffectiveRightsTesterAdminPage.d.ts +1 -1
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js +45 -45
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js.map +1 -1
- package/dist/pages/UserShareCasePoliciesAdminPage/UserShareCasePoliciesAdminPage.d.ts +1 -1
- package/dist/utils/CaseDbStandardConfigUtil/index.js +1 -5
- package/dist/utils/CaseDbStandardConfigUtil/index.js.map +1 -1
- package/dist/utils/MapUtil/index.js +1 -1
- package/dist/utils/MapUtil/index.js.map +1 -1
- package/package.json +33 -28
- package/dist/_chunks/PanelSeparator.js +0 -1666
- package/dist/_chunks/PanelSeparator.js.map +0 -1
- package/dist/_chunks/chunk-OB3PAWPO.js +0 -1162
- package/dist/_chunks/chunk-OB3PAWPO.js.map +0 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { EffectiveRightsUtil as e } from "../../utils/EffectiveRightsUtil/index.js";
|
|
2
2
|
import { useDataCollectionOptionsQuery as t, useDataCollectionsMapQuery as n } from "../../dataHooks/useDataCollectionsQuery/index.js";
|
|
3
3
|
import { useCaseTypeSetMembersQuery as r } from "../../dataHooks/useCaseTypeSetMembersQuery/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useCaseTypeSetNameFactory as l, useCaseTypeSetsMapQuery as ee } from "../../dataHooks/useCaseTypeSetsQuery/index.js";
|
|
4
|
+
import { useColSetMembersQuery as i } from "../../dataHooks/useColSetMembersQuery/index.js";
|
|
5
|
+
import { useOrganizationAccessCasePoliciesQuery as a } from "../../dataHooks/useOrganizationAccessCasePoliciesQuery/index.js";
|
|
6
|
+
import { useOrganizationShareCasePoliciesQuery as o } from "../../dataHooks/useOrganizationShareCasePoliciesQuery/index.js";
|
|
7
|
+
import { useColSetMapQuery as ee } from "../../dataHooks/useColSetsQuery/index.js";
|
|
8
|
+
import { useCaseTypeSetNameFactory as s, useCaseTypeSetsMapQuery as c } from "../../dataHooks/useCaseTypeSetsQuery/index.js";
|
|
10
9
|
import { UsersEffectiveRightsDetailsDialog as te } from "../../components/ui/UsersEffectiveRightsDetailsDialog/index.js";
|
|
11
|
-
import { useUserAccessCasePoliciesQuery as
|
|
12
|
-
import { useUserShareCasePoliciesQuery as
|
|
13
|
-
import { CaseDbOrganizationApi as
|
|
14
|
-
import { ConfigService as
|
|
15
|
-
import { COMMON_QUERY_KEY as
|
|
16
|
-
import { Box as
|
|
17
|
-
import { useCallback as
|
|
18
|
-
import { useTranslation as
|
|
19
|
-
import { TableStoreContextProvider as
|
|
20
|
-
import { Fragment as
|
|
10
|
+
import { useUserAccessCasePoliciesQuery as ne } from "../../dataHooks/useUserAccessCasePoliciesQuery/index.js";
|
|
11
|
+
import { useUserShareCasePoliciesQuery as l } from "../../dataHooks/useUserShareCasePoliciesQuery/index.js";
|
|
12
|
+
import { CaseDbOrganizationApi as u } from "@gen-epix/api-casedb";
|
|
13
|
+
import { ConfigService as re } from "@gen-epix/ui-client-common/classes/services/ConfigService";
|
|
14
|
+
import { COMMON_QUERY_KEY as d } from "@gen-epix/ui-client-common/constants/query";
|
|
15
|
+
import { Box as f, Link as p, useTheme as ie } from "@mui/material";
|
|
16
|
+
import { useCallback as m, useMemo as h, useRef as g } from "react";
|
|
17
|
+
import { useTranslation as _ } from "react-i18next";
|
|
18
|
+
import { TableStoreContextProvider as v, createTableStore as y } from "@gen-epix/ui-client-common/stores/tableStore";
|
|
19
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
21
20
|
import { ResponseHandler as ae } from "@gen-epix/ui-client-common/components/ui/ResponseHandler";
|
|
22
21
|
import { useItemQuery as oe } from "@gen-epix/ui-client-common/hooks/useItemQuery";
|
|
23
22
|
import { useArray as se } from "@gen-epix/ui-core/hooks/useArray";
|
|
24
23
|
import { Table as ce, TableCaption as le, TableMenu as ue, TableSidebarMenu as de } from "@gen-epix/ui-client-common/components/ui/Table";
|
|
25
|
-
import { TableUtil as
|
|
26
|
-
import { useInitializeTableStore as
|
|
27
|
-
import { TestIdUtil as
|
|
28
|
-
import { RouterService as
|
|
24
|
+
import { TableUtil as C } from "@gen-epix/ui-client-common/utils/TableUtil";
|
|
25
|
+
import { useInitializeTableStore as w } from "@gen-epix/ui-client-common/hooks/useInitializeTableStore";
|
|
26
|
+
import { TestIdUtil as T } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
27
|
+
import { RouterService as E } from "@gen-epix/ui-client-common/classes/services/RouterService";
|
|
28
|
+
import { useParams as D } from "react-router-dom";
|
|
29
29
|
import { PageContainer as O } from "@gen-epix/ui-client-common/components/ui/PageContainer";
|
|
30
30
|
import { UserUtil as k } from "@gen-epix/ui-client-common/utils/UserUtil";
|
|
31
31
|
//#region src/pages/UserEffectiveRightsAdminPage/UserEffectiveRightsAdminPage.tsx
|
|
32
32
|
var A = () => {
|
|
33
|
-
let { t: A } =
|
|
34
|
-
baseQueryKey:
|
|
33
|
+
let { t: A } = _(), j = ie(), M = g(null), { userId: N } = D(), { data: P, error: F, isLoading: I } = oe({
|
|
34
|
+
baseQueryKey: d.USERS,
|
|
35
35
|
itemId: N,
|
|
36
|
-
useQueryOptions: { queryFn: async ({ signal: e }) => (await
|
|
37
|
-
}), L =
|
|
36
|
+
useQueryOptions: { queryFn: async ({ signal: e }) => (await u.getInstance().usersGetOne(N, { signal: e })).data }
|
|
37
|
+
}), L = i(), R = c(), z = ee(), B = r(), V = s(), H = n(), U = t(), W = a((e) => e.filter((e) => e.is_active && e.organization_id === P.organization_id)), G = o((e) => e.filter((e) => e.is_active && e.organization_id === P.organization_id)), K = ne((e) => e.filter((e) => e.is_active && e.user_id === P.id)), q = l((e) => e.filter((e) => e.is_active && e.user_id === P.id)), J = se([
|
|
38
38
|
W,
|
|
39
39
|
G,
|
|
40
40
|
K,
|
|
@@ -46,14 +46,14 @@ var A = () => {
|
|
|
46
46
|
z,
|
|
47
47
|
V,
|
|
48
48
|
R
|
|
49
|
-
]), Y =
|
|
49
|
+
]), Y = h(() => y({
|
|
50
50
|
defaultSortByField: "data_collection_id",
|
|
51
51
|
defaultSortDirection: "asc",
|
|
52
52
|
idSelectorCallback: (e) => e.data_collection_id,
|
|
53
|
-
navigatorFunction:
|
|
53
|
+
navigatorFunction: E.getInstance().router.navigate,
|
|
54
54
|
storageNamePostFix: "UsersEffectiveRightsAdminPage-Table",
|
|
55
55
|
storageVersion: 1
|
|
56
|
-
}), []), fe =
|
|
56
|
+
}), []), fe = h(() => {
|
|
57
57
|
let { data: t } = W, { data: n } = G, { data: r } = K, { data: i } = q, { data: a } = B, { data: o } = L;
|
|
58
58
|
return e.assembleUserEffectiveRights({
|
|
59
59
|
caseTypeSetMembers: a,
|
|
@@ -72,7 +72,7 @@ var A = () => {
|
|
|
72
72
|
P,
|
|
73
73
|
K,
|
|
74
74
|
q
|
|
75
|
-
]), X =
|
|
75
|
+
]), X = m((e) => {
|
|
76
76
|
let { getName: t, setIds: n, type: r, uncategorizedMemberIds: i, userEffectiveRight: a } = e, o = (e) => {
|
|
77
77
|
e.preventDefault(), e.stopPropagation(), M.current.open({
|
|
78
78
|
type: r,
|
|
@@ -80,22 +80,22 @@ var A = () => {
|
|
|
80
80
|
userEffectiveRight: a
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
|
-
return i.length > 0 ? /* @__PURE__ */
|
|
83
|
+
return i.length > 0 ? /* @__PURE__ */ x(p, {
|
|
84
84
|
href: "#",
|
|
85
85
|
onClick: o,
|
|
86
86
|
tabIndex: 0,
|
|
87
87
|
children: A`View all`
|
|
88
|
-
}) : n.length > 2 ? /* @__PURE__ */
|
|
88
|
+
}) : n.length > 2 ? /* @__PURE__ */ x(p, {
|
|
89
89
|
href: "#",
|
|
90
90
|
onClick: o,
|
|
91
91
|
tabIndex: 0,
|
|
92
92
|
children: A("View {{numSets}} sets", { numSets: n.length })
|
|
93
|
-
}) : /* @__PURE__ */
|
|
93
|
+
}) : /* @__PURE__ */ x(b, { children: n.map((e) => /* @__PURE__ */ x(p, {
|
|
94
94
|
href: "#",
|
|
95
95
|
onClick: o,
|
|
96
96
|
children: t(e) ?? e
|
|
97
97
|
}, e)) });
|
|
98
|
-
}, [A, P]), Z =
|
|
98
|
+
}, [A, P]), Z = m(({ row: e }) => X({
|
|
99
99
|
getName: (e) => V.getName(R.map.get(e)),
|
|
100
100
|
setIds: e.case_type_set_ids,
|
|
101
101
|
type: "caseTypeSets",
|
|
@@ -105,21 +105,21 @@ var A = () => {
|
|
|
105
105
|
V,
|
|
106
106
|
R.map,
|
|
107
107
|
X
|
|
108
|
-
]), Q =
|
|
108
|
+
]), Q = m(({ row: e }) => X({
|
|
109
109
|
getName: (e) => z.map.get(e).name,
|
|
110
110
|
setIds: e.read_col_set_ids,
|
|
111
111
|
type: "readColSets",
|
|
112
112
|
uncategorizedMemberIds: e.uncategorized_read_col_ids,
|
|
113
113
|
userEffectiveRight: e
|
|
114
|
-
}), [z.map, X]), $ =
|
|
114
|
+
}), [z.map, X]), $ = m(({ row: e }) => X({
|
|
115
115
|
getName: (e) => z.map.get(e)?.name,
|
|
116
116
|
setIds: e.write_col_set_ids,
|
|
117
117
|
type: "writeColSets",
|
|
118
118
|
uncategorizedMemberIds: e.uncategorized_write_col_ids,
|
|
119
119
|
userEffectiveRight: e
|
|
120
|
-
}), [z.map, X]), pe =
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
}), [z.map, X]), pe = h(() => [
|
|
121
|
+
C.createReadableIndexColumn(),
|
|
122
|
+
C.createOptionsColumn({
|
|
123
123
|
id: "data_collection_id",
|
|
124
124
|
name: A`Data collection`,
|
|
125
125
|
options: U.options
|
|
@@ -151,27 +151,27 @@ var A = () => {
|
|
|
151
151
|
type: "text",
|
|
152
152
|
widthFlex: 1
|
|
153
153
|
},
|
|
154
|
-
|
|
154
|
+
C.createBooleanColumn({
|
|
155
155
|
id: "add_case",
|
|
156
156
|
name: A`Add case`
|
|
157
157
|
}),
|
|
158
|
-
|
|
158
|
+
C.createBooleanColumn({
|
|
159
159
|
id: "remove_case",
|
|
160
160
|
name: A`Remove case`
|
|
161
161
|
}),
|
|
162
|
-
|
|
162
|
+
C.createBooleanColumn({
|
|
163
163
|
id: "add_case_set",
|
|
164
164
|
name: A`Add case set`
|
|
165
165
|
}),
|
|
166
|
-
|
|
166
|
+
C.createBooleanColumn({
|
|
167
167
|
id: "remove_case_set",
|
|
168
168
|
name: A`Remove case set`
|
|
169
169
|
}),
|
|
170
|
-
|
|
170
|
+
C.createBooleanColumn({
|
|
171
171
|
id: "read_case_set",
|
|
172
172
|
name: A`Read case set`
|
|
173
173
|
}),
|
|
174
|
-
|
|
174
|
+
C.createBooleanColumn({
|
|
175
175
|
id: "write_case_set",
|
|
176
176
|
name: A`Write case set`
|
|
177
177
|
}),
|
|
@@ -189,54 +189,54 @@ var A = () => {
|
|
|
189
189
|
Q,
|
|
190
190
|
$,
|
|
191
191
|
A
|
|
192
|
-
]), me =
|
|
192
|
+
]), me = m((e) => H.map.get(e.data_collection_id)?.name ?? e.data_collection_id, [H.map]), he = m((e) => {
|
|
193
193
|
M.current.open({
|
|
194
194
|
type: "caseTypeSets",
|
|
195
195
|
user: P,
|
|
196
196
|
userEffectiveRight: e.row
|
|
197
197
|
});
|
|
198
198
|
}, [P]);
|
|
199
|
-
return
|
|
199
|
+
return w({
|
|
200
200
|
columns: pe,
|
|
201
201
|
createFiltersFromColumns: !0,
|
|
202
202
|
rows: fe,
|
|
203
203
|
store: Y
|
|
204
|
-
}), /* @__PURE__ */
|
|
204
|
+
}), /* @__PURE__ */ x(v, {
|
|
205
205
|
store: Y,
|
|
206
|
-
children: /* @__PURE__ */
|
|
207
|
-
contentActions: /* @__PURE__ */
|
|
208
|
-
contentHeader: /* @__PURE__ */
|
|
206
|
+
children: /* @__PURE__ */ S(O, {
|
|
207
|
+
contentActions: /* @__PURE__ */ x(ue, {}),
|
|
208
|
+
contentHeader: /* @__PURE__ */ x(le, {
|
|
209
209
|
caption: P ? A("{{userName}} effective rights", { userName: k.getUserDisplayValue(P, A) }) : A`⌛ Loading...`,
|
|
210
210
|
component: "h2",
|
|
211
211
|
variant: "h2"
|
|
212
212
|
}),
|
|
213
213
|
fullWidth: !0,
|
|
214
214
|
showBreadcrumbs: !0,
|
|
215
|
-
testIdAttributes:
|
|
215
|
+
testIdAttributes: T.createAttributes("UsersEffectiveRightsAdminPage"),
|
|
216
216
|
title: A`Users effective rights`,
|
|
217
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ x(f, {
|
|
218
218
|
sx: {
|
|
219
219
|
height: "100%",
|
|
220
220
|
position: "relative"
|
|
221
221
|
},
|
|
222
|
-
children: /* @__PURE__ */
|
|
222
|
+
children: /* @__PURE__ */ S(ae, {
|
|
223
223
|
error: F,
|
|
224
224
|
inlineSpinner: !0,
|
|
225
225
|
isLoading: I,
|
|
226
226
|
loadables: J,
|
|
227
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: [/* @__PURE__ */ x(de, {}), /* @__PURE__ */ x(f, {
|
|
228
228
|
sx: {
|
|
229
229
|
height: "100%",
|
|
230
|
-
paddingLeft: j.spacing(
|
|
230
|
+
paddingLeft: j.spacing(re.getInstance().config.layout.SIDEBAR_MENU_WIDTH + 1),
|
|
231
231
|
width: "100%"
|
|
232
232
|
},
|
|
233
|
-
children: /* @__PURE__ */
|
|
233
|
+
children: /* @__PURE__ */ x(ce, {
|
|
234
234
|
getRowName: me,
|
|
235
235
|
onRowClick: he
|
|
236
236
|
})
|
|
237
237
|
})]
|
|
238
238
|
})
|
|
239
|
-
}), /* @__PURE__ */
|
|
239
|
+
}), /* @__PURE__ */ x(te, { ref: M })]
|
|
240
240
|
})
|
|
241
241
|
});
|
|
242
242
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pages/UserEffectiveRightsAdminPage/UserEffectiveRightsAdminPage.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport {\n Box,\n Link,\n useTheme,\n} from '@mui/material';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport type { MouseEvent as ReactMouseEvent } from 'react';\nimport { useParams } from 'react-router-dom';\nimport type { CaseDbUser } from '@gen-epix/api-casedb';\nimport { CaseDbOrganizationApi } from '@gen-epix/api-casedb';\nimport type {\n TableColumn,\n TableRowParams,\n} from '@gen-epix/ui-client-common/models/table';\nimport { COMMON_QUERY_KEY } from '@gen-epix/ui-client-common/constants/query';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\nimport {\n createTableStore,\n TableStoreContextProvider,\n} from '@gen-epix/ui-client-common/stores/tableStore';\nimport { PageContainer } from '@gen-epix/ui-client-common/components/ui/PageContainer';\nimport { ResponseHandler } from '@gen-epix/ui-client-common/components/ui/ResponseHandler';\nimport { RouterService } from '@gen-epix/ui-client-common/classes/services/RouterService';\nimport {\n Table,\n TableCaption,\n TableMenu,\n TableSidebarMenu,\n} from '@gen-epix/ui-client-common/components/ui/Table';\nimport { TableUtil } from '@gen-epix/ui-client-common/utils/TableUtil';\nimport { useInitializeTableStore } from '@gen-epix/ui-client-common/hooks/useInitializeTableStore';\nimport { useItemQuery } from '@gen-epix/ui-client-common/hooks/useItemQuery';\nimport { UserUtil } from '@gen-epix/ui-client-common/utils/UserUtil';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\n\nimport type {\n UsersEffectiveRightsDetailsDialogOpenProps,\n UsersEffectiveRightsDetailsDialogRefMethods,\n} from '../../components/ui/UsersEffectiveRightsDetailsDialog';\nimport { UsersEffectiveRightsDetailsDialog } from '../../components/ui/UsersEffectiveRightsDetailsDialog';\nimport { useCaseTypeSetMembersQuery } from '../../dataHooks/useCaseTypeSetMembersQuery';\nimport {\n useCaseTypeSetNameFactory,\n useCaseTypeSetsMapQuery,\n} from '../../dataHooks/useCaseTypeSetsQuery';\nimport { useColSetMembersQuery } from '../../dataHooks/useColSetMembersQuery';\nimport { useColSetMapQuery } from '../../dataHooks/useColSetsQuery';\nimport {\n useDataCollectionOptionsQuery,\n useDataCollectionsMapQuery,\n} from '../../dataHooks/useDataCollectionsQuery';\nimport { useOrganizationAccessCasePoliciesQuery } from '../../dataHooks/useOrganizationAccessCasePoliciesQuery';\nimport { useOrganizationShareCasePoliciesQuery } from '../../dataHooks/useOrganizationShareCasePoliciesQuery';\nimport { useUserAccessCasePoliciesQuery } from '../../dataHooks/useUserAccessCasePoliciesQuery';\nimport { useUserShareCasePoliciesQuery } from '../../dataHooks/useUserShareCasePoliciesQuery';\nimport type { UserEffectiveRight } from '../../models/caseAccess';\nimport { EffectiveRightsUtil } from '../../utils/EffectiveRightsUtil';\n\n\nexport const UserEffectiveRightsAdminPage = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const usersEffectiveRightsDetailsDialogRef = useRef<UsersEffectiveRightsDetailsDialogRefMethods>(null);\n\n const { userId } = useParams();\n\n const { data: user, error: userError, isLoading: isUserLoading } = useItemQuery<CaseDbUser>({\n baseQueryKey: COMMON_QUERY_KEY.USERS,\n itemId: userId,\n useQueryOptions: {\n queryFn: async ({ signal }) => {\n const response = await CaseDbOrganizationApi.getInstance().usersGetOne(userId, { signal });\n return response.data;\n },\n },\n });\n\n const colSetMembersQuery = useColSetMembersQuery();\n const caseTypeSetsMapQuery = useCaseTypeSetsMapQuery();\n const colSetMapQuery = useColSetMapQuery();\n const caseTypeSetMembersQuery = useCaseTypeSetMembersQuery();\n const caseTypeSetNameFactory = useCaseTypeSetNameFactory();\n const dataCollectionMapQuery = useDataCollectionsMapQuery();\n const dataCollectionOptionsQuery = useDataCollectionOptionsQuery();\n const organizationAccessCasePoliciesQuery = useOrganizationAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === user.organization_id));\n const organizationShareCasePoliciesQuery = useOrganizationShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === user.organization_id));\n const userAccessCasePoliciesQuery = useUserAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === user.id));\n const userShareCasePoliciesQuery = useUserShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === user.id));\n\n const loadables = useArray([\n organizationAccessCasePoliciesQuery,\n organizationShareCasePoliciesQuery,\n userAccessCasePoliciesQuery,\n userShareCasePoliciesQuery,\n caseTypeSetMembersQuery,\n colSetMembersQuery,\n dataCollectionMapQuery,\n dataCollectionOptionsQuery,\n colSetMapQuery,\n caseTypeSetNameFactory,\n caseTypeSetsMapQuery,\n ]);\n\n const tableStore = useMemo(() => createTableStore<UserEffectiveRight>({\n defaultSortByField: 'data_collection_id',\n defaultSortDirection: 'asc',\n idSelectorCallback: (entry) => entry.data_collection_id,\n navigatorFunction: RouterService.getInstance().router.navigate,\n storageNamePostFix: 'UsersEffectiveRightsAdminPage-Table',\n storageVersion: 1,\n }), []);\n\n const effectiveRights = useMemo<UserEffectiveRight[]>(() => {\n const { data: organizationAccessCasePolicies } = organizationAccessCasePoliciesQuery;\n const { data: organizationShareCasePolicies } = organizationShareCasePoliciesQuery;\n const { data: userAccessCasePolicies } = userAccessCasePoliciesQuery;\n const { data: userShareCasePolicies } = userShareCasePoliciesQuery;\n const { data: caseTypeSetMembers } = caseTypeSetMembersQuery;\n const { data: colSetMembers } = colSetMembersQuery;\n\n return EffectiveRightsUtil.assembleUserEffectiveRights({\n caseTypeSetMembers,\n colSetMembers,\n organizationAccessCasePolicies,\n organizationShareCasePolicies,\n user,\n userAccessCasePolicies,\n userShareCasePolicies,\n });\n\n }, [colSetMembersQuery, caseTypeSetMembersQuery, organizationAccessCasePoliciesQuery, organizationShareCasePoliciesQuery, user, userAccessCasePoliciesQuery, userShareCasePoliciesQuery]);\n\n const renderSetCell = useCallback((params: { getName: (memberId: string) => string; setIds: string[]; type: UsersEffectiveRightsDetailsDialogOpenProps['type']; uncategorizedMemberIds: string[]; userEffectiveRight: UserEffectiveRight }) => {\n const { getName, setIds, type, uncategorizedMemberIds, userEffectiveRight } = params;\n const onLinkClick = (event: ReactMouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n usersEffectiveRightsDetailsDialogRef.current.open({\n type,\n user,\n userEffectiveRight,\n });\n };\n\n if (uncategorizedMemberIds.length > 0) {\n return (\n <Link\n href={'#'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={onLinkClick}\n tabIndex={0}\n >\n {t`View all`}\n </Link>\n );\n }\n if (setIds.length > 2) {\n return (\n <Link\n href={'#'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={onLinkClick}\n tabIndex={0}\n >\n {t('View {{numSets}} sets', { numSets: setIds.length })}\n </Link>\n );\n }\n\n return (\n <>\n {setIds.map(setId => (\n <Link\n href={'#'}\n key={setId}\n\n onClick={onLinkClick}\n >\n {getName(setId) ?? setId}\n </Link>\n ))}\n </>\n );\n }, [t, user]);\n\n const renderCaseTypeSetsCell = useCallback(({ row }: TableRowParams<UserEffectiveRight>) => {\n return renderSetCell({\n getName: (caseTypeId: string) => caseTypeSetNameFactory.getName(caseTypeSetsMapQuery.map.get(caseTypeId)),\n setIds: row.case_type_set_ids,\n type: 'caseTypeSets',\n uncategorizedMemberIds: row.uncategorized_case_type_ids,\n userEffectiveRight: row,\n });\n }, [caseTypeSetNameFactory, caseTypeSetsMapQuery.map, renderSetCell]);\n\n const renderReadCaseSetsCell = useCallback(({ row }: TableRowParams<UserEffectiveRight>) => {\n return renderSetCell({\n getName: (colId: string) => colSetMapQuery.map.get(colId).name,\n setIds: row.read_col_set_ids,\n type: 'readColSets',\n uncategorizedMemberIds: row.uncategorized_read_col_ids,\n userEffectiveRight: row,\n });\n }, [colSetMapQuery.map, renderSetCell]);\n\n const renderWriteCaseSetsCell = useCallback(({ row }: TableRowParams<UserEffectiveRight>) => {\n return renderSetCell({\n getName: (colId: string) => colSetMapQuery.map.get(colId)?.name,\n setIds: row.write_col_set_ids,\n type: 'writeColSets',\n uncategorizedMemberIds: row.uncategorized_write_col_ids,\n userEffectiveRight: row,\n });\n }, [colSetMapQuery.map, renderSetCell]);\n\n const tableColumns = useMemo<TableColumn<UserEffectiveRight>[]>(() => {\n return [\n TableUtil.createReadableIndexColumn(),\n TableUtil.createOptionsColumn({ id: 'data_collection_id', name: t`Data collection`, options: dataCollectionOptionsQuery.options }),\n {\n headerName: t`Case type sets`,\n hideInFilter: true,\n id: 'case_type_set_ids',\n isInitiallyVisible: true,\n renderCell: renderCaseTypeSetsCell,\n type: 'text',\n widthFlex: 1,\n },\n {\n headerName: t`Read column sets`,\n hideInFilter: true,\n id: 'read_col_set_ids',\n isInitiallyVisible: true,\n renderCell: renderReadCaseSetsCell,\n type: 'text',\n widthFlex: 1,\n },\n {\n headerName: t`Write column sets`,\n hideInFilter: true,\n id: 'write_col_set_ids',\n isInitiallyVisible: true,\n renderCell: renderWriteCaseSetsCell,\n type: 'text',\n widthFlex: 1,\n },\n\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'add_case', name: t`Add case` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'remove_case', name: t`Remove case` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'add_case_set', name: t`Add case set` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'remove_case_set', name: t`Remove case set` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'read_case_set', name: t`Read case set` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'write_case_set', name: t`Write case set` }),\n {\n headerName: t`Addition al rights`,\n id: 'has_additional_rights',\n isInitiallyVisible: true,\n type: 'boolean',\n valueGetter: (params) => params.row.effective_share_case_rights.length > 0,\n widthFlex: 0.25,\n },\n ];\n }, [dataCollectionOptionsQuery.options, renderCaseTypeSetsCell, renderReadCaseSetsCell, renderWriteCaseSetsCell, t]);\n\n const getRowName = useCallback((row: UserEffectiveRight) => {\n return dataCollectionMapQuery.map.get(row.data_collection_id)?.name ?? row.data_collection_id;\n }, [dataCollectionMapQuery.map]);\n\n const onRowClick = useCallback((params: TableRowParams<UserEffectiveRight>) => {\n usersEffectiveRightsDetailsDialogRef.current.open({\n type: 'caseTypeSets',\n user,\n userEffectiveRight: params.row,\n });\n }, [user]);\n\n useInitializeTableStore({ columns: tableColumns, createFiltersFromColumns: true, rows: effectiveRights, store: tableStore });\n\n return (\n <TableStoreContextProvider store={tableStore}>\n <PageContainer\n contentActions={(<TableMenu />)}\n contentHeader={(\n <TableCaption\n caption={user ? t('{{userName}} effective rights', { userName: UserUtil.getUserDisplayValue(user, t) }) : t`⌛ Loading...`}\n component={'h2'}\n variant={'h2'}\n />\n )}\n fullWidth\n showBreadcrumbs\n testIdAttributes={TestIdUtil.createAttributes('UsersEffectiveRightsAdminPage')}\n title={t`Users effective rights`}\n >\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n <ResponseHandler\n error={userError}\n inlineSpinner\n isLoading={isUserLoading}\n loadables={loadables}\n >\n <TableSidebarMenu />\n <Box\n sx={{\n height: '100%',\n paddingLeft: theme.spacing(ConfigService.getInstance().config.layout.SIDEBAR_MENU_WIDTH + 1),\n width: '100%',\n }}\n >\n <Table\n getRowName={getRowName}\n onRowClick={onRowClick}\n />\n </Box>\n </ResponseHandler>\n </Box>\n <UsersEffectiveRightsDetailsDialog ref={usersEffectiveRightsDetailsDialogRef} />\n </PageContainer>\n </TableStoreContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAa,UAAqC;CAChD,IAAM,EAAE,SAAM,EAAe,GACvB,IAAQ,EAAS,GACjB,IAAuC,EAAoD,IAAI,GAE/F,EAAE,cAAW,EAAU,GAEvB,EAAE,MAAM,GAAM,OAAO,GAAW,WAAW,MAAkB,GAAyB;EAC1F,cAAc,EAAiB;EAC/B,QAAQ;EACR,iBAAiB,EACf,SAAS,OAAO,EAAE,iBAET,MADgB,GAAsB,YAAY,CAAC,CAAC,YAAY,GAAQ,EAAE,UAAO,CAAC,EAAA,CACzE,KAEpB;CACF,CAAC,GAEK,IAAqB,EAAsB,GAC3C,IAA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EAChC,UAAA,kBAAC,GAAD;GACE,gBAAiB,kBAAC,IAAD,CAAY,CAAA;GAC7B,eACE,kBAAC,IAAD;IACE,SAAS,IAAO,EAAE,iCAAiC,EAAE,UAAU,EAAS,oBAAoB,GAAM,CAAC,EAAE,CAAC,IAAI,CAAC;IAC3G,WAAW;IACX,SAAS;GACV,CAAA;GAEH,WAAA;GACA,iBAAA;GACA,kBAAkB,EAAW,iBAAiB,+BAA+B;GAC7E,OAAO,CAAC;GAZV,UAAA,CAcE,kBAAC,GAAD;IACE,IAAI;KACF,QAAQ;KACR,UAAU;IACZ;IAEA,UAAA,kBAAC,IAAD;KACE,OAAO;KACP,eAAA;KACA,WAAW;KACA;KAJb,UAAA,CAME,kBAAC,IAAD,CAAmB,CAAA,GACnB,kBAAC,GAAD;MACE,IAAI;OACF,QAAQ;OACR,aAAa,EAAM,QAAQ,EAAc,YAAY,CAAC,CAAC,OAAO,OAAO,qBAAqB,CAAC;OAC3F,OAAO;MACT;MAEA,UAAA,kBAAC,IAAD;OACc;OACA;MACb,CAAA;KACE,CAAA,CACU;;GACd,CAAA,GACL,kBAAC,IAAD,EAAmC,KAAK,EAAuC,CAAA,CAClE;;CACU,CAAA;AAE/B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pages/UserEffectiveRightsAdminPage/UserEffectiveRightsAdminPage.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport {\n Box,\n Link,\n useTheme,\n} from '@mui/material';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport type { MouseEvent as ReactMouseEvent } from 'react';\nimport { useParams } from 'react-router-dom';\nimport type { CaseDbUser } from '@gen-epix/api-casedb';\nimport { CaseDbOrganizationApi } from '@gen-epix/api-casedb';\nimport type {\n TableColumn,\n TableRowParams,\n} from '@gen-epix/ui-client-common/models/table';\nimport { COMMON_QUERY_KEY } from '@gen-epix/ui-client-common/constants/query';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\nimport {\n createTableStore,\n TableStoreContextProvider,\n} from '@gen-epix/ui-client-common/stores/tableStore';\nimport { PageContainer } from '@gen-epix/ui-client-common/components/ui/PageContainer';\nimport { ResponseHandler } from '@gen-epix/ui-client-common/components/ui/ResponseHandler';\nimport { RouterService } from '@gen-epix/ui-client-common/classes/services/RouterService';\nimport {\n Table,\n TableCaption,\n TableMenu,\n TableSidebarMenu,\n} from '@gen-epix/ui-client-common/components/ui/Table';\nimport { TableUtil } from '@gen-epix/ui-client-common/utils/TableUtil';\nimport { useInitializeTableStore } from '@gen-epix/ui-client-common/hooks/useInitializeTableStore';\nimport { useItemQuery } from '@gen-epix/ui-client-common/hooks/useItemQuery';\nimport { UserUtil } from '@gen-epix/ui-client-common/utils/UserUtil';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\n\nimport type {\n UsersEffectiveRightsDetailsDialogOpenProps,\n UsersEffectiveRightsDetailsDialogRefMethods,\n} from '../../components/ui/UsersEffectiveRightsDetailsDialog';\nimport { UsersEffectiveRightsDetailsDialog } from '../../components/ui/UsersEffectiveRightsDetailsDialog';\nimport { useCaseTypeSetMembersQuery } from '../../dataHooks/useCaseTypeSetMembersQuery';\nimport {\n useCaseTypeSetNameFactory,\n useCaseTypeSetsMapQuery,\n} from '../../dataHooks/useCaseTypeSetsQuery';\nimport { useColSetMembersQuery } from '../../dataHooks/useColSetMembersQuery';\nimport { useColSetMapQuery } from '../../dataHooks/useColSetsQuery';\nimport {\n useDataCollectionOptionsQuery,\n useDataCollectionsMapQuery,\n} from '../../dataHooks/useDataCollectionsQuery';\nimport { useOrganizationAccessCasePoliciesQuery } from '../../dataHooks/useOrganizationAccessCasePoliciesQuery';\nimport { useOrganizationShareCasePoliciesQuery } from '../../dataHooks/useOrganizationShareCasePoliciesQuery';\nimport { useUserAccessCasePoliciesQuery } from '../../dataHooks/useUserAccessCasePoliciesQuery';\nimport { useUserShareCasePoliciesQuery } from '../../dataHooks/useUserShareCasePoliciesQuery';\nimport type { UserEffectiveRight } from '../../models/caseAccess';\nimport { EffectiveRightsUtil } from '../../utils/EffectiveRightsUtil';\n\n\nexport const UserEffectiveRightsAdminPage = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const usersEffectiveRightsDetailsDialogRef = useRef<UsersEffectiveRightsDetailsDialogRefMethods>(null);\n\n const { userId } = useParams();\n\n const { data: user, error: userError, isLoading: isUserLoading } = useItemQuery<CaseDbUser>({\n baseQueryKey: COMMON_QUERY_KEY.USERS,\n itemId: userId,\n useQueryOptions: {\n queryFn: async ({ signal }) => {\n const response = await CaseDbOrganizationApi.getInstance().usersGetOne(userId, { signal });\n return response.data;\n },\n },\n });\n\n const colSetMembersQuery = useColSetMembersQuery();\n const caseTypeSetsMapQuery = useCaseTypeSetsMapQuery();\n const colSetMapQuery = useColSetMapQuery();\n const caseTypeSetMembersQuery = useCaseTypeSetMembersQuery();\n const caseTypeSetNameFactory = useCaseTypeSetNameFactory();\n const dataCollectionMapQuery = useDataCollectionsMapQuery();\n const dataCollectionOptionsQuery = useDataCollectionOptionsQuery();\n const organizationAccessCasePoliciesQuery = useOrganizationAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === user.organization_id));\n const organizationShareCasePoliciesQuery = useOrganizationShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === user.organization_id));\n const userAccessCasePoliciesQuery = useUserAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === user.id));\n const userShareCasePoliciesQuery = useUserShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === user.id));\n\n const loadables = useArray([\n organizationAccessCasePoliciesQuery,\n organizationShareCasePoliciesQuery,\n userAccessCasePoliciesQuery,\n userShareCasePoliciesQuery,\n caseTypeSetMembersQuery,\n colSetMembersQuery,\n dataCollectionMapQuery,\n dataCollectionOptionsQuery,\n colSetMapQuery,\n caseTypeSetNameFactory,\n caseTypeSetsMapQuery,\n ]);\n\n const tableStore = useMemo(() => createTableStore<UserEffectiveRight>({\n defaultSortByField: 'data_collection_id',\n defaultSortDirection: 'asc',\n idSelectorCallback: (entry) => entry.data_collection_id,\n navigatorFunction: RouterService.getInstance().router.navigate,\n storageNamePostFix: 'UsersEffectiveRightsAdminPage-Table',\n storageVersion: 1,\n }), []);\n\n const effectiveRights = useMemo<UserEffectiveRight[]>(() => {\n const { data: organizationAccessCasePolicies } = organizationAccessCasePoliciesQuery;\n const { data: organizationShareCasePolicies } = organizationShareCasePoliciesQuery;\n const { data: userAccessCasePolicies } = userAccessCasePoliciesQuery;\n const { data: userShareCasePolicies } = userShareCasePoliciesQuery;\n const { data: caseTypeSetMembers } = caseTypeSetMembersQuery;\n const { data: colSetMembers } = colSetMembersQuery;\n\n return EffectiveRightsUtil.assembleUserEffectiveRights({\n caseTypeSetMembers,\n colSetMembers,\n organizationAccessCasePolicies,\n organizationShareCasePolicies,\n user,\n userAccessCasePolicies,\n userShareCasePolicies,\n });\n\n }, [colSetMembersQuery, caseTypeSetMembersQuery, organizationAccessCasePoliciesQuery, organizationShareCasePoliciesQuery, user, userAccessCasePoliciesQuery, userShareCasePoliciesQuery]);\n\n const renderSetCell = useCallback((params: { getName: (memberId: string) => string; setIds: string[]; type: UsersEffectiveRightsDetailsDialogOpenProps['type']; uncategorizedMemberIds: string[]; userEffectiveRight: UserEffectiveRight }) => {\n const { getName, setIds, type, uncategorizedMemberIds, userEffectiveRight } = params;\n const onLinkClick = (event: ReactMouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n usersEffectiveRightsDetailsDialogRef.current.open({\n type,\n user,\n userEffectiveRight,\n });\n };\n\n if (uncategorizedMemberIds.length > 0) {\n return (\n <Link\n href={'#'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={onLinkClick}\n tabIndex={0}\n >\n {t`View all`}\n </Link>\n );\n }\n if (setIds.length > 2) {\n return (\n <Link\n href={'#'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={onLinkClick}\n tabIndex={0}\n >\n {t('View {{numSets}} sets', { numSets: setIds.length })}\n </Link>\n );\n }\n\n return (\n <>\n {setIds.map(setId => (\n <Link\n href={'#'}\n key={setId}\n\n onClick={onLinkClick}\n >\n {getName(setId) ?? setId}\n </Link>\n ))}\n </>\n );\n }, [t, user]);\n\n const renderCaseTypeSetsCell = useCallback(({ row }: TableRowParams<UserEffectiveRight>) => {\n return renderSetCell({\n getName: (caseTypeId: string) => caseTypeSetNameFactory.getName(caseTypeSetsMapQuery.map.get(caseTypeId)),\n setIds: row.case_type_set_ids,\n type: 'caseTypeSets',\n uncategorizedMemberIds: row.uncategorized_case_type_ids,\n userEffectiveRight: row,\n });\n }, [caseTypeSetNameFactory, caseTypeSetsMapQuery.map, renderSetCell]);\n\n const renderReadCaseSetsCell = useCallback(({ row }: TableRowParams<UserEffectiveRight>) => {\n return renderSetCell({\n getName: (colId: string) => colSetMapQuery.map.get(colId).name,\n setIds: row.read_col_set_ids,\n type: 'readColSets',\n uncategorizedMemberIds: row.uncategorized_read_col_ids,\n userEffectiveRight: row,\n });\n }, [colSetMapQuery.map, renderSetCell]);\n\n const renderWriteCaseSetsCell = useCallback(({ row }: TableRowParams<UserEffectiveRight>) => {\n return renderSetCell({\n getName: (colId: string) => colSetMapQuery.map.get(colId)?.name,\n setIds: row.write_col_set_ids,\n type: 'writeColSets',\n uncategorizedMemberIds: row.uncategorized_write_col_ids,\n userEffectiveRight: row,\n });\n }, [colSetMapQuery.map, renderSetCell]);\n\n const tableColumns = useMemo<TableColumn<UserEffectiveRight>[]>(() => {\n return [\n TableUtil.createReadableIndexColumn(),\n TableUtil.createOptionsColumn({ id: 'data_collection_id', name: t`Data collection`, options: dataCollectionOptionsQuery.options }),\n {\n headerName: t`Case type sets`,\n hideInFilter: true,\n id: 'case_type_set_ids',\n isInitiallyVisible: true,\n renderCell: renderCaseTypeSetsCell,\n type: 'text',\n widthFlex: 1,\n },\n {\n headerName: t`Read column sets`,\n hideInFilter: true,\n id: 'read_col_set_ids',\n isInitiallyVisible: true,\n renderCell: renderReadCaseSetsCell,\n type: 'text',\n widthFlex: 1,\n },\n {\n headerName: t`Write column sets`,\n hideInFilter: true,\n id: 'write_col_set_ids',\n isInitiallyVisible: true,\n renderCell: renderWriteCaseSetsCell,\n type: 'text',\n widthFlex: 1,\n },\n\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'add_case', name: t`Add case` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'remove_case', name: t`Remove case` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'add_case_set', name: t`Add case set` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'remove_case_set', name: t`Remove case set` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'read_case_set', name: t`Read case set` }),\n TableUtil.createBooleanColumn<UserEffectiveRight>({ id: 'write_case_set', name: t`Write case set` }),\n {\n headerName: t`Addition al rights`,\n id: 'has_additional_rights',\n isInitiallyVisible: true,\n type: 'boolean',\n valueGetter: (params) => params.row.effective_share_case_rights.length > 0,\n widthFlex: 0.25,\n },\n ];\n }, [dataCollectionOptionsQuery.options, renderCaseTypeSetsCell, renderReadCaseSetsCell, renderWriteCaseSetsCell, t]);\n\n const getRowName = useCallback((row: UserEffectiveRight) => {\n return dataCollectionMapQuery.map.get(row.data_collection_id)?.name ?? row.data_collection_id;\n }, [dataCollectionMapQuery.map]);\n\n const onRowClick = useCallback((params: TableRowParams<UserEffectiveRight>) => {\n usersEffectiveRightsDetailsDialogRef.current.open({\n type: 'caseTypeSets',\n user,\n userEffectiveRight: params.row,\n });\n }, [user]);\n\n useInitializeTableStore({ columns: tableColumns, createFiltersFromColumns: true, rows: effectiveRights, store: tableStore });\n\n return (\n <TableStoreContextProvider store={tableStore}>\n <PageContainer\n contentActions={(<TableMenu />)}\n contentHeader={(\n <TableCaption\n caption={user ? t('{{userName}} effective rights', { userName: UserUtil.getUserDisplayValue(user, t) }) : t`⌛ Loading...`}\n component={'h2'}\n variant={'h2'}\n />\n )}\n fullWidth\n showBreadcrumbs\n testIdAttributes={TestIdUtil.createAttributes('UsersEffectiveRightsAdminPage')}\n title={t`Users effective rights`}\n >\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n <ResponseHandler\n error={userError}\n inlineSpinner\n isLoading={isUserLoading}\n loadables={loadables}\n >\n <TableSidebarMenu />\n <Box\n sx={{\n height: '100%',\n paddingLeft: theme.spacing(ConfigService.getInstance().config.layout.SIDEBAR_MENU_WIDTH + 1),\n width: '100%',\n }}\n >\n <Table\n getRowName={getRowName}\n onRowClick={onRowClick}\n />\n </Box>\n </ResponseHandler>\n </Box>\n <UsersEffectiveRightsDetailsDialog ref={usersEffectiveRightsDetailsDialogRef} />\n </PageContainer>\n </TableStoreContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAa,UAAqC;CAChD,IAAM,EAAE,SAAM,EAAe,GACvB,IAAQ,GAAS,GACjB,IAAuC,EAAoD,IAAI,GAE/F,EAAE,cAAW,EAAU,GAEvB,EAAE,MAAM,GAAM,OAAO,GAAW,WAAW,MAAkB,GAAyB;EAC1F,cAAc,EAAiB;EAC/B,QAAQ;EACR,iBAAiB,EACf,SAAS,OAAO,EAAE,iBAET,MADgB,EAAsB,YAAY,CAAC,CAAC,YAAY,GAAQ,EAAE,UAAO,CAAC,EAAA,CACzE,KAEpB;CACF,CAAC,GAEK,IAAqB,EAAsB,GAC3C,IAAuB,EAAwB,GAC/C,IAAiB,GAAkB,GACnC,IAA0B,EAA2B,GACrD,IAAyB,EAA0B,GACnD,IAAyB,EAA2B,GACpD,IAA6B,EAA8B,GAC3D,IAAsC,GAAuC,MAAY,EAAS,QAAO,MAAU,EAAO,aAAa,EAAO,oBAAoB,EAAK,eAAe,CAAC,GACvL,IAAqC,GAAsC,MAAY,EAAS,QAAO,MAA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kBAAkB,EAAW,iBAAiB,+BAA+B;GAC7E,OAAO,CAAC;GAZV,UAAA,CAcE,kBAAC,GAAD;IACE,IAAI;KACF,QAAQ;KACR,UAAU;IACZ;IAEA,UAAA,kBAAC,IAAD;KACE,OAAO;KACP,eAAA;KACA,WAAW;KACA;KAJb,UAAA,CAME,kBAAC,IAAD,CAAmB,CAAA,GACnB,kBAAC,GAAD;MACE,IAAI;OACF,QAAQ;OACR,aAAa,EAAM,QAAQ,GAAc,YAAY,CAAC,CAAC,OAAO,OAAO,qBAAqB,CAAC;OAC3F,OAAO;MACT;MAEA,UAAA,kBAAC,IAAD;OACc;OACA;MACb,CAAA;KACE,CAAA,CACU;;GACd,CAAA,GACL,kBAAC,IAAD,EAAmC,KAAK,EAAuC,CAAA,CAClE;;CACU,CAAA;AAE/B"}
|
package/dist/pages/UserEffectiveRightsTesterAdminPage/UserEffectiveRightsTesterAdminPage.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const UserEffectiveRightsTesterAdminPage: () => import(
|
|
1
|
+
export declare const UserEffectiveRightsTesterAdminPage: () => import('react').JSX.Element;
|
|
@@ -5,35 +5,35 @@ import { t as r } from "../../_chunks/yup.js";
|
|
|
5
5
|
import { useCaseTypeOptionsQuery as i } from "../../dataHooks/useCaseTypesQuery/index.js";
|
|
6
6
|
import { useDataCollectionOptionsQuery as a } from "../../dataHooks/useDataCollectionsQuery/index.js";
|
|
7
7
|
import { useCaseTypeSetMembersQuery as o } from "../../dataHooks/useCaseTypeSetMembersQuery/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useId as ee, useMemo as x } from "react";
|
|
8
|
+
import { useColSetMembersQuery as s } from "../../dataHooks/useColSetMembersQuery/index.js";
|
|
9
|
+
import { useOrganizationAccessCasePoliciesQuery as c } from "../../dataHooks/useOrganizationAccessCasePoliciesQuery/index.js";
|
|
10
|
+
import { useOrganizationShareCasePoliciesQuery as l } from "../../dataHooks/useOrganizationShareCasePoliciesQuery/index.js";
|
|
11
|
+
import { useUserAccessCasePoliciesQuery as u } from "../../dataHooks/useUserAccessCasePoliciesQuery/index.js";
|
|
12
|
+
import { useUserShareCasePoliciesQuery as d } from "../../dataHooks/useUserShareCasePoliciesQuery/index.js";
|
|
13
|
+
import { object as f, string as p } from "yup";
|
|
14
|
+
import { CaseDbOrganizationApi as m } from "@gen-epix/api-casedb";
|
|
15
|
+
import { FORM_FIELD_DEFINITION_TYPE as h } from "@gen-epix/ui-core-form/models/form";
|
|
16
|
+
import { COMMON_QUERY_KEY as g } from "@gen-epix/ui-client-common/constants/query";
|
|
17
|
+
import { Box as _, Container as v, Typography as y } from "@mui/material";
|
|
18
|
+
import { useId as b, useMemo as x } from "react";
|
|
20
19
|
import { useTranslation as S } from "react-i18next";
|
|
21
20
|
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
22
21
|
import { ResponseHandler as T } from "@gen-epix/ui-client-common/components/ui/ResponseHandler";
|
|
23
22
|
import { useItemQuery as E } from "@gen-epix/ui-client-common/hooks/useItemQuery";
|
|
24
23
|
import { useArray as D } from "@gen-epix/ui-core/hooks/useArray";
|
|
25
24
|
import { useForm as O, useWatch as k } from "react-hook-form";
|
|
26
|
-
import { GenericForm as
|
|
27
|
-
import { TestIdUtil as
|
|
25
|
+
import { GenericForm as ee } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
|
|
26
|
+
import { TestIdUtil as A } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
27
|
+
import { useParams as j } from "react-router-dom";
|
|
28
28
|
import { PageContainer as M } from "@gen-epix/ui-client-common/components/ui/PageContainer";
|
|
29
29
|
import { useOrganizationMapQuery as N } from "@gen-epix/ui-client-common/dataHooks/useOrganizationsQuery";
|
|
30
30
|
//#region src/pages/UserEffectiveRightsTesterAdminPage/UserEffectiveRightsTesterAdminPage.tsx
|
|
31
31
|
var P = /* @__PURE__ */ e(t(), 1), F = () => {
|
|
32
|
-
let { t: e } = S(), t =
|
|
33
|
-
baseQueryKey:
|
|
32
|
+
let { t: e } = S(), t = b(), { userId: F } = j(), I = E({
|
|
33
|
+
baseQueryKey: g.USERS,
|
|
34
34
|
itemId: F,
|
|
35
|
-
useQueryOptions: { queryFn: async ({ signal: e }) => (await
|
|
36
|
-
}), L =
|
|
35
|
+
useQueryOptions: { queryFn: async ({ signal: e }) => (await m.getInstance().usersGetOne(F, { signal: e })).data }
|
|
36
|
+
}), L = s(), R = i(), z = N(), B = o(), V = a(), H = c((e) => e.filter((e) => e.is_active && e.organization_id === I.data?.organization_id)), U = l((e) => e.filter((e) => e.is_active && e.organization_id === I.data?.organization_id)), W = u((e) => e.filter((e) => e.is_active && e.user_id === I.data?.id)), G = d((e) => e.filter((e) => e.is_active && e.user_id === I.data?.id)), K = D([
|
|
37
37
|
I,
|
|
38
38
|
L,
|
|
39
39
|
R,
|
|
@@ -63,10 +63,10 @@ var P = /* @__PURE__ */ e(t(), 1), F = () => {
|
|
|
63
63
|
W,
|
|
64
64
|
I.data,
|
|
65
65
|
G
|
|
66
|
-
]), J = x(() =>
|
|
67
|
-
caseTypeId:
|
|
68
|
-
dataCollectionId:
|
|
69
|
-
fromDataCollectionId:
|
|
66
|
+
]), J = x(() => f().shape({
|
|
67
|
+
caseTypeId: p().uuid4().required(),
|
|
68
|
+
dataCollectionId: p().uuid4().required(),
|
|
69
|
+
fromDataCollectionId: p().uuid4().nullable().notRequired()
|
|
70
70
|
}), []), Y = O({
|
|
71
71
|
resolver: r(J),
|
|
72
72
|
values: {
|
|
@@ -95,21 +95,21 @@ var P = /* @__PURE__ */ e(t(), 1), F = () => {
|
|
|
95
95
|
Q.fromDataCollectionId
|
|
96
96
|
]), te = x(() => [
|
|
97
97
|
{
|
|
98
|
-
definition:
|
|
98
|
+
definition: h.AUTOCOMPLETE,
|
|
99
99
|
label: e`Case type`,
|
|
100
100
|
loading: R.isLoading,
|
|
101
101
|
name: "caseTypeId",
|
|
102
102
|
options: R.options
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
|
-
definition:
|
|
105
|
+
definition: h.AUTOCOMPLETE,
|
|
106
106
|
label: e`Data collection`,
|
|
107
107
|
loading: V.isLoading,
|
|
108
108
|
name: "dataCollectionId",
|
|
109
109
|
options: V.options
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
|
-
definition:
|
|
112
|
+
definition: h.AUTOCOMPLETE,
|
|
113
113
|
disabled: !$?.has_share_case_rights,
|
|
114
114
|
label: e`From data collection`,
|
|
115
115
|
loading: V.isLoading,
|
|
@@ -127,9 +127,9 @@ var P = /* @__PURE__ */ e(t(), 1), F = () => {
|
|
|
127
127
|
return /* @__PURE__ */ C(M, {
|
|
128
128
|
fullWidth: !0,
|
|
129
129
|
showBreadcrumbs: !0,
|
|
130
|
-
testIdAttributes:
|
|
130
|
+
testIdAttributes: A.createAttributes("UserEffectiveRightsTesterAdminPage"),
|
|
131
131
|
title: e`Users effective rights`,
|
|
132
|
-
children: /* @__PURE__ */ C(
|
|
132
|
+
children: /* @__PURE__ */ C(_, {
|
|
133
133
|
sx: {
|
|
134
134
|
height: "100%",
|
|
135
135
|
position: "relative"
|
|
@@ -137,50 +137,50 @@ var P = /* @__PURE__ */ e(t(), 1), F = () => {
|
|
|
137
137
|
children: /* @__PURE__ */ C(T, {
|
|
138
138
|
inlineSpinner: !0,
|
|
139
139
|
loadables: K,
|
|
140
|
-
children: /* @__PURE__ */ w(
|
|
140
|
+
children: /* @__PURE__ */ w(v, {
|
|
141
141
|
maxWidth: "md",
|
|
142
142
|
children: [
|
|
143
|
-
/* @__PURE__ */ w(
|
|
143
|
+
/* @__PURE__ */ w(_, {
|
|
144
144
|
sx: { marginY: 2 },
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */ C(
|
|
146
|
+
/* @__PURE__ */ C(y, {
|
|
147
147
|
component: "h2",
|
|
148
148
|
variant: "h4",
|
|
149
149
|
children: e("Testing effective rights for user: {{userEmail}}", { userEmail: I.data?.email })
|
|
150
150
|
}),
|
|
151
|
-
/* @__PURE__ */ C(
|
|
152
|
-
/* @__PURE__ */ C(
|
|
151
|
+
/* @__PURE__ */ C(y, { children: e("Organization: {{organizationName}}", { organizationName: z.map.get(I.data?.organization_id)?.name }) }),
|
|
152
|
+
/* @__PURE__ */ C(y, { children: e("Roles: {{roles}}", { roles: I.data?.roles.join(", ") }) })
|
|
153
153
|
]
|
|
154
154
|
}),
|
|
155
|
-
/* @__PURE__ */ C(
|
|
155
|
+
/* @__PURE__ */ C(ee, {
|
|
156
156
|
formFieldDefinitions: te,
|
|
157
157
|
formId: t,
|
|
158
158
|
formMethods: Y,
|
|
159
159
|
onSubmit: Z(P.default),
|
|
160
160
|
schema: J
|
|
161
161
|
}),
|
|
162
|
-
typeof $ == "object" && !!$ && /* @__PURE__ */ w(
|
|
162
|
+
typeof $ == "object" && !!$ && /* @__PURE__ */ w(_, {
|
|
163
163
|
sx: { marginY: 2 },
|
|
164
164
|
children: [
|
|
165
|
-
/* @__PURE__ */ C(
|
|
165
|
+
/* @__PURE__ */ C(y, {
|
|
166
166
|
variant: "h6",
|
|
167
167
|
children: e("Effective rights result:")
|
|
168
168
|
}),
|
|
169
|
-
!Q.fromDataCollectionId && $.has_share_case_rights && /* @__PURE__ */ C(
|
|
169
|
+
!Q.fromDataCollectionId && $.has_share_case_rights && /* @__PURE__ */ C(_, {
|
|
170
170
|
sx: { marginY: 2 },
|
|
171
|
-
children: /* @__PURE__ */ C(
|
|
171
|
+
children: /* @__PURE__ */ C(y, {
|
|
172
172
|
sx: { fontStyle: "italic" },
|
|
173
173
|
children: e`Note: The user has share case rights that may affect the result when a 'From data collection' is selected.`
|
|
174
174
|
})
|
|
175
175
|
}),
|
|
176
|
-
/* @__PURE__ */ C(
|
|
177
|
-
/* @__PURE__ */ C(
|
|
178
|
-
/* @__PURE__ */ C(
|
|
179
|
-
/* @__PURE__ */ C(
|
|
180
|
-
/* @__PURE__ */ C(
|
|
181
|
-
/* @__PURE__ */ C(
|
|
182
|
-
/* @__PURE__ */ C(
|
|
183
|
-
/* @__PURE__ */ C(
|
|
176
|
+
/* @__PURE__ */ C(y, { children: e("Add case: {{addCase}}", { addCase: $?.add_case ? e`Yes` : e`No` }) }),
|
|
177
|
+
/* @__PURE__ */ C(y, { children: e("Remove case: {{removeCase}}", { removeCase: $?.remove_case ? e`Yes` : e`No` }) }),
|
|
178
|
+
/* @__PURE__ */ C(y, { children: e("Add case set: {{addCaseSet}}", { addCaseSet: $?.add_case_set ? e`Yes` : e`No` }) }),
|
|
179
|
+
/* @__PURE__ */ C(y, { children: e("Remove case set: {{removeCaseSet}}", { removeCaseSet: $?.remove_case_set ? e`Yes` : e`No` }) }),
|
|
180
|
+
/* @__PURE__ */ C(y, { children: e("Read case set: {{readCaseSet}}", { readCaseSet: $?.read_case_set ? e`Yes` : e`No` }) }),
|
|
181
|
+
/* @__PURE__ */ C(y, { children: e("Write case set: {{writeCaseSet}}", { writeCaseSet: $?.write_case_set ? e`Yes` : e`No` }) }),
|
|
182
|
+
/* @__PURE__ */ C(y, { children: e("Read case properties: {{readSomeProperties}}", { readSomeProperties: $?.read_col_ids?.length > 0 ? e`Yes` : e`No` }) }),
|
|
183
|
+
/* @__PURE__ */ C(y, { children: e("Write case properties: {{writeSomeProperties}}", { writeSomeProperties: $?.write_col_ids?.length > 0 ? e`Yes` : e`No` }) })
|
|
184
184
|
]
|
|
185
185
|
})
|
|
186
186
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pages/UserEffectiveRightsTesterAdminPage/UserEffectiveRightsTesterAdminPage.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport {\n Box,\n Container,\n Typography,\n} from '@mui/material';\nimport {\n useId,\n useMemo,\n} from 'react';\nimport { useParams } from 'react-router-dom';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport type { Resolver } from 'react-hook-form';\nimport {\n useForm,\n useWatch,\n} from 'react-hook-form';\nimport {\n object,\n string,\n} from 'yup';\nimport noop from 'lodash/noop';\nimport type { CaseDbUser } from '@gen-epix/api-casedb';\nimport { CaseDbOrganizationApi } from '@gen-epix/api-casedb';\nimport { COMMON_QUERY_KEY } from '@gen-epix/ui-client-common/constants/query';\nimport { PageContainer } from '@gen-epix/ui-client-common/components/ui/PageContainer';\nimport { ResponseHandler } from '@gen-epix/ui-client-common/components/ui/ResponseHandler';\nimport { useItemQuery } from '@gen-epix/ui-client-common/hooks/useItemQuery';\nimport { useOrganizationMapQuery } from '@gen-epix/ui-client-common/dataHooks/useOrganizationsQuery';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport { GenericForm } from '@gen-epix/ui-core-form/components/helpers/GenericForm';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\n\nimport { useColSetMembersQuery } from '../../dataHooks/useColSetMembersQuery';\nimport { useCaseTypeSetMembersQuery } from '../../dataHooks/useCaseTypeSetMembersQuery';\nimport { useDataCollectionOptionsQuery } from '../../dataHooks/useDataCollectionsQuery';\nimport { useOrganizationAccessCasePoliciesQuery } from '../../dataHooks/useOrganizationAccessCasePoliciesQuery';\nimport { useOrganizationShareCasePoliciesQuery } from '../../dataHooks/useOrganizationShareCasePoliciesQuery';\nimport { useUserAccessCasePoliciesQuery } from '../../dataHooks/useUserAccessCasePoliciesQuery';\nimport { useUserShareCasePoliciesQuery } from '../../dataHooks/useUserShareCasePoliciesQuery';\nimport { useCaseTypeOptionsQuery } from '../../dataHooks/useCaseTypesQuery';\nimport type { UserEffectiveRight } from '../../models/caseAccess';\nimport { EffectiveRightsUtil } from '../../utils/EffectiveRightsUtil';\n\n\ntype FormFields = {\n caseTypeId: string;\n dataCollectionId: string;\n fromDataCollectionId: string;\n};\n\ntype Result = {\n add_case: boolean;\n add_case_set: boolean;\n has_share_case_rights?: boolean;\n read_case_set: boolean;\n read_col_ids: string[];\n remove_case: boolean;\n remove_case_set: boolean;\n write_case_set: boolean;\n write_col_ids: string[];\n};\n\nexport const UserEffectiveRightsTesterAdminPage = () => {\n const { t } = useTranslation();\n const formId = useId();\n\n const { userId } = useParams();\n\n const userQuery = useItemQuery<CaseDbUser>({\n baseQueryKey: COMMON_QUERY_KEY.USERS,\n itemId: userId,\n useQueryOptions: {\n queryFn: async ({ signal }) => {\n const response = await CaseDbOrganizationApi.getInstance().usersGetOne(userId, { signal });\n return response.data;\n },\n },\n });\n\n const colSetMembersQuery = useColSetMembersQuery();\n const caseTypeOptionsQuery = useCaseTypeOptionsQuery();\n const organizationMapQuery = useOrganizationMapQuery();\n const caseTypeSetMembersQuery = useCaseTypeSetMembersQuery();\n const dataCollectionOptionsQuery = useDataCollectionOptionsQuery();\n const organizationAccessCasePoliciesQuery = useOrganizationAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === userQuery.data?.organization_id));\n const organizationShareCasePoliciesQuery = useOrganizationShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === userQuery.data?.organization_id));\n const userAccessCasePoliciesQuery = useUserAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === userQuery.data?.id));\n const userShareCasePoliciesQuery = useUserShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === userQuery.data?.id));\n\n const loadables = useArray([\n userQuery,\n colSetMembersQuery,\n caseTypeOptionsQuery,\n caseTypeSetMembersQuery,\n dataCollectionOptionsQuery,\n organizationAccessCasePoliciesQuery,\n organizationShareCasePoliciesQuery,\n userAccessCasePoliciesQuery,\n userShareCasePoliciesQuery,\n organizationMapQuery,\n ]);\n\n\n const effectiveRights = useMemo<UserEffectiveRight[]>(() => {\n const { data: organizationAccessCasePolicies } = organizationAccessCasePoliciesQuery;\n const { data: organizationShareCasePolicies } = organizationShareCasePoliciesQuery;\n const { data: userAccessCasePolicies } = userAccessCasePoliciesQuery;\n const { data: userShareCasePolicies } = userShareCasePoliciesQuery;\n const { data: caseTypeSetMembers } = caseTypeSetMembersQuery;\n const { data: colSetMembers } = colSetMembersQuery;\n\n return EffectiveRightsUtil.assembleUserEffectiveRights({\n caseTypeSetMembers,\n colSetMembers,\n organizationAccessCasePolicies,\n organizationShareCasePolicies,\n user: userQuery.data,\n userAccessCasePolicies,\n userShareCasePolicies,\n });\n\n }, [colSetMembersQuery, caseTypeSetMembersQuery, organizationAccessCasePoliciesQuery, organizationShareCasePoliciesQuery, userAccessCasePoliciesQuery, userQuery.data, userShareCasePoliciesQuery]);\n\n const schema = useMemo(() => object<FormFields>().shape({\n caseTypeId: string().uuid4().required(),\n dataCollectionId: string().uuid4().required(),\n fromDataCollectionId: string().uuid4().nullable().notRequired(),\n }), []);\n\n const formMethods = useForm<FormFields>({\n resolver: yupResolver(schema) as unknown as Resolver<FormFields>,\n values: {\n caseTypeId: null,\n dataCollectionId: null,\n fromDataCollectionId: null,\n },\n });\n const { control, handleSubmit } = formMethods;\n const formValues = useWatch({ control });\n\n const result = useMemo<Result>(() => {\n if (!formValues.caseTypeId || !formValues.dataCollectionId) {\n return null;\n }\n const effectiveRight = effectiveRights.find(right => {\n return right.data_collection_id === formValues.dataCollectionId && right.categorized_case_type_ids.some(x => x === formValues.caseTypeId);\n });\n\n const shareCaseRight = formValues.fromDataCollectionId && effectiveRight?.effective_share_case_rights?.find(shareRight => {\n return shareRight.categorized_case_type_ids.some(x => x === formValues.caseTypeId) && shareRight.from_data_collection_id === formValues.fromDataCollectionId;\n });\n\n return {\n add_case: effectiveRight?.add_case || shareCaseRight?.add_case,\n add_case_set: effectiveRight?.add_case_set || shareCaseRight?.add_case_set,\n has_share_case_rights: effectiveRight?.effective_share_case_rights.length > 0,\n read_case_set: effectiveRight?.read_case_set,\n read_col_ids: effectiveRight?.categorized_read_col_ids,\n remove_case: effectiveRight?.remove_case || shareCaseRight?.remove_case,\n remove_case_set: effectiveRight?.remove_case_set || shareCaseRight?.remove_case_set,\n write_case_set: effectiveRight?.write_case_set,\n write_col_ids: effectiveRight?.categorized_write_col_ids,\n } satisfies Result;\n }, [effectiveRights, formValues.caseTypeId, formValues.dataCollectionId, formValues.fromDataCollectionId]);\n\n const formFieldDefinitions = useMemo<FormFieldDefinition<FormFields>[]>(() => {\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n label: t`Case type`,\n loading: caseTypeOptionsQuery.isLoading,\n name: 'caseTypeId',\n options: caseTypeOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n label: t`Data collection`,\n loading: dataCollectionOptionsQuery.isLoading,\n name: 'dataCollectionId',\n options: dataCollectionOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !result?.has_share_case_rights,\n label: t`From data collection`,\n loading: dataCollectionOptionsQuery.isLoading,\n name: 'fromDataCollectionId',\n options: dataCollectionOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const;\n }, [caseTypeOptionsQuery.isLoading, caseTypeOptionsQuery.options, dataCollectionOptionsQuery.isLoading, dataCollectionOptionsQuery.options, result?.has_share_case_rights, t]);\n\n\n return (\n <PageContainer\n fullWidth\n showBreadcrumbs\n testIdAttributes={TestIdUtil.createAttributes('UserEffectiveRightsTesterAdminPage')}\n title={t`Users effective rights`}\n >\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n <ResponseHandler\n inlineSpinner\n loadables={loadables}\n >\n <Container maxWidth={'md'}>\n <Box\n sx={{\n marginY: 2,\n }}\n >\n <Typography\n component={'h2'}\n variant={'h4'}\n >\n {t('Testing effective rights for user: {{userEmail}}', { userEmail: userQuery.data?.email })}\n </Typography>\n <Typography>\n {t('Organization: {{organizationName}}', { organizationName: organizationMapQuery.map.get(userQuery.data?.organization_id)?.name })}\n </Typography>\n <Typography>\n {t('Roles: {{roles}}', { roles: userQuery.data?.roles.join(', ') })}\n </Typography>\n </Box>\n <GenericForm<FormFields>\n formFieldDefinitions={formFieldDefinitions}\n formId={formId}\n formMethods={formMethods}\n onSubmit={handleSubmit(noop)}\n schema={schema}\n />\n {result !== null && typeof result === 'object' && (\n <Box\n sx={{\n marginY: 2,\n }}\n >\n <Typography variant={'h6'}>\n {t('Effective rights result:')}\n </Typography>\n {!formValues.fromDataCollectionId && result.has_share_case_rights && (\n <Box\n sx={{\n marginY: 2,\n }}\n >\n <Typography\n sx={{\n fontStyle: 'italic',\n }}\n >\n {t`Note: The user has share case rights that may affect the result when a 'From data collection' is selected.`}\n </Typography>\n </Box>\n )}\n <Typography>\n {t('Add case: {{addCase}}', { addCase: result?.add_case ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Remove case: {{removeCase}}', { removeCase: result?.remove_case ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Add case set: {{addCaseSet}}', { addCaseSet: result?.add_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Remove case set: {{removeCaseSet}}', { removeCaseSet: result?.remove_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Read case set: {{readCaseSet}}', { readCaseSet: result?.read_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Write case set: {{writeCaseSet}}', { writeCaseSet: result?.write_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Read case properties: {{readSomeProperties}}', { readSomeProperties: result?.read_col_ids?.length > 0 ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Write case properties: {{writeSomeProperties}}', { writeSomeProperties: result?.write_col_ids?.length > 0 ? t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nB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pages/UserEffectiveRightsTesterAdminPage/UserEffectiveRightsTesterAdminPage.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport {\n Box,\n Container,\n Typography,\n} from '@mui/material';\nimport {\n useId,\n useMemo,\n} from 'react';\nimport { useParams } from 'react-router-dom';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport type { Resolver } from 'react-hook-form';\nimport {\n useForm,\n useWatch,\n} from 'react-hook-form';\nimport {\n object,\n string,\n} from 'yup';\nimport noop from 'lodash/noop';\nimport type { CaseDbUser } from '@gen-epix/api-casedb';\nimport { CaseDbOrganizationApi } from '@gen-epix/api-casedb';\nimport { COMMON_QUERY_KEY } from '@gen-epix/ui-client-common/constants/query';\nimport { PageContainer } from '@gen-epix/ui-client-common/components/ui/PageContainer';\nimport { ResponseHandler } from '@gen-epix/ui-client-common/components/ui/ResponseHandler';\nimport { useItemQuery } from '@gen-epix/ui-client-common/hooks/useItemQuery';\nimport { useOrganizationMapQuery } from '@gen-epix/ui-client-common/dataHooks/useOrganizationsQuery';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport { GenericForm } from '@gen-epix/ui-core-form/components/helpers/GenericForm';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\n\nimport { useColSetMembersQuery } from '../../dataHooks/useColSetMembersQuery';\nimport { useCaseTypeSetMembersQuery } from '../../dataHooks/useCaseTypeSetMembersQuery';\nimport { useDataCollectionOptionsQuery } from '../../dataHooks/useDataCollectionsQuery';\nimport { useOrganizationAccessCasePoliciesQuery } from '../../dataHooks/useOrganizationAccessCasePoliciesQuery';\nimport { useOrganizationShareCasePoliciesQuery } from '../../dataHooks/useOrganizationShareCasePoliciesQuery';\nimport { useUserAccessCasePoliciesQuery } from '../../dataHooks/useUserAccessCasePoliciesQuery';\nimport { useUserShareCasePoliciesQuery } from '../../dataHooks/useUserShareCasePoliciesQuery';\nimport { useCaseTypeOptionsQuery } from '../../dataHooks/useCaseTypesQuery';\nimport type { UserEffectiveRight } from '../../models/caseAccess';\nimport { EffectiveRightsUtil } from '../../utils/EffectiveRightsUtil';\n\n\ntype FormFields = {\n caseTypeId: string;\n dataCollectionId: string;\n fromDataCollectionId: string;\n};\n\ntype Result = {\n add_case: boolean;\n add_case_set: boolean;\n has_share_case_rights?: boolean;\n read_case_set: boolean;\n read_col_ids: string[];\n remove_case: boolean;\n remove_case_set: boolean;\n write_case_set: boolean;\n write_col_ids: string[];\n};\n\nexport const UserEffectiveRightsTesterAdminPage = () => {\n const { t } = useTranslation();\n const formId = useId();\n\n const { userId } = useParams();\n\n const userQuery = useItemQuery<CaseDbUser>({\n baseQueryKey: COMMON_QUERY_KEY.USERS,\n itemId: userId,\n useQueryOptions: {\n queryFn: async ({ signal }) => {\n const response = await CaseDbOrganizationApi.getInstance().usersGetOne(userId, { signal });\n return response.data;\n },\n },\n });\n\n const colSetMembersQuery = useColSetMembersQuery();\n const caseTypeOptionsQuery = useCaseTypeOptionsQuery();\n const organizationMapQuery = useOrganizationMapQuery();\n const caseTypeSetMembersQuery = useCaseTypeSetMembersQuery();\n const dataCollectionOptionsQuery = useDataCollectionOptionsQuery();\n const organizationAccessCasePoliciesQuery = useOrganizationAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === userQuery.data?.organization_id));\n const organizationShareCasePoliciesQuery = useOrganizationShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.organization_id === userQuery.data?.organization_id));\n const userAccessCasePoliciesQuery = useUserAccessCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === userQuery.data?.id));\n const userShareCasePoliciesQuery = useUserShareCasePoliciesQuery(policies => policies.filter(policy => policy.is_active && policy.user_id === userQuery.data?.id));\n\n const loadables = useArray([\n userQuery,\n colSetMembersQuery,\n caseTypeOptionsQuery,\n caseTypeSetMembersQuery,\n dataCollectionOptionsQuery,\n organizationAccessCasePoliciesQuery,\n organizationShareCasePoliciesQuery,\n userAccessCasePoliciesQuery,\n userShareCasePoliciesQuery,\n organizationMapQuery,\n ]);\n\n\n const effectiveRights = useMemo<UserEffectiveRight[]>(() => {\n const { data: organizationAccessCasePolicies } = organizationAccessCasePoliciesQuery;\n const { data: organizationShareCasePolicies } = organizationShareCasePoliciesQuery;\n const { data: userAccessCasePolicies } = userAccessCasePoliciesQuery;\n const { data: userShareCasePolicies } = userShareCasePoliciesQuery;\n const { data: caseTypeSetMembers } = caseTypeSetMembersQuery;\n const { data: colSetMembers } = colSetMembersQuery;\n\n return EffectiveRightsUtil.assembleUserEffectiveRights({\n caseTypeSetMembers,\n colSetMembers,\n organizationAccessCasePolicies,\n organizationShareCasePolicies,\n user: userQuery.data,\n userAccessCasePolicies,\n userShareCasePolicies,\n });\n\n }, [colSetMembersQuery, caseTypeSetMembersQuery, organizationAccessCasePoliciesQuery, organizationShareCasePoliciesQuery, userAccessCasePoliciesQuery, userQuery.data, userShareCasePoliciesQuery]);\n\n const schema = useMemo(() => object<FormFields>().shape({\n caseTypeId: string().uuid4().required(),\n dataCollectionId: string().uuid4().required(),\n fromDataCollectionId: string().uuid4().nullable().notRequired(),\n }), []);\n\n const formMethods = useForm<FormFields>({\n resolver: yupResolver(schema) as unknown as Resolver<FormFields>,\n values: {\n caseTypeId: null,\n dataCollectionId: null,\n fromDataCollectionId: null,\n },\n });\n const { control, handleSubmit } = formMethods;\n const formValues = useWatch({ control });\n\n const result = useMemo<Result>(() => {\n if (!formValues.caseTypeId || !formValues.dataCollectionId) {\n return null;\n }\n const effectiveRight = effectiveRights.find(right => {\n return right.data_collection_id === formValues.dataCollectionId && right.categorized_case_type_ids.some(x => x === formValues.caseTypeId);\n });\n\n const shareCaseRight = formValues.fromDataCollectionId && effectiveRight?.effective_share_case_rights?.find(shareRight => {\n return shareRight.categorized_case_type_ids.some(x => x === formValues.caseTypeId) && shareRight.from_data_collection_id === formValues.fromDataCollectionId;\n });\n\n return {\n add_case: effectiveRight?.add_case || shareCaseRight?.add_case,\n add_case_set: effectiveRight?.add_case_set || shareCaseRight?.add_case_set,\n has_share_case_rights: effectiveRight?.effective_share_case_rights.length > 0,\n read_case_set: effectiveRight?.read_case_set,\n read_col_ids: effectiveRight?.categorized_read_col_ids,\n remove_case: effectiveRight?.remove_case || shareCaseRight?.remove_case,\n remove_case_set: effectiveRight?.remove_case_set || shareCaseRight?.remove_case_set,\n write_case_set: effectiveRight?.write_case_set,\n write_col_ids: effectiveRight?.categorized_write_col_ids,\n } satisfies Result;\n }, [effectiveRights, formValues.caseTypeId, formValues.dataCollectionId, formValues.fromDataCollectionId]);\n\n const formFieldDefinitions = useMemo<FormFieldDefinition<FormFields>[]>(() => {\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n label: t`Case type`,\n loading: caseTypeOptionsQuery.isLoading,\n name: 'caseTypeId',\n options: caseTypeOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n label: t`Data collection`,\n loading: dataCollectionOptionsQuery.isLoading,\n name: 'dataCollectionId',\n options: dataCollectionOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !result?.has_share_case_rights,\n label: t`From data collection`,\n loading: dataCollectionOptionsQuery.isLoading,\n name: 'fromDataCollectionId',\n options: dataCollectionOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const;\n }, [caseTypeOptionsQuery.isLoading, caseTypeOptionsQuery.options, dataCollectionOptionsQuery.isLoading, dataCollectionOptionsQuery.options, result?.has_share_case_rights, t]);\n\n\n return (\n <PageContainer\n fullWidth\n showBreadcrumbs\n testIdAttributes={TestIdUtil.createAttributes('UserEffectiveRightsTesterAdminPage')}\n title={t`Users effective rights`}\n >\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n <ResponseHandler\n inlineSpinner\n loadables={loadables}\n >\n <Container maxWidth={'md'}>\n <Box\n sx={{\n marginY: 2,\n }}\n >\n <Typography\n component={'h2'}\n variant={'h4'}\n >\n {t('Testing effective rights for user: {{userEmail}}', { userEmail: userQuery.data?.email })}\n </Typography>\n <Typography>\n {t('Organization: {{organizationName}}', { organizationName: organizationMapQuery.map.get(userQuery.data?.organization_id)?.name })}\n </Typography>\n <Typography>\n {t('Roles: {{roles}}', { roles: userQuery.data?.roles.join(', ') })}\n </Typography>\n </Box>\n <GenericForm<FormFields>\n formFieldDefinitions={formFieldDefinitions}\n formId={formId}\n formMethods={formMethods}\n onSubmit={handleSubmit(noop)}\n schema={schema}\n />\n {result !== null && typeof result === 'object' && (\n <Box\n sx={{\n marginY: 2,\n }}\n >\n <Typography variant={'h6'}>\n {t('Effective rights result:')}\n </Typography>\n {!formValues.fromDataCollectionId && result.has_share_case_rights && (\n <Box\n sx={{\n marginY: 2,\n }}\n >\n <Typography\n sx={{\n fontStyle: 'italic',\n }}\n >\n {t`Note: The user has share case rights that may affect the result when a 'From data collection' is selected.`}\n </Typography>\n </Box>\n )}\n <Typography>\n {t('Add case: {{addCase}}', { addCase: result?.add_case ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Remove case: {{removeCase}}', { removeCase: result?.remove_case ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Add case set: {{addCaseSet}}', { addCaseSet: result?.add_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Remove case set: {{removeCaseSet}}', { removeCaseSet: result?.remove_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Read case set: {{readCaseSet}}', { readCaseSet: result?.read_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Write case set: {{writeCaseSet}}', { writeCaseSet: result?.write_case_set ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Read case properties: {{readSomeProperties}}', { readSomeProperties: result?.read_col_ids?.length > 0 ? t`Yes` : t`No` })}\n </Typography>\n <Typography>\n {t('Write case properties: {{writeSomeProperties}}', { writeSomeProperties: result?.write_col_ids?.length > 0 ? t`Yes` : t`No` })}\n </Typography>\n\n </Box>\n )}\n </Container>\n </ResponseHandler>\n </Box>\n </PageContainer>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAiEa,UAA2C;CACtD,IAAM,EAAE,SAAM,EAAe,GACvB,IAAS,EAAM,GAEf,EAAE,cAAW,EAAU,GAEvB,IAAY,EAAyB;EACzC,cAAc,EAAiB;EAC/B,QAAQ;EACR,iBAAiB,EACf,SAAS,OAAO,EAAE,iBAET,MADgB,EAAsB,YAAY,CAAC,CAAC,YAAY,GAAQ,EAAE,UAAO,CAAC,EAAA,CACzE,KAEpB;CACF,CAAC,GAEK,IAAqB,EAAsB,GAC3C,IAAuB,EAAwB,GAC/C,IAAuB,EAAwB,GAC/C,IAA0B,EAA2B,GACrD,IAA6B,EAA8B,GAC3D,IAAsC,GAAuC,MAAY,EAAS,QAAO,MAAU,EAAO,aAAa,EAAO,oBAAoB,EAAU,MAAM,eAAe,CAAC,GAClM,IAAqC,GAAsC,MAAY,EAAS,QAAO,MAAU,EAAO,aAAa,EAAO,oBAAoB,EAAU,MAAM,eAAe,CAAC,GAChM,IAA8B,GAA+B,MAAY,EAAS,QAAO,MAAU,EAAO,aAAa,EAAO,YAAY,EAAU,MAAM,EAAE,CAAC,GAC7J,IAA6B,GAA8B,MAAY,EAAS,QAAO,MAAU,EAAO,aAAa,EAAO,YAAY,EAAU,MAAM,EAAE,CAAC,GAE3J,IAAY,EAAS;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,GAGK,IAAkB,QAAoC;EAC1D,IAAM,EAAE,MAAM,MAAmC,GAC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