@gen3/frontend 0.10.53 → 0.10.55
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/cjs/index.js +1899 -45
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/components/MessageCards/CardContainer.d.ts +1 -0
- package/dist/dts/components/MessageCards/CardContainer.d.ts.map +1 -1
- package/dist/dts/components/MessageCards/CardContainer.js +2 -2
- package/dist/dts/components/MessageCards/CardContainer.js.map +1 -1
- package/dist/dts/components/MessageCards/MessageCard.d.ts +1 -0
- package/dist/dts/components/MessageCards/MessageCard.d.ts.map +1 -1
- package/dist/dts/components/MessageCards/MessageCard.js +2 -2
- package/dist/dts/components/MessageCards/MessageCard.js.map +1 -1
- package/dist/dts/components/NewTabLink.d.ts +8 -0
- package/dist/dts/components/NewTabLink.d.ts.map +1 -0
- package/dist/dts/components/NewTabLink.js +7 -0
- package/dist/dts/components/NewTabLink.js.map +1 -0
- package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts +7 -0
- package/dist/dts/components/charts/echarts/VerticalBarChart.d.ts.map +1 -1
- package/dist/dts/components/charts/echarts/VerticalBarChart.js +7 -1
- package/dist/dts/components/charts/echarts/VerticalBarChart.js.map +1 -1
- package/dist/dts/components/jobs/JobMonitor.d.ts +2 -0
- package/dist/dts/components/jobs/JobMonitor.d.ts.map +1 -0
- package/dist/dts/components/jobs/JobMonitor.js +40 -0
- package/dist/dts/components/jobs/JobMonitor.js.map +1 -0
- package/dist/dts/components/jobs/JobsList.d.ts +6 -0
- package/dist/dts/components/jobs/JobsList.d.ts.map +1 -0
- package/dist/dts/components/jobs/JobsList.js +30 -0
- package/dist/dts/components/jobs/JobsList.js.map +1 -0
- package/dist/dts/components/jobs/JobsModal.d.ts +6 -0
- package/dist/dts/components/jobs/JobsModal.d.ts.map +1 -0
- package/dist/dts/components/jobs/JobsModal.js +10 -0
- package/dist/dts/components/jobs/JobsModal.js.map +1 -0
- package/dist/dts/components/jobs/index.d.ts +5 -0
- package/dist/dts/components/jobs/index.d.ts.map +1 -0
- package/dist/dts/components/jobs/index.js +5 -0
- package/dist/dts/components/jobs/index.js.map +1 -0
- package/dist/dts/features/Analysis/AnalysisCardEditor.d.ts.map +1 -1
- package/dist/dts/features/Analysis/AnalysisCardEditor.js +0 -1
- package/dist/dts/features/Analysis/AnalysisCardEditor.js.map +1 -1
- package/dist/dts/features/Analysis/AnalysisCenter.js +1 -1
- package/dist/dts/features/Analysis/AnalysisCenter.js.map +1 -1
- package/dist/dts/features/Analysis/AnalysisPanel.d.ts.map +1 -1
- package/dist/dts/features/Analysis/AnalysisPanel.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts +6 -4
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.js +7 -7
- package/dist/dts/features/CohortBuilder/QueryExpressionSection.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts +3 -2
- package/dist/dts/features/CohortBuilder/QueryRepresentation.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryRepresentation.js +33 -24
- package/dist/dts/features/CohortBuilder/QueryRepresentation.js.map +1 -1
- package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.d.ts +46 -0
- package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.d.ts.map +1 -0
- package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.js +44 -0
- package/dist/dts/features/CohortBuilder/downloads/CohortDispatchActionButton.js.map +1 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.d.ts +42 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.d.ts.map +1 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.js +218 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/TwoStepActionButton.js.map +1 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.d.ts +2 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.d.ts.map +1 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.js +12 -0
- package/dist/dts/features/CohortBuilder/downloads/actions/sowerActions.js.map +1 -0
- package/dist/dts/features/DataLibrary/DataLibrary.d.ts +4 -0
- package/dist/dts/features/DataLibrary/DataLibrary.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/DataLibrary.js +19 -0
- package/dist/dts/features/DataLibrary/DataLibrary.js.map +1 -0
- package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts +5 -0
- package/dist/dts/features/DataLibrary/DataLibraryLists.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/DataLibraryLists.js +39 -0
- package/dist/dts/features/DataLibrary/DataLibraryLists.js.map +1 -0
- package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts +21 -0
- package/dist/dts/features/DataLibrary/DatalistAccordionItem.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/DatalistAccordionItem.js +178 -0
- package/dist/dts/features/DataLibrary/DatalistAccordionItem.js.map +1 -0
- package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts +16 -0
- package/dist/dts/features/DataLibrary/DatasetAccordionControl.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/DatasetAccordionControl.js +45 -0
- package/dist/dts/features/DataLibrary/DatasetAccordionControl.js.map +1 -0
- package/dist/dts/features/DataLibrary/EmptyList.d.ts +4 -0
- package/dist/dts/features/DataLibrary/EmptyList.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/EmptyList.js +8 -0
- package/dist/dts/features/DataLibrary/EmptyList.js.map +1 -0
- package/dist/dts/features/DataLibrary/QueryDetails.d.ts +5 -0
- package/dist/dts/features/DataLibrary/QueryDetails.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/QueryDetails.js +20 -0
- package/dist/dts/features/DataLibrary/QueryDetails.js.map +1 -0
- package/dist/dts/features/DataLibrary/SearchAndActions.d.ts +10 -0
- package/dist/dts/features/DataLibrary/SearchAndActions.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/SearchAndActions.js +18 -0
- package/dist/dts/features/DataLibrary/SearchAndActions.js.map +1 -0
- package/dist/dts/features/DataLibrary/index.d.ts +5 -0
- package/dist/dts/features/DataLibrary/index.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/index.js +3 -0
- package/dist/dts/features/DataLibrary/index.js.map +1 -0
- package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts +9 -0
- package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js +191 -0
- package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js.map +1 -0
- package/dist/dts/features/DataLibrary/modals/utils.d.ts +2 -0
- package/dist/dts/features/DataLibrary/modals/utils.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/modals/utils.js +45 -0
- package/dist/dts/features/DataLibrary/modals/utils.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts +67 -0
- package/dist/dts/features/DataLibrary/selection/SelectionContext.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/SelectionContext.js +151 -0
- package/dist/dts/features/DataLibrary/selection/SelectionContext.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/exportActions.d.ts +3 -0
- package/dist/dts/features/DataLibrary/selection/exportActions.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/exportActions.js +119 -0
- package/dist/dts/features/DataLibrary/selection/exportActions.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts +12 -0
- package/dist/dts/features/DataLibrary/selection/registeredActions.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/registeredActions.js +29 -0
- package/dist/dts/features/DataLibrary/selection/registeredActions.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts +16 -0
- package/dist/dts/features/DataLibrary/selection/selectedItemActions.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/selectedItemActions.js +76 -0
- package/dist/dts/features/DataLibrary/selection/selectedItemActions.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/selection.d.ts +32 -0
- package/dist/dts/features/DataLibrary/selection/selection.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/selection.js +88 -0
- package/dist/dts/features/DataLibrary/selection/selection.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts +2 -0
- package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js +176 -0
- package/dist/dts/features/DataLibrary/selection/tests/SelectionContext.unit.test.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts +2 -0
- package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js +79 -0
- package/dist/dts/features/DataLibrary/selection/tests/utils.unit.test.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/types.d.ts +31 -0
- package/dist/dts/features/DataLibrary/selection/types.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/types.js +2 -0
- package/dist/dts/features/DataLibrary/selection/types.js.map +1 -0
- package/dist/dts/features/DataLibrary/selection/utils.d.ts +15 -0
- package/dist/dts/features/DataLibrary/selection/utils.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/selection/utils.js +85 -0
- package/dist/dts/features/DataLibrary/selection/utils.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts +8 -0
- package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js +36 -0
- package/dist/dts/features/DataLibrary/tables/AdditionalDataTable.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts +1 -0
- package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js +130 -0
- package/dist/dts/features/DataLibrary/tables/DatalistContentsPanel.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts +10 -0
- package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js +149 -0
- package/dist/dts/features/DataLibrary/tables/DatasetContentsTable.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts +11 -0
- package/dist/dts/features/DataLibrary/tables/FilesTable.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/FilesTable.js +57 -0
- package/dist/dts/features/DataLibrary/tables/FilesTable.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts +9 -0
- package/dist/dts/features/DataLibrary/tables/QueriesTable.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/QueriesTable.js +36 -0
- package/dist/dts/features/DataLibrary/tables/QueriesTable.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts +12 -0
- package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +156 -0
- package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -0
- package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts +3 -0
- package/dist/dts/features/DataLibrary/tables/tableSettings.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tables/tableSettings.js +64 -0
- package/dist/dts/features/DataLibrary/tables/tableSettings.js.map +1 -0
- package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts +2 -0
- package/dist/dts/features/DataLibrary/tests/utils.unit.test.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/tests/utils.unit.test.js +43 -0
- package/dist/dts/features/DataLibrary/tests/utils.unit.test.js.map +1 -0
- package/dist/dts/features/DataLibrary/types.d.ts +48 -0
- package/dist/dts/features/DataLibrary/types.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/types.js +25 -0
- package/dist/dts/features/DataLibrary/types.js.map +1 -0
- package/dist/dts/features/DataLibrary/utils.d.ts +28 -0
- package/dist/dts/features/DataLibrary/utils.d.ts.map +1 -0
- package/dist/dts/features/DataLibrary/utils.js +68 -0
- package/dist/dts/features/DataLibrary/utils.js.map +1 -0
- package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.d.ts.map +1 -1
- package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js +0 -1
- package/dist/dts/features/Discovery/ActionBar/DownloadAsZipButton.js.map +1 -1
- package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.d.ts.map +1 -1
- package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js +3 -3
- package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js.map +1 -1
- package/dist/dts/features/Navigation/NavigationLogo.js +1 -1
- package/dist/dts/features/Navigation/NavigationLogo.js.map +1 -1
- package/dist/dts/features/Workspace/NotebookCard.d.ts.map +1 -1
- package/dist/dts/features/Workspace/NotebookCard.js +0 -1
- package/dist/dts/features/Workspace/NotebookCard.js.map +1 -1
- package/dist/dts/index.d.ts +2 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.js +2 -1
- package/dist/dts/index.js.map +1 -1
- package/dist/dts/lib/content/filesystem.js +1 -1
- package/dist/dts/lib/content/filesystem.js.map +1 -1
- package/dist/dts/pages/DataLibrary/DataLibrary.d.ts +8 -0
- package/dist/dts/pages/DataLibrary/DataLibrary.d.ts.map +1 -0
- package/dist/dts/pages/DataLibrary/DataLibrary.js +24 -0
- package/dist/dts/pages/DataLibrary/DataLibrary.js.map +1 -0
- package/dist/dts/pages/DataLibrary/data.d.ts +4 -0
- package/dist/dts/pages/DataLibrary/data.d.ts.map +1 -0
- package/dist/dts/pages/DataLibrary/data.js +81 -0
- package/dist/dts/pages/DataLibrary/data.js.map +1 -0
- package/dist/dts/pages/DataLibrary/index.d.ts +3 -0
- package/dist/dts/pages/DataLibrary/index.d.ts.map +1 -0
- package/dist/dts/pages/DataLibrary/index.js +3 -0
- package/dist/dts/pages/DataLibrary/index.js.map +1 -0
- package/dist/dts/pages/Explorer/data.d.ts.map +1 -1
- package/dist/dts/pages/Explorer/data.js.map +1 -1
- package/dist/dts/pages/NotebookLite/NotebookLite.d.ts.map +1 -1
- package/dist/dts/pages/NotebookLite/NotebookLite.js +3 -1
- package/dist/dts/pages/NotebookLite/NotebookLite.js.map +1 -1
- package/dist/dts/services/SowerJobsMonitor.d.ts +30 -0
- package/dist/dts/services/SowerJobsMonitor.d.ts.map +1 -0
- package/dist/dts/services/SowerJobsMonitor.js +236 -0
- package/dist/dts/services/SowerJobsMonitor.js.map +1 -0
- package/dist/dts/utils/date.d.ts +17 -0
- package/dist/dts/utils/date.d.ts.map +1 -0
- package/dist/dts/utils/date.js +41 -0
- package/dist/dts/utils/date.js.map +1 -0
- package/dist/dts/utils/tests/date.unit.test.d.ts +2 -0
- package/dist/dts/utils/tests/date.unit.test.d.ts.map +1 -0
- package/dist/dts/utils/tests/date.unit.test.js +89 -0
- package/dist/dts/utils/tests/date.unit.test.js.map +1 -0
- package/dist/esm/index.js +1903 -51
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +62 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { createContext, useState, useMemo, useContext, useCallback, useEffect, useRef, createElement, forwardRef, useReducer } from 'react';
|
|
4
|
-
import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, useGetWorkspaceStatusQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, useCoreDispatch, WorkspaceStatus, setActiveWorkspaceStatus, setRequestedWorkspaceStatus, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, showModal, Modals, GEN3_FENCE_API, isAuthenticated, useGetLoginProvidersQuery, hideModal, useGetCSRFQuery, selectCurrentModal, fieldNameToTitle, useIsUserLoggedIn, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, updateCohortFilter, selectIndexedFilterByName, isOperationWithField, removeCohortFilter, trimFirstFieldNameToTitle, selectCohortFilters, handleOperation, selectCurrentCohortId, setCohortFilter, clearCohortFilters, selectCurrentCohortName, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, Accessibility, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, extractEnumFilterValue, useGetCountsQuery, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, useGetWorkspacePayModelsQuery, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, isWorkspaceRunningOrStopping, useSetCurrentPayModelMutation, PodStatus, PodConditionType, GEN3_COMMONS_NAME, createAppStore, createGen3AppWithOwnStore, createAppApiForRTKQ, getGen3AppId, CoreProvider, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetDictionaryQuery, useGetProjectsDetailsQuery, useGetSubmissionsQuery, useLazyGetCrosswalkDataQuery } from '@gen3/core';
|
|
5
|
-
import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Loader, Center, Paper, Menu, Badge, Alert, Tabs, Accordion, Drawer, CopyButton, factory, useProps, getStyleObject, SegmentedControl, Switch, Autocomplete, TextInput, Title, ActionIcon, NumberInput, RangeSlider, MultiSelect, Transition, rem, Stepper, Image as Image$1, NavLink, Flex, ScrollArea, MantineProvider, createTheme, Highlight, List, FileInput } from '@mantine/core';
|
|
4
|
+
import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, useGetWorkspaceStatusQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, useCoreDispatch, WorkspaceStatus, setActiveWorkspaceStatus, setRequestedWorkspaceStatus, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, showModal, Modals, GEN3_FENCE_API, isAuthenticated, useGetLoginProvidersQuery, hideModal, useGetCSRFQuery, selectCurrentModal, fieldNameToTitle, useIsUserLoggedIn, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, updateCohortFilter, selectIndexedFilterByName, isOperationWithField, removeCohortFilter, trimFirstFieldNameToTitle, selectCohortFilters, handleOperation, selectCurrentCohortId, setCohortFilter, clearCohortFilters, selectCurrentCohortName, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, Accessibility, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, extractEnumFilterValue, useGetCountsQuery, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, useGetWorkspacePayModelsQuery, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, isWorkspaceRunningOrStopping, useSetCurrentPayModelMutation, PodStatus, PodConditionType, GEN3_COMMONS_NAME, createAppStore, createGen3AppWithOwnStore, createAppApiForRTKQ, getGen3AppId, CoreProvider, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetDictionaryQuery, useGetProjectsDetailsQuery, useGetSubmissionsQuery, isCohortItem, isFileItem, fetchFencePresignedURL, HTTPError, isFilterSet, getNumberOfItemsInDatalist, isAdditionalDataItem, getTimestamp, useDataLibrary, useLazyGetCrosswalkDataQuery } from '@gen3/core';
|
|
5
|
+
import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Loader, Center, Paper, Menu, Badge, Alert, Tabs, Accordion, Drawer, CopyButton, factory, useProps, getStyleObject, SegmentedControl, Switch, Autocomplete, TextInput, Title, ActionIcon, NumberInput, RangeSlider, MultiSelect, Transition, rem, Stepper, Image as Image$1, NavLink, Flex, ScrollArea, MantineProvider, createTheme, Highlight, List, FileInput, CloseButton } from '@mantine/core';
|
|
6
6
|
import { useDeepCompareEffect, useDeepCompareMemo, useDeepCompareCallback } from 'use-deep-compare';
|
|
7
7
|
import { useRouter } from 'next/router';
|
|
8
8
|
import { usePathname } from 'next/navigation';
|
|
9
|
-
import { MdLogin, MdClose, MdKeyboardDoubleArrowLeft, MdUndo, MdSearch, MdInfo, MdExpandLess, MdExpandMore, MdFlip, MdAddCircle, MdRemoveCircle, MdOutlineArrowBack, MdOutlineArrowForward, MdKeyboardArrowDown, MdKeyboardArrowUp, MdDownload, MdFormatQuote, MdOutlineSearch, MdOutlineBarChart, MdGroup, MdDelete } from 'react-icons/md';
|
|
9
|
+
import { MdLogin, MdClose, MdKeyboardDoubleArrowLeft, MdUndo, MdSearch, MdInfo, MdExpandLess, MdExpandMore, MdFlip, MdAddCircle, MdRemoveCircle, MdOutlineArrowBack, MdOutlineArrowForward, MdKeyboardArrowDown, MdKeyboardArrowUp, MdDownload, MdFormatQuote, MdOutlineSearch, MdOutlineBarChart, MdGroup, MdDelete, MdOutlineRemoveCircle } from 'react-icons/md';
|
|
10
10
|
import 'swr';
|
|
11
11
|
import { getCookie, deleteCookie, setCookie } from 'cookies-next';
|
|
12
12
|
import { decodeJwt } from 'jose';
|
|
@@ -18,7 +18,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
18
18
|
import { isArray, toString, capitalize as capitalize$1, get, partial, omit } from 'lodash';
|
|
19
19
|
import { useCookies } from 'react-cookie';
|
|
20
20
|
import FileSaver from 'file-saver';
|
|
21
|
-
import { useClipboard, useResizeObserver, useDisclosure, useElementSize, useDidUpdate, mergeRefs, useReducedMotion, useMediaQuery, useFullscreen, useLocalStorage, useScrollIntoView } from '@mantine/hooks';
|
|
21
|
+
import { useClipboard, useResizeObserver, useDisclosure, useElementSize, useDidUpdate, mergeRefs, useReducedMotion, useMediaQuery, useFullscreen, useLocalStorage, useScrollIntoView, getHotkeyHandler } from '@mantine/hooks';
|
|
22
22
|
import { defaultComposer } from 'default-composer';
|
|
23
23
|
import { Icon, addCollection } from '@iconify/react';
|
|
24
24
|
import { init, getInstanceByDom } from 'echarts';
|
|
@@ -43,7 +43,7 @@ import sum from 'lodash/sum';
|
|
|
43
43
|
import tw from 'tailwind-styled-components';
|
|
44
44
|
import 'universal-cookie';
|
|
45
45
|
import { RiCloseCircleLine } from 'react-icons/ri';
|
|
46
|
-
import { IoMdArrowDropdown, IoMdRefresh, IoMdLogIn } from 'react-icons/io';
|
|
46
|
+
import { IoMdArrowDropdown, IoMdRefresh, IoMdLogIn, IoMdInformationCircleOutline } from 'react-icons/io';
|
|
47
47
|
import GraphiQL from 'graphiql';
|
|
48
48
|
import { modals, ModalsProvider } from '@mantine/modals';
|
|
49
49
|
import { BsArrowsFullscreen } from 'react-icons/bs';
|
|
@@ -625,10 +625,10 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsx(MdLogin, {
|
|
|
625
625
|
});
|
|
626
626
|
};
|
|
627
627
|
|
|
628
|
-
const CardContainer = ({ children })=>/*#__PURE__*/ jsx("div", {
|
|
629
|
-
className:
|
|
628
|
+
const CardContainer = ({ children, width = 'w-1/2' })=>/*#__PURE__*/ jsx("div", {
|
|
629
|
+
className: `flex justify-center pt-2 items-center m-2 ${width ?? ''}`,
|
|
630
630
|
children: /*#__PURE__*/ jsx(Card, {
|
|
631
|
-
shadow: "
|
|
631
|
+
shadow: "xs",
|
|
632
632
|
p: "md",
|
|
633
633
|
className: "bg-base-lightest border-2 border-base-lighter",
|
|
634
634
|
children: /*#__PURE__*/ jsx(Group, {
|
|
@@ -645,7 +645,8 @@ const MessageText = ({ message, color })=>/*#__PURE__*/ jsx(Text, {
|
|
|
645
645
|
fw: 500,
|
|
646
646
|
children: message
|
|
647
647
|
});
|
|
648
|
-
const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5' })=>/*#__PURE__*/ jsxs(CardContainer, {
|
|
648
|
+
const MessageCard = ({ message, icon, size = 'lg', color = 'utility.5', width = 'w-1/2' })=>/*#__PURE__*/ jsxs(CardContainer, {
|
|
649
|
+
width: width,
|
|
649
650
|
children: [
|
|
650
651
|
/*#__PURE__*/ jsx(ThemeIcon, {
|
|
651
652
|
color: color,
|
|
@@ -2732,7 +2733,7 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
|
|
|
2732
2733
|
width: width ?? undefined,
|
|
2733
2734
|
height: height ?? undefined,
|
|
2734
2735
|
fill: !width && !height,
|
|
2735
|
-
src: `${
|
|
2736
|
+
src: `${src}`,
|
|
2736
2737
|
alt: description ?? title ?? 'link back to homepage'
|
|
2737
2738
|
})
|
|
2738
2739
|
}),
|
|
@@ -3359,14 +3360,14 @@ var AccessLevel;
|
|
|
3359
3360
|
const DataAccessCellRenderer = ({ value })=>{
|
|
3360
3361
|
if (value === AccessLevel.PENDING) {
|
|
3361
3362
|
return /*#__PURE__*/ jsx(LuClock, {
|
|
3362
|
-
color: "
|
|
3363
|
-
children: "
|
|
3363
|
+
color: "yellow",
|
|
3364
|
+
children: "Your access to this study is pending."
|
|
3364
3365
|
});
|
|
3365
3366
|
}
|
|
3366
3367
|
if (value === AccessLevel.NOT_AVAILABLE) {
|
|
3367
3368
|
return /*#__PURE__*/ jsx(LuCircleSlash, {
|
|
3368
|
-
color: "
|
|
3369
|
-
children: "
|
|
3369
|
+
color: "red",
|
|
3370
|
+
children: "Cannot determine access to this study. Please contact the study owner."
|
|
3370
3371
|
});
|
|
3371
3372
|
}
|
|
3372
3373
|
if (value === AccessLevel.ACCESSIBLE) {
|
|
@@ -3377,8 +3378,8 @@ const DataAccessCellRenderer = ({ value })=>{
|
|
|
3377
3378
|
}
|
|
3378
3379
|
if (value === AccessLevel.UNACCESSIBLE) {
|
|
3379
3380
|
return /*#__PURE__*/ jsx(LuLock, {
|
|
3380
|
-
color: "
|
|
3381
|
-
children: "You have access to this study."
|
|
3381
|
+
color: "red",
|
|
3382
|
+
children: "You do not have access to this study."
|
|
3382
3383
|
});
|
|
3383
3384
|
}
|
|
3384
3385
|
return /*#__PURE__*/ jsx(React__default.Fragment, {});
|
|
@@ -5064,7 +5065,7 @@ const BuildSummaryStatisticPanel = (summaries = [])=>{
|
|
|
5064
5065
|
}
|
|
5065
5066
|
});
|
|
5066
5067
|
};
|
|
5067
|
-
const columns = [
|
|
5068
|
+
const columns$3 = [
|
|
5068
5069
|
'grid-cols-0',
|
|
5069
5070
|
'grid-cols-1',
|
|
5070
5071
|
'grid-cols-2',
|
|
@@ -5079,7 +5080,7 @@ const columns = [
|
|
|
5079
5080
|
];
|
|
5080
5081
|
const SummaryStatisticPanel = ({ summaries })=>{
|
|
5081
5082
|
return /*#__PURE__*/ jsx("div", {
|
|
5082
|
-
className: `grid ${columns[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
|
|
5083
|
+
className: `grid ${columns$3[summaries.length]} grow shrink-0 divide-x-2 divide-accent`,
|
|
5083
5084
|
children: BuildSummaryStatisticPanel(summaries)
|
|
5084
5085
|
});
|
|
5085
5086
|
};
|
|
@@ -8028,7 +8029,7 @@ const isRangeOperation = (x)=>{
|
|
|
8028
8029
|
const isNestedFilter = (x)=>{
|
|
8029
8030
|
return 'path' in x;
|
|
8030
8031
|
};
|
|
8031
|
-
const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=>{
|
|
8032
|
+
const IncludeExcludeQueryElement = ({ index, field, path, operator, operands, displayOnly = false })=>{
|
|
8032
8033
|
const dispatch = useCoreDispatch();
|
|
8033
8034
|
const [queryExpressionsExpanded, setQueryExpressionsExpanded] = useContext(QueryExpressionsExpandedContext);
|
|
8034
8035
|
const currentCohortId = useCoreSelector((state)=>selectCurrentCohortId(state));
|
|
@@ -8091,12 +8092,12 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
|
|
|
8091
8092
|
variant: "filled",
|
|
8092
8093
|
color: "accent.5",
|
|
8093
8094
|
size: "md",
|
|
8094
|
-
pr: 0
|
|
8095
|
-
|
|
8096
|
-
rightSection: /*#__PURE__*/ jsx(RemoveButton, {
|
|
8095
|
+
className: `normal-case items-center max-w-[162px] cursor-pointer hover:bg-accent-darker pl-2 ${displayOnly ? 'pr-3' : 'pr-0'}`,
|
|
8096
|
+
rightSection: !displayOnly && /*#__PURE__*/ jsx(RemoveButton, {
|
|
8097
8097
|
value: value
|
|
8098
8098
|
}),
|
|
8099
8099
|
onClick: ()=>{
|
|
8100
|
+
if (displayOnly) return;
|
|
8100
8101
|
const newOperands = operandsArray.filter((o)=>o !== x);
|
|
8101
8102
|
const fieldToUpdate = path && path != '.' ? [
|
|
8102
8103
|
path,
|
|
@@ -8138,7 +8139,7 @@ const IncludeExcludeQueryElement = ({ index, field, path, operator, operands })=
|
|
|
8138
8139
|
]
|
|
8139
8140
|
});
|
|
8140
8141
|
};
|
|
8141
|
-
const ComparisonElement = ({ index, filter, showLabel = true })=>{
|
|
8142
|
+
const ComparisonElement = ({ index, filter, showLabel = true, displayOnly = false })=>{
|
|
8142
8143
|
const coreDispatch = useCoreDispatch();
|
|
8143
8144
|
// fix the code below
|
|
8144
8145
|
const handleKeepMember = (keep)=>{
|
|
@@ -8158,7 +8159,10 @@ const ComparisonElement = ({ index, filter, showLabel = true })=>{
|
|
|
8158
8159
|
children: [
|
|
8159
8160
|
/*#__PURE__*/ jsx("button", {
|
|
8160
8161
|
className: "h-[25px] w-[25px] mx-2 rounded-[50%] bg-accent-cool-lightest text-accent-cool-lightest-contrast pb-1",
|
|
8161
|
-
onClick: ()=>
|
|
8162
|
+
onClick: ()=>{
|
|
8163
|
+
if (displayOnly) return;
|
|
8164
|
+
handleKeepMember(filter);
|
|
8165
|
+
},
|
|
8162
8166
|
children: filter.operator
|
|
8163
8167
|
}),
|
|
8164
8168
|
/*#__PURE__*/ jsx(QueryRepresentationText, {
|
|
@@ -8211,7 +8215,7 @@ const ClosedRangeQueryElement = ({ index, lower, upper, op = 'and' })=>{
|
|
|
8211
8215
|
})
|
|
8212
8216
|
});
|
|
8213
8217
|
};
|
|
8214
|
-
const QueryElement = ({ index, field, path, children })=>{
|
|
8218
|
+
const QueryElement = ({ index, field, path, children, displayOnly = false })=>{
|
|
8215
8219
|
const coreDispatch = useCoreDispatch();
|
|
8216
8220
|
const [, setQueryExpressionsExpanded] = useContext(QueryExpressionsExpandedContext);
|
|
8217
8221
|
const currentCohortId = useCoreSelector((state)=>selectCurrentCohortId(state));
|
|
@@ -8233,7 +8237,7 @@ const QueryElement = ({ index, field, path, children })=>{
|
|
|
8233
8237
|
return /*#__PURE__*/ jsxs(QueryItemContainer, {
|
|
8234
8238
|
children: [
|
|
8235
8239
|
children,
|
|
8236
|
-
/*#__PURE__*/ jsx("button", {
|
|
8240
|
+
!displayOnly && /*#__PURE__*/ jsx("button", {
|
|
8237
8241
|
className: "bg-accent-vivid p-0 m-0 h-full rounded-r-sm text-white hover:bg-accent-darker",
|
|
8238
8242
|
onClick: handleRemoveFilter,
|
|
8239
8243
|
"aria-label": `remove ${fieldNameToTitle(field)}`,
|
|
@@ -8248,85 +8252,102 @@ const QueryElement = ({ index, field, path, children })=>{
|
|
|
8248
8252
|
/**
|
|
8249
8253
|
* Processes a Filter into a component representation
|
|
8250
8254
|
*/ class CohortFilterToComponent {
|
|
8251
|
-
constructor(index, path = '.'){
|
|
8255
|
+
constructor(index, path = '.', displayOnly = false){
|
|
8252
8256
|
this.handleIncludes = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8253
8257
|
...f,
|
|
8254
8258
|
index: this.index,
|
|
8255
8259
|
path: this.path,
|
|
8260
|
+
displayOnly: this.displayOnly,
|
|
8256
8261
|
children: /*#__PURE__*/ jsx(IncludeExcludeQueryElement, {
|
|
8257
8262
|
...f,
|
|
8258
8263
|
index: this.index,
|
|
8259
|
-
path: this.path
|
|
8264
|
+
path: this.path,
|
|
8265
|
+
displayOnly: this.displayOnly
|
|
8260
8266
|
})
|
|
8261
8267
|
}, f.field);
|
|
8262
8268
|
this.handleExcludes = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8263
8269
|
...f,
|
|
8264
8270
|
index: this.index,
|
|
8265
8271
|
path: this.path,
|
|
8272
|
+
displayOnly: this.displayOnly,
|
|
8266
8273
|
children: /*#__PURE__*/ jsx(IncludeExcludeQueryElement, {
|
|
8267
8274
|
...f,
|
|
8268
8275
|
index: this.index,
|
|
8269
|
-
path: this.path
|
|
8276
|
+
path: this.path,
|
|
8277
|
+
displayOnly: this.displayOnly
|
|
8270
8278
|
})
|
|
8271
8279
|
}, f.field);
|
|
8272
8280
|
this.handleEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8273
8281
|
...f,
|
|
8274
8282
|
index: this.index,
|
|
8275
8283
|
path: this.path,
|
|
8284
|
+
displayOnly: this.displayOnly,
|
|
8276
8285
|
children: /*#__PURE__*/ jsx(ComparisonElement, {
|
|
8277
8286
|
filter: f,
|
|
8278
|
-
index: this.index
|
|
8287
|
+
index: this.index,
|
|
8288
|
+
displayOnly: this.displayOnly
|
|
8279
8289
|
})
|
|
8280
8290
|
}, f.field);
|
|
8281
8291
|
this.handleNotEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8282
8292
|
...f,
|
|
8283
8293
|
index: this.index,
|
|
8284
8294
|
path: this.path,
|
|
8295
|
+
displayOnly: this.displayOnly,
|
|
8285
8296
|
children: /*#__PURE__*/ jsx(ComparisonElement, {
|
|
8286
8297
|
filter: f,
|
|
8287
|
-
index: this.index
|
|
8298
|
+
index: this.index,
|
|
8299
|
+
displayOnly: this.displayOnly
|
|
8288
8300
|
})
|
|
8289
8301
|
}, f.field);
|
|
8290
8302
|
this.handleLessThan = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8291
8303
|
...f,
|
|
8292
8304
|
index: this.index,
|
|
8293
8305
|
path: this.path,
|
|
8306
|
+
displayOnly: this.displayOnly,
|
|
8294
8307
|
children: /*#__PURE__*/ jsx(ComparisonElement, {
|
|
8295
8308
|
filter: f,
|
|
8296
|
-
index: this.index
|
|
8309
|
+
index: this.index,
|
|
8310
|
+
displayOnly: this.displayOnly
|
|
8297
8311
|
})
|
|
8298
8312
|
}, f.field);
|
|
8299
8313
|
this.handleLessThanOrEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8300
8314
|
...f,
|
|
8301
8315
|
index: this.index,
|
|
8302
8316
|
path: this.path,
|
|
8317
|
+
displayOnly: this.displayOnly,
|
|
8303
8318
|
children: /*#__PURE__*/ jsx(ComparisonElement, {
|
|
8304
8319
|
filter: f,
|
|
8305
|
-
index: this.index
|
|
8320
|
+
index: this.index,
|
|
8321
|
+
displayOnly: this.displayOnly
|
|
8306
8322
|
})
|
|
8307
8323
|
}, f.field);
|
|
8308
8324
|
this.handleGreaterThan = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8309
8325
|
...f,
|
|
8310
8326
|
index: this.index,
|
|
8311
8327
|
path: this.path,
|
|
8328
|
+
displayOnly: this.displayOnly,
|
|
8312
8329
|
children: /*#__PURE__*/ jsx(ComparisonElement, {
|
|
8313
8330
|
filter: f,
|
|
8314
|
-
index: this.index
|
|
8331
|
+
index: this.index,
|
|
8332
|
+
displayOnly: this.displayOnly
|
|
8315
8333
|
})
|
|
8316
8334
|
}, f.field);
|
|
8317
8335
|
this.handleGreaterThanOrEquals = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8318
8336
|
...f,
|
|
8319
8337
|
index: this.index,
|
|
8320
8338
|
path: this.path,
|
|
8339
|
+
displayOnly: this.displayOnly,
|
|
8321
8340
|
children: /*#__PURE__*/ jsx(ComparisonElement, {
|
|
8322
8341
|
filter: f,
|
|
8323
|
-
index: this.index
|
|
8342
|
+
index: this.index,
|
|
8343
|
+
displayOnly: this.displayOnly
|
|
8324
8344
|
})
|
|
8325
8345
|
}, f.field);
|
|
8326
8346
|
this.handleExists = (f)=>/*#__PURE__*/ jsx(QueryElement, {
|
|
8327
8347
|
...f,
|
|
8328
8348
|
index: this.index,
|
|
8329
8349
|
path: this.path,
|
|
8350
|
+
displayOnly: this.displayOnly,
|
|
8330
8351
|
children: /*#__PURE__*/ jsx(ExistsElement, {
|
|
8331
8352
|
...f
|
|
8332
8353
|
})
|
|
@@ -8335,6 +8356,7 @@ const QueryElement = ({ index, field, path, children })=>{
|
|
|
8335
8356
|
...f,
|
|
8336
8357
|
index: this.index,
|
|
8337
8358
|
path: this.path,
|
|
8359
|
+
displayOnly: this.displayOnly,
|
|
8338
8360
|
children: /*#__PURE__*/ jsx(ExistsElement, {
|
|
8339
8361
|
...f
|
|
8340
8362
|
})
|
|
@@ -8343,9 +8365,11 @@ const QueryElement = ({ index, field, path, children })=>{
|
|
|
8343
8365
|
...f,
|
|
8344
8366
|
index: this.index,
|
|
8345
8367
|
path: this.path,
|
|
8368
|
+
displayOnly: this.displayOnly,
|
|
8346
8369
|
children: /*#__PURE__*/ jsx(IncludeExcludeQueryElement, {
|
|
8347
8370
|
...f,
|
|
8348
|
-
index: this.index
|
|
8371
|
+
index: this.index,
|
|
8372
|
+
displayOnly: this.displayOnly
|
|
8349
8373
|
})
|
|
8350
8374
|
}, f.field);
|
|
8351
8375
|
this.handleIntersection = (f)=>{
|
|
@@ -8379,17 +8403,18 @@ const QueryElement = ({ index, field, path, children })=>{
|
|
|
8379
8403
|
return convertFilterToComponent(newOp, this.index, [
|
|
8380
8404
|
op.path,
|
|
8381
8405
|
op.operand.path
|
|
8382
|
-
].join('.'));
|
|
8406
|
+
].join('.'), this.displayOnly);
|
|
8383
8407
|
} else {
|
|
8384
|
-
return convertFilterToComponent(op.operand, this.index, op.path);
|
|
8408
|
+
return convertFilterToComponent(op.operand, this.index, op.path, this.displayOnly);
|
|
8385
8409
|
}
|
|
8386
8410
|
};
|
|
8387
8411
|
this.index = index;
|
|
8388
8412
|
this.path = path;
|
|
8413
|
+
this.displayOnly = displayOnly;
|
|
8389
8414
|
}
|
|
8390
8415
|
}
|
|
8391
|
-
const convertFilterToComponent = (filter, index, path = '.')=>{
|
|
8392
|
-
const handler = new CohortFilterToComponent(index, path);
|
|
8416
|
+
const convertFilterToComponent = (filter, index, path = '.', displayOnly = false)=>{
|
|
8417
|
+
const handler = new CohortFilterToComponent(index, path, displayOnly);
|
|
8393
8418
|
return handleOperation(handler, filter);
|
|
8394
8419
|
};
|
|
8395
8420
|
|
|
@@ -8599,7 +8624,7 @@ const reducer = (state, action)=>{
|
|
|
8599
8624
|
}
|
|
8600
8625
|
}
|
|
8601
8626
|
};
|
|
8602
|
-
const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId })=>{
|
|
8627
|
+
const QueryExpressionSection = ({ index, filters, currentCohortName, currentCohortId, displayOnly = false, showTitle = true })=>{
|
|
8603
8628
|
const [expandedState, setExpandedState] = useReducer(reducer, {});
|
|
8604
8629
|
const [filtersSectionCollapsed, setFiltersSectionCollapsed] = useState(true);
|
|
8605
8630
|
const filtersRef = useRef(null);
|
|
@@ -8656,14 +8681,14 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
|
|
|
8656
8681
|
"data-testid": "text-cohort-filters-top-row",
|
|
8657
8682
|
className: "flex flex-row py-2 items-center border-secondary-darkest border-b-1",
|
|
8658
8683
|
children: [
|
|
8659
|
-
/*#__PURE__*/ jsx(OverflowTooltippedLabel, {
|
|
8684
|
+
showTitle && /*#__PURE__*/ jsx(OverflowTooltippedLabel, {
|
|
8660
8685
|
label: currentCohortName,
|
|
8661
8686
|
className: "font-bold text-secondary-contrast-darkest ml-3 max-w-[260px]",
|
|
8662
8687
|
children: currentCohortName
|
|
8663
8688
|
}),
|
|
8664
8689
|
/*#__PURE__*/ jsxs(React__default.Fragment, {
|
|
8665
8690
|
children: [
|
|
8666
|
-
/*#__PURE__*/ jsx("button", {
|
|
8691
|
+
!displayOnly && /*#__PURE__*/ jsx("button", {
|
|
8667
8692
|
"data-testid": "button-clear-all-cohort-filters",
|
|
8668
8693
|
className: `text-sm font-montserrat ml-2 px-1 hover:bg-primary-darkest hover:text-primary-content-lightest hover:rounded-md ${noFilters ? 'hidden' : 'cursor-pointer text-secondary-contrast-darkest'}`,
|
|
8669
8694
|
onClick: clearAllFilters,
|
|
@@ -8748,7 +8773,7 @@ const QueryExpressionSection = ({ index, filters, currentCohortName, currentCoho
|
|
|
8748
8773
|
className: "font-content",
|
|
8749
8774
|
children: "No filters currently applied."
|
|
8750
8775
|
}) : Object.keys(filters.root).map((k)=>{
|
|
8751
|
-
return convertFilterToComponent(filters.root[k], index);
|
|
8776
|
+
return convertFilterToComponent(filters.root[k], index, '.', displayOnly);
|
|
8752
8777
|
})
|
|
8753
8778
|
})
|
|
8754
8779
|
]
|
|
@@ -10375,7 +10400,6 @@ const NotebookCard = ({ info })=>{
|
|
|
10375
10400
|
const { status } = useCoreSelector(selectWorkspaceStatusFromService);
|
|
10376
10401
|
const requestedStatus = useCoreSelector(selectRequestedWorkspaceStatus);
|
|
10377
10402
|
const workspaceId = useCoreSelector(selectActiveWorkspaceId);
|
|
10378
|
-
console.log('NotebookCard: ', requestedStatus, workspaceId, status);
|
|
10379
10403
|
return /*#__PURE__*/ jsxs(Card, {
|
|
10380
10404
|
withBorder: true,
|
|
10381
10405
|
radius: "xs",
|
|
@@ -11110,7 +11134,7 @@ const AnalysisCenter = ({ tools, showFilterAndSort = false })=>{
|
|
|
11110
11134
|
className: "p-0 rounded-sm",
|
|
11111
11135
|
children: /*#__PURE__*/ jsx(Image$1, {
|
|
11112
11136
|
component: Image,
|
|
11113
|
-
src:
|
|
11137
|
+
src: `${image}`,
|
|
11114
11138
|
alt: `${title} image`,
|
|
11115
11139
|
height: 1000,
|
|
11116
11140
|
width: 1000,
|
|
@@ -11124,7 +11148,7 @@ const AnalysisCenter = ({ tools, showFilterAndSort = false })=>{
|
|
|
11124
11148
|
className: "p-0.5 rounded-sm bg-base-lightest ml-5 border-2 border-base",
|
|
11125
11149
|
children: /*#__PURE__*/ jsx(Image$1, {
|
|
11126
11150
|
component: Image,
|
|
11127
|
-
src:
|
|
11151
|
+
src: `${icon}`,
|
|
11128
11152
|
alt: `${title} logo`,
|
|
11129
11153
|
width: 40,
|
|
11130
11154
|
height: 40,
|
|
@@ -11205,7 +11229,7 @@ class FilesystemContent {
|
|
|
11205
11229
|
}
|
|
11206
11230
|
async get(filepath) {
|
|
11207
11231
|
try {
|
|
11208
|
-
return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('
|
|
11232
|
+
return await JSON.parse(fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'));
|
|
11209
11233
|
} catch (err) {
|
|
11210
11234
|
throw new Error(`Cannot process ${filepath}`);
|
|
11211
11235
|
}
|
|
@@ -16628,7 +16652,6 @@ const AnalysisCardEditor = ()=>{
|
|
|
16628
16652
|
});
|
|
16629
16653
|
if (Array.isArray(withImages)) {
|
|
16630
16654
|
updateHistory(withImages);
|
|
16631
|
-
console.log('Imported cards:', withImages);
|
|
16632
16655
|
}
|
|
16633
16656
|
} catch (error) {
|
|
16634
16657
|
alert('Invalid file format');
|
|
@@ -17163,6 +17186,7 @@ const AISearchPageGetServerSideProps = async ()=>{
|
|
|
17163
17186
|
};
|
|
17164
17187
|
|
|
17165
17188
|
const NotebookLitePage = ({ headerProps, footerProps })=>{
|
|
17189
|
+
const router = useRouter();
|
|
17166
17190
|
return /*#__PURE__*/ jsx(NavPageLayout, {
|
|
17167
17191
|
footerProps,
|
|
17168
17192
|
headerProps,
|
|
@@ -17175,7 +17199,7 @@ const NotebookLitePage = ({ headerProps, footerProps })=>{
|
|
|
17175
17199
|
className: "flex justify-items-center w-full",
|
|
17176
17200
|
children: /*#__PURE__*/ jsx("iframe", {
|
|
17177
17201
|
allow: "cross-origin",
|
|
17178
|
-
src:
|
|
17202
|
+
src: `${router.basePath}/jupyter/index.html`,
|
|
17179
17203
|
width: "100%",
|
|
17180
17204
|
height: "100%",
|
|
17181
17205
|
title: "client notebook"
|
|
@@ -17194,6 +17218,1834 @@ const NotebookLitePageGetStaticProps = async ()=>{
|
|
|
17194
17218
|
};
|
|
17195
17219
|
};
|
|
17196
17220
|
|
|
17221
|
+
const getDataLibraryItem = (dataLibrary, listId, dataId, fileId)=>{
|
|
17222
|
+
if (!(listId in dataLibrary)) return undefined;
|
|
17223
|
+
if (!(dataId in dataLibrary[listId].items)) return undefined;
|
|
17224
|
+
const datasetOrCohort = dataLibrary[listId].items[dataId];
|
|
17225
|
+
const { name } = datasetOrCohort;
|
|
17226
|
+
if (isCohortItem(datasetOrCohort)) {
|
|
17227
|
+
return {
|
|
17228
|
+
...datasetOrCohort,
|
|
17229
|
+
datasetId: dataId,
|
|
17230
|
+
datasetName: name
|
|
17231
|
+
};
|
|
17232
|
+
} else {
|
|
17233
|
+
if (!fileId) return undefined;
|
|
17234
|
+
if (!(fileId in datasetOrCohort.items)) return undefined;
|
|
17235
|
+
if (isFileItem(datasetOrCohort.items[fileId])) {
|
|
17236
|
+
return {
|
|
17237
|
+
datasetName: name,
|
|
17238
|
+
datasetId: dataId,
|
|
17239
|
+
...datasetOrCohort.items[fileId]
|
|
17240
|
+
};
|
|
17241
|
+
}
|
|
17242
|
+
return undefined;
|
|
17243
|
+
}
|
|
17244
|
+
};
|
|
17245
|
+
const getSelectionPaths = (selections)=>{
|
|
17246
|
+
const paths = [];
|
|
17247
|
+
for (const [listId, listMembers] of Object.entries(selections)){
|
|
17248
|
+
for (const [memberId, member] of Object.entries(listMembers)){
|
|
17249
|
+
if (Object.keys(member.objectIds).length === 0) {
|
|
17250
|
+
// If there are no objectIds, add a path with undefined objectId
|
|
17251
|
+
paths.push({
|
|
17252
|
+
listId,
|
|
17253
|
+
memberId
|
|
17254
|
+
});
|
|
17255
|
+
} else {
|
|
17256
|
+
for (const [objectId, isSelected] of Object.entries(member.objectIds)){
|
|
17257
|
+
if (isSelected) {
|
|
17258
|
+
paths.push({
|
|
17259
|
+
listId,
|
|
17260
|
+
memberId,
|
|
17261
|
+
objectId
|
|
17262
|
+
});
|
|
17263
|
+
}
|
|
17264
|
+
}
|
|
17265
|
+
}
|
|
17266
|
+
}
|
|
17267
|
+
}
|
|
17268
|
+
return paths;
|
|
17269
|
+
};
|
|
17270
|
+
const getSelectedItemsFromDataLibrary = (selections, dataLibrary)=>{
|
|
17271
|
+
const selectedPaths = getSelectionPaths(selections);
|
|
17272
|
+
const uniqueItems = new Map();
|
|
17273
|
+
selectedPaths.forEach((path)=>{
|
|
17274
|
+
const item = getDataLibraryItem(dataLibrary, path.listId, path.memberId, path.objectId);
|
|
17275
|
+
if (item) {
|
|
17276
|
+
const key = getUniqueItemKey(item);
|
|
17277
|
+
uniqueItems.set(key, item);
|
|
17278
|
+
}
|
|
17279
|
+
});
|
|
17280
|
+
return Array.from(uniqueItems.values());
|
|
17281
|
+
};
|
|
17282
|
+
const getUniqueItemKey = (item)=>{
|
|
17283
|
+
if (isCohortItem(item)) {
|
|
17284
|
+
// For CohortItems
|
|
17285
|
+
return `cohort_${item.datasetId}`;
|
|
17286
|
+
} else {
|
|
17287
|
+
// For FileItems
|
|
17288
|
+
return `file_${item.datasetId}_${item.id}`;
|
|
17289
|
+
}
|
|
17290
|
+
};
|
|
17291
|
+
|
|
17292
|
+
// Create the context
|
|
17293
|
+
const DataLibrarySelectionContext = /*#__PURE__*/ createContext(undefined);
|
|
17294
|
+
// Reducer function
|
|
17295
|
+
const dataLibrarySelectionReducer = (selections, action)=>{
|
|
17296
|
+
switch(action.type){
|
|
17297
|
+
case 'UPDATE_DATA_LIBRARY_SELECTION':
|
|
17298
|
+
return {
|
|
17299
|
+
...selections,
|
|
17300
|
+
[action.payload.listId]: action.payload.members
|
|
17301
|
+
};
|
|
17302
|
+
case 'UPDATE_DATALIST_MEMBER_SELECTION':
|
|
17303
|
+
if (Object.keys(action.payload.selection).length === 0) {
|
|
17304
|
+
// need to remove the dataset
|
|
17305
|
+
const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
|
|
17306
|
+
if (Object.keys(restState).length === 0) {
|
|
17307
|
+
const { [action.payload.listId]: _unused2, ...restList } = selections;
|
|
17308
|
+
return restList;
|
|
17309
|
+
}
|
|
17310
|
+
return {
|
|
17311
|
+
...selections,
|
|
17312
|
+
[action.payload.listId]: {
|
|
17313
|
+
...restState
|
|
17314
|
+
}
|
|
17315
|
+
};
|
|
17316
|
+
}
|
|
17317
|
+
return {
|
|
17318
|
+
...selections,
|
|
17319
|
+
[action.payload.listId]: {
|
|
17320
|
+
...selections[action.payload.listId],
|
|
17321
|
+
[action.payload.memberId]: {
|
|
17322
|
+
id: action.payload.memberId,
|
|
17323
|
+
objectIds: action.payload.selection
|
|
17324
|
+
}
|
|
17325
|
+
}
|
|
17326
|
+
};
|
|
17327
|
+
case 'DELETE_DATA_LIBRARY_LIST':
|
|
17328
|
+
{
|
|
17329
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17330
|
+
const { [action.payload.listId]: _unused, ...restState } = selections;
|
|
17331
|
+
return restState;
|
|
17332
|
+
}
|
|
17333
|
+
case 'DELETE_DATA_LIBRARY_LIST_MEMBER':
|
|
17334
|
+
{
|
|
17335
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17336
|
+
if (!(action.payload.listId in selections)) return selections;
|
|
17337
|
+
const { [action.payload.listId]: { [action.payload.memberId]: _unused, ...restState } } = selections;
|
|
17338
|
+
return {
|
|
17339
|
+
...selections,
|
|
17340
|
+
[action.payload.listId]: {
|
|
17341
|
+
...restState
|
|
17342
|
+
}
|
|
17343
|
+
};
|
|
17344
|
+
}
|
|
17345
|
+
case 'CLEAR_DATA_LIBRARY_SELECTION':
|
|
17346
|
+
return {};
|
|
17347
|
+
default:
|
|
17348
|
+
return selections;
|
|
17349
|
+
}
|
|
17350
|
+
};
|
|
17351
|
+
// Provider component
|
|
17352
|
+
const DataLibrarySelectionProvider = ({ children })=>{
|
|
17353
|
+
const [selections, dispatch] = useReducer(dataLibrarySelectionReducer, {});
|
|
17354
|
+
const [gatheredItems, setGatheredItems] = useState([]);
|
|
17355
|
+
const updateSelections = (listId, members)=>{
|
|
17356
|
+
dispatch(updateDataLibrarySelection(listId, members));
|
|
17357
|
+
};
|
|
17358
|
+
const updateListMemberSelections = (listId, memberId, selection)=>{
|
|
17359
|
+
dispatch(updateDataLibraryListMemberSelection(listId, memberId, selection));
|
|
17360
|
+
};
|
|
17361
|
+
const clearSelections = ()=>{
|
|
17362
|
+
dispatch(clearDataLibrarySelection());
|
|
17363
|
+
};
|
|
17364
|
+
const removeList = (listId)=>{
|
|
17365
|
+
dispatch(removeDataLibrarySelection(listId));
|
|
17366
|
+
};
|
|
17367
|
+
const removeListMember = (listId, memberId)=>{
|
|
17368
|
+
dispatch(removeDataLibraryMemberSelection(listId, memberId));
|
|
17369
|
+
};
|
|
17370
|
+
const gatherSelectedItems = (dataLibrary)=>{
|
|
17371
|
+
if (dataLibrary) {
|
|
17372
|
+
const gatheredItems = getSelectedItemsFromDataLibrary(selections, dataLibrary);
|
|
17373
|
+
setGatheredItems(gatheredItems);
|
|
17374
|
+
}
|
|
17375
|
+
};
|
|
17376
|
+
return /*#__PURE__*/ jsx(DataLibrarySelectionContext.Provider, {
|
|
17377
|
+
value: {
|
|
17378
|
+
selections,
|
|
17379
|
+
gatheredItems,
|
|
17380
|
+
dispatch,
|
|
17381
|
+
updateSelections,
|
|
17382
|
+
updateListMemberSelections,
|
|
17383
|
+
clearSelections,
|
|
17384
|
+
removeList,
|
|
17385
|
+
removeListMember,
|
|
17386
|
+
gatherSelectedItems
|
|
17387
|
+
},
|
|
17388
|
+
children: children
|
|
17389
|
+
});
|
|
17390
|
+
};
|
|
17391
|
+
// Custom hook for using the data library
|
|
17392
|
+
const useDataLibrarySelection = ()=>{
|
|
17393
|
+
const context = useContext(DataLibrarySelectionContext);
|
|
17394
|
+
if (!context) {
|
|
17395
|
+
throw new Error('useDataLibrary must be used within a DataLibraryProvider');
|
|
17396
|
+
}
|
|
17397
|
+
return context;
|
|
17398
|
+
};
|
|
17399
|
+
const updateDataLibrarySelection = (listId, members)=>({
|
|
17400
|
+
type: 'UPDATE_DATA_LIBRARY_SELECTION',
|
|
17401
|
+
payload: {
|
|
17402
|
+
listId,
|
|
17403
|
+
members
|
|
17404
|
+
}
|
|
17405
|
+
});
|
|
17406
|
+
const updateDataLibraryListMemberSelection = (listId, memberId, selection)=>({
|
|
17407
|
+
type: 'UPDATE_DATALIST_MEMBER_SELECTION',
|
|
17408
|
+
payload: {
|
|
17409
|
+
listId,
|
|
17410
|
+
memberId,
|
|
17411
|
+
selection
|
|
17412
|
+
}
|
|
17413
|
+
});
|
|
17414
|
+
const clearDataLibrarySelection = ()=>({
|
|
17415
|
+
type: 'CLEAR_DATA_LIBRARY_SELECTION'
|
|
17416
|
+
});
|
|
17417
|
+
const removeDataLibrarySelection = (listId)=>({
|
|
17418
|
+
type: 'DELETE_DATA_LIBRARY_LIST',
|
|
17419
|
+
payload: {
|
|
17420
|
+
listId
|
|
17421
|
+
}
|
|
17422
|
+
});
|
|
17423
|
+
const removeDataLibraryMemberSelection = (listId, memberId)=>({
|
|
17424
|
+
type: 'DELETE_DATA_LIBRARY_LIST_MEMBER',
|
|
17425
|
+
payload: {
|
|
17426
|
+
listId,
|
|
17427
|
+
memberId
|
|
17428
|
+
}
|
|
17429
|
+
});
|
|
17430
|
+
const getNumberOfDataSetItemsSelected = (selections, listId, itemId)=>{
|
|
17431
|
+
return Object.keys(selections?.[listId]?.[itemId]?.objectIds ?? {}).length;
|
|
17432
|
+
};
|
|
17433
|
+
const getNumberOfSelectedItemsInList = (selections, listId)=>{
|
|
17434
|
+
if (!(listId in selections)) return -1; // return -1 indicating there is no listId in selection
|
|
17435
|
+
return Object.keys(selections[listId]).reduce((count, datasetId)=>{
|
|
17436
|
+
try {
|
|
17437
|
+
return count + getNumberOfDataSetItemsSelected(selections, listId, datasetId);
|
|
17438
|
+
} catch (error) {
|
|
17439
|
+
console.error(`Failed to get number of selected items for dataset ${datasetId} in list ${listId}:`, error);
|
|
17440
|
+
return count;
|
|
17441
|
+
}
|
|
17442
|
+
}, 0);
|
|
17443
|
+
};
|
|
17444
|
+
const isListInSelection = (listId, selections)=>listId in selections;
|
|
17445
|
+
|
|
17446
|
+
const IconSize = {
|
|
17447
|
+
xs: 14,
|
|
17448
|
+
sm: 16,
|
|
17449
|
+
md: 20,
|
|
17450
|
+
lg: 24,
|
|
17451
|
+
xl: 32,
|
|
17452
|
+
'xl-2': 36
|
|
17453
|
+
};
|
|
17454
|
+
|
|
17455
|
+
const SearchAndActions = ({ createList, gatherData, size = 'sm' })=>{
|
|
17456
|
+
const { selections, clearSelections } = useDataLibrarySelection();
|
|
17457
|
+
const retrieveDisabled = Object.keys(selections).length === 0;
|
|
17458
|
+
const iconSize = IconSize[size] || IconSize['sm'];
|
|
17459
|
+
return /*#__PURE__*/ jsx("div", {
|
|
17460
|
+
className: "flex justify-between p-2 bg-primary-dark text-primary-contrast-dark",
|
|
17461
|
+
children: /*#__PURE__*/ jsxs(Group, {
|
|
17462
|
+
children: [
|
|
17463
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
17464
|
+
label: "Retrieve selections",
|
|
17465
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
17466
|
+
disabled: retrieveDisabled,
|
|
17467
|
+
// disabled={Object.keys(selections).length === 0}
|
|
17468
|
+
size: `compact-${size}`,
|
|
17469
|
+
variant: "outline",
|
|
17470
|
+
onClick: ()=>gatherData(),
|
|
17471
|
+
"aria-label": "Retrieve Selected Data",
|
|
17472
|
+
classNames: {
|
|
17473
|
+
root: 'bg-base-max hover:bg-base-light'
|
|
17474
|
+
},
|
|
17475
|
+
children: "Retrieve Selected"
|
|
17476
|
+
})
|
|
17477
|
+
}),
|
|
17478
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
17479
|
+
label: "Clear selections",
|
|
17480
|
+
children: /*#__PURE__*/ jsx(ActionIcon, {
|
|
17481
|
+
disabled: retrieveDisabled,
|
|
17482
|
+
variant: "outline",
|
|
17483
|
+
size: size,
|
|
17484
|
+
onClick: ()=>{
|
|
17485
|
+
clearSelections();
|
|
17486
|
+
},
|
|
17487
|
+
color: "accent-contrast.4",
|
|
17488
|
+
"aria-label": "clear selections",
|
|
17489
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
17490
|
+
icon: "gen3:clear-list",
|
|
17491
|
+
width: iconSize,
|
|
17492
|
+
height: iconSize
|
|
17493
|
+
})
|
|
17494
|
+
})
|
|
17495
|
+
})
|
|
17496
|
+
]
|
|
17497
|
+
})
|
|
17498
|
+
});
|
|
17499
|
+
};
|
|
17500
|
+
|
|
17501
|
+
const HTTPUserFriendlyErrorMessages = {
|
|
17502
|
+
// 4xx Client Errors
|
|
17503
|
+
400: 'Sorry, there was a problem with your request. Please check the information you provided and try again.',
|
|
17504
|
+
401: 'Please sign in to access this content. If you need to create an account, please contact support.',
|
|
17505
|
+
402: 'This feature requires payment to continue. Please update your subscription.',
|
|
17506
|
+
403: "You don't have permission to access this. If you think this is a mistake, please contact support.",
|
|
17507
|
+
404: "We couldn't find what you're looking for. The link might be broken or the content may have been moved.",
|
|
17508
|
+
405: 'This action is not supported. Please try a different approach.',
|
|
17509
|
+
406: "Your browser sent a request that this server couldn't understand. Try updating your browser.",
|
|
17510
|
+
407: 'Please authenticate with the network proxy first.',
|
|
17511
|
+
408: 'The request took too long to complete. Please check your internet connection and try again.',
|
|
17512
|
+
409: 'There was a conflict with your request. Someone might have modified the same content.',
|
|
17513
|
+
410: 'This content has been permanently removed and is no longer available.',
|
|
17514
|
+
411: 'There was a technical problem with your request. Please try again.',
|
|
17515
|
+
412: "Some conditions for this request weren't met. Please try again.",
|
|
17516
|
+
413: "The file you're trying to upload is too large. Please choose a smaller file.",
|
|
17517
|
+
414: 'The web address is too long. Please try a shorter URL.',
|
|
17518
|
+
415: 'This type of file is not supported. Please try a different format.',
|
|
17519
|
+
416: 'The requested content range is not available.',
|
|
17520
|
+
417: "Your request couldn't be completed as expected. Please try again.",
|
|
17521
|
+
418: 'Unusual error occurred. Please try again or contact support if the problem persists.',
|
|
17522
|
+
421: 'Your request was sent to the wrong server. Please try again.',
|
|
17523
|
+
422: "We couldn't process your request. Please check the information and try again.",
|
|
17524
|
+
423: 'This resource is temporarily locked. Please try again in a few moments.',
|
|
17525
|
+
424: 'The request failed because it depends on another request that failed.',
|
|
17526
|
+
425: 'Your request was processed too early. Please try again in a moment.',
|
|
17527
|
+
426: 'You need to upgrade your browser or app to continue.',
|
|
17528
|
+
428: "Some required conditions weren't met. Please check all requirements and try again.",
|
|
17529
|
+
429: "You've made too many requests. Please wait a while before trying again.",
|
|
17530
|
+
431: 'Request failed because the headers are too large. Please simplify your request.',
|
|
17531
|
+
451: 'This content is not available for legal reasons.',
|
|
17532
|
+
// 5xx Server Errors
|
|
17533
|
+
500: "Something went wrong on our end. We're working to fix it. Please try again later.",
|
|
17534
|
+
501: "This feature isn't available yet. Check back later.",
|
|
17535
|
+
502: "We're having trouble connecting to our servers. Please try again in a few minutes.",
|
|
17536
|
+
503: "Our service is temporarily unavailable. We're working to restore it as quickly as possible.",
|
|
17537
|
+
504: 'The server took too long to respond. Please try again later.',
|
|
17538
|
+
505: "Your browser's HTTP version isn't supported. Please try updating your browser.",
|
|
17539
|
+
506: 'We encountered a configuration error.',
|
|
17540
|
+
507: "We're out of storage space.",
|
|
17541
|
+
508: 'We detected an infinite loop in our servers.',
|
|
17542
|
+
510: 'This server requires additional extensions to process your request.',
|
|
17543
|
+
511: 'Please sign in to the network before continuing.'
|
|
17544
|
+
};
|
|
17545
|
+
|
|
17546
|
+
const SelectedItemsTableHeader = ({ numberOfItems, numberOfWarnings, size = 'sm' })=>{
|
|
17547
|
+
const iconSize = IconSize[size] || IconSize['sm'];
|
|
17548
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
17549
|
+
className: "flex items-center bg-primary-darker px-4 py-2 mt-2 min-h-10 text-heading",
|
|
17550
|
+
children: [
|
|
17551
|
+
numberOfItems > 0 && /*#__PURE__*/ jsxs("div", {
|
|
17552
|
+
className: "flex items-center flex-nowrap overflow-ellipsis text-primary-contrast-darker",
|
|
17553
|
+
children: [
|
|
17554
|
+
/*#__PURE__*/ jsx(Text, {
|
|
17555
|
+
fw: 600,
|
|
17556
|
+
size: size,
|
|
17557
|
+
className: "mr-1 ",
|
|
17558
|
+
children: numberOfItems
|
|
17559
|
+
}),
|
|
17560
|
+
/*#__PURE__*/ jsx(Text, {
|
|
17561
|
+
fw: 400,
|
|
17562
|
+
size: size,
|
|
17563
|
+
className: "mr-1 text-primary-contrast-lighter",
|
|
17564
|
+
children: "selected"
|
|
17565
|
+
})
|
|
17566
|
+
]
|
|
17567
|
+
}),
|
|
17568
|
+
numberOfItems > 0 && numberOfWarnings > 0 && /*#__PURE__*/ jsx(Icon, {
|
|
17569
|
+
icon: "gen3:dot",
|
|
17570
|
+
className: "text-primary-contrast-lighter",
|
|
17571
|
+
width: iconSize,
|
|
17572
|
+
height: iconSize
|
|
17573
|
+
}),
|
|
17574
|
+
numberOfWarnings > 0 && /*#__PURE__*/ jsxs("div", {
|
|
17575
|
+
className: "flex items-center flex-nowrap overflow-ellipsis",
|
|
17576
|
+
children: [
|
|
17577
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
17578
|
+
icon: "gen3:warning",
|
|
17579
|
+
width: iconSize,
|
|
17580
|
+
height: iconSize,
|
|
17581
|
+
className: "text-utility-warning m-1"
|
|
17582
|
+
}),
|
|
17583
|
+
/*#__PURE__*/ jsx(Text, {
|
|
17584
|
+
fw: 600,
|
|
17585
|
+
size: size,
|
|
17586
|
+
className: "mr-1 text-primary-contrast-lighter",
|
|
17587
|
+
children: numberOfWarnings
|
|
17588
|
+
}),
|
|
17589
|
+
/*#__PURE__*/ jsx(Text, {
|
|
17590
|
+
fw: 400,
|
|
17591
|
+
size: size,
|
|
17592
|
+
className: "text-primary-contrast-lighter",
|
|
17593
|
+
children: `${numberOfWarnings == 1 ? 'warning' : 'warnings'}`
|
|
17594
|
+
})
|
|
17595
|
+
]
|
|
17596
|
+
})
|
|
17597
|
+
]
|
|
17598
|
+
});
|
|
17599
|
+
};
|
|
17600
|
+
const SelectedItemsTable = ({ validatedItems, rowSelection, setRowSelection, size = 'sm' })=>{
|
|
17601
|
+
const handleRowSelectionChange = (updater)=>{
|
|
17602
|
+
let value = {};
|
|
17603
|
+
setRowSelection((prevSelection)=>{
|
|
17604
|
+
value = updater instanceof Function ? updater(prevSelection) : updater;
|
|
17605
|
+
return value;
|
|
17606
|
+
});
|
|
17607
|
+
};
|
|
17608
|
+
const iconSize = IconSize[size] || IconSize['sm'];
|
|
17609
|
+
const columns = useMemo(()=>[
|
|
17610
|
+
{
|
|
17611
|
+
accessorKey: 'valid',
|
|
17612
|
+
enableHiding: true,
|
|
17613
|
+
size: 40,
|
|
17614
|
+
maxSize: 50,
|
|
17615
|
+
header: 'Valid',
|
|
17616
|
+
Cell: ({ row })=>{
|
|
17617
|
+
if (row.original.valid === undefined) return /*#__PURE__*/ jsx("span", {});
|
|
17618
|
+
if (!row.original.valid) {
|
|
17619
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
17620
|
+
label: row.original?.messages?.join('\n') ?? 'Unknown Error',
|
|
17621
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
17622
|
+
icon: "gen3:warning",
|
|
17623
|
+
width: iconSize,
|
|
17624
|
+
height: iconSize,
|
|
17625
|
+
className: "text-utility-warning text-xl",
|
|
17626
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
17627
|
+
fw: 400,
|
|
17628
|
+
size: size,
|
|
17629
|
+
children: row.original?.messages?.length
|
|
17630
|
+
})
|
|
17631
|
+
})
|
|
17632
|
+
});
|
|
17633
|
+
} else {
|
|
17634
|
+
return /*#__PURE__*/ jsx(Icon, {
|
|
17635
|
+
icon: "gen3:check-fill",
|
|
17636
|
+
width: iconSize,
|
|
17637
|
+
height: iconSize,
|
|
17638
|
+
className: "text-utility-success"
|
|
17639
|
+
});
|
|
17640
|
+
}
|
|
17641
|
+
}
|
|
17642
|
+
},
|
|
17643
|
+
{
|
|
17644
|
+
accessorKey: 'id',
|
|
17645
|
+
header: 'Id'
|
|
17646
|
+
},
|
|
17647
|
+
{
|
|
17648
|
+
accessorKey: 'description',
|
|
17649
|
+
header: 'Description',
|
|
17650
|
+
size: 150,
|
|
17651
|
+
maxSize: 250,
|
|
17652
|
+
Cell: ({ cell })=>{
|
|
17653
|
+
return /*#__PURE__*/ jsx(Text, {
|
|
17654
|
+
fw: 400,
|
|
17655
|
+
size: size,
|
|
17656
|
+
lineClamp: 2,
|
|
17657
|
+
children: cell.getValue() ?? 'N/A'
|
|
17658
|
+
});
|
|
17659
|
+
}
|
|
17660
|
+
},
|
|
17661
|
+
{
|
|
17662
|
+
accessorKey: 'type',
|
|
17663
|
+
header: 'Type'
|
|
17664
|
+
},
|
|
17665
|
+
{
|
|
17666
|
+
accessorKey: 'size',
|
|
17667
|
+
header: 'Size'
|
|
17668
|
+
},
|
|
17669
|
+
{
|
|
17670
|
+
accessorKey: 'datasetId',
|
|
17671
|
+
header: 'Dataset ID'
|
|
17672
|
+
}
|
|
17673
|
+
], [
|
|
17674
|
+
iconSize,
|
|
17675
|
+
size
|
|
17676
|
+
]);
|
|
17677
|
+
const tableRows = useDeepCompareMemo(()=>{
|
|
17678
|
+
let hasInvalidRows = false;
|
|
17679
|
+
const rows = validatedItems.map((item)=>{
|
|
17680
|
+
if (!item.valid) hasInvalidRows = true;
|
|
17681
|
+
if (isCohortItem(item)) {
|
|
17682
|
+
return {
|
|
17683
|
+
id: item.id,
|
|
17684
|
+
name: item.name,
|
|
17685
|
+
description: item.description,
|
|
17686
|
+
type: item.itemType,
|
|
17687
|
+
size: undefined,
|
|
17688
|
+
datasetName: item.name,
|
|
17689
|
+
datasetId: item.datasetId,
|
|
17690
|
+
valid: item.valid,
|
|
17691
|
+
messages: item?.errorMessages
|
|
17692
|
+
};
|
|
17693
|
+
}
|
|
17694
|
+
return {
|
|
17695
|
+
id: item.id,
|
|
17696
|
+
name: item.name,
|
|
17697
|
+
description: item.description,
|
|
17698
|
+
type: item.type,
|
|
17699
|
+
size: item.size,
|
|
17700
|
+
datasetId: item.datasetId,
|
|
17701
|
+
datasetName: item.datasetName,
|
|
17702
|
+
valid: item.valid,
|
|
17703
|
+
messages: item?.errorMessages
|
|
17704
|
+
};
|
|
17705
|
+
});
|
|
17706
|
+
return {
|
|
17707
|
+
rows,
|
|
17708
|
+
hasInvalidRows
|
|
17709
|
+
};
|
|
17710
|
+
}, [
|
|
17711
|
+
validatedItems
|
|
17712
|
+
]);
|
|
17713
|
+
const table = useMantineReactTable({
|
|
17714
|
+
columns,
|
|
17715
|
+
data: tableRows.rows,
|
|
17716
|
+
enableColumnResizing: false,
|
|
17717
|
+
icons: TableIcons,
|
|
17718
|
+
enableTopToolbar: false,
|
|
17719
|
+
enableRowSelection: true,
|
|
17720
|
+
enableBottomToolbar: tableRows.rows.length > 10,
|
|
17721
|
+
enablePagination: tableRows.rows.length > 10,
|
|
17722
|
+
enableRowActions: false,
|
|
17723
|
+
enableStickyFooter: true,
|
|
17724
|
+
enableStickyHeader: true,
|
|
17725
|
+
enableHiding: true,
|
|
17726
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
17727
|
+
state: {
|
|
17728
|
+
rowSelection
|
|
17729
|
+
},
|
|
17730
|
+
initialState: {
|
|
17731
|
+
density: 'xs',
|
|
17732
|
+
columnPinning: {
|
|
17733
|
+
left: [
|
|
17734
|
+
'mrt-row-select',
|
|
17735
|
+
'mrt-row-expand'
|
|
17736
|
+
],
|
|
17737
|
+
right: [
|
|
17738
|
+
'mrt-row-actions'
|
|
17739
|
+
]
|
|
17740
|
+
}
|
|
17741
|
+
},
|
|
17742
|
+
layoutMode: 'semantic',
|
|
17743
|
+
mantineDetailPanelProps: {
|
|
17744
|
+
style: {
|
|
17745
|
+
boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
|
|
17746
|
+
}
|
|
17747
|
+
},
|
|
17748
|
+
mantineTableProps: {
|
|
17749
|
+
style: {
|
|
17750
|
+
backgroundColor: 'var(--mantine-color-base-1)',
|
|
17751
|
+
'--mrt-striped-row-background-color': 'var(--mantine-color-base-3)'
|
|
17752
|
+
}
|
|
17753
|
+
},
|
|
17754
|
+
mantineTableHeadCellProps: {
|
|
17755
|
+
style: {
|
|
17756
|
+
backgroundColor: 'var(--mantine-color-table-1)',
|
|
17757
|
+
color: 'var(--mantine-color-table-contrast-1)',
|
|
17758
|
+
textAlign: 'center',
|
|
17759
|
+
padding: '0.25rem 0.5rem 0.25rem 0.5rem',
|
|
17760
|
+
fontWeight: 600,
|
|
17761
|
+
fontSize: `var(--mantine-font-size-${size})`
|
|
17762
|
+
}
|
|
17763
|
+
}
|
|
17764
|
+
});
|
|
17765
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
17766
|
+
className: "flex flex-col ml-8",
|
|
17767
|
+
children: [
|
|
17768
|
+
/*#__PURE__*/ jsx(SelectedItemsTableHeader, {
|
|
17769
|
+
numberOfItems: Object.keys(rowSelection).length,
|
|
17770
|
+
numberOfWarnings: tableRows.rows.filter((x)=>x.valid === false).length,
|
|
17771
|
+
size: size
|
|
17772
|
+
}),
|
|
17773
|
+
/*#__PURE__*/ jsx("div", {
|
|
17774
|
+
className: "mt-2",
|
|
17775
|
+
children: /*#__PURE__*/ jsx(MantineReactTable, {
|
|
17776
|
+
table: table
|
|
17777
|
+
})
|
|
17778
|
+
})
|
|
17779
|
+
]
|
|
17780
|
+
});
|
|
17781
|
+
};
|
|
17782
|
+
|
|
17783
|
+
const isArrayField = (value)=>Array.isArray(value);
|
|
17784
|
+
const isNumeric = (value)=>typeof value === 'number' && !isNaN(value);
|
|
17785
|
+
const evaluateItemRule = (rule, item)=>{
|
|
17786
|
+
switch(rule.operator){
|
|
17787
|
+
case 'equals':
|
|
17788
|
+
case 'not':
|
|
17789
|
+
{
|
|
17790
|
+
const fieldValue = item[rule.field];
|
|
17791
|
+
return rule.operator === 'equals' ? fieldValue === rule.value : fieldValue !== rule.value;
|
|
17792
|
+
}
|
|
17793
|
+
case 'includes':
|
|
17794
|
+
case 'excludes':
|
|
17795
|
+
{
|
|
17796
|
+
const fieldValue = item[rule.field];
|
|
17797
|
+
if (!isArrayField(fieldValue)) return false;
|
|
17798
|
+
return rule.operator === 'includes' ? fieldValue.includes(rule.value) : !fieldValue.includes(rule.value);
|
|
17799
|
+
}
|
|
17800
|
+
case 'greater':
|
|
17801
|
+
case 'less':
|
|
17802
|
+
{
|
|
17803
|
+
const fieldValue = item[rule.field];
|
|
17804
|
+
if (isNumeric(fieldValue) && isNumeric(rule.value)) return rule.operator === 'greater' ? fieldValue > rule.value : fieldValue < rule.value;
|
|
17805
|
+
return false;
|
|
17806
|
+
}
|
|
17807
|
+
default:
|
|
17808
|
+
return false;
|
|
17809
|
+
}
|
|
17810
|
+
};
|
|
17811
|
+
const evaluateGroupRule = (rule, items)=>{
|
|
17812
|
+
switch(rule.operator){
|
|
17813
|
+
case 'count':
|
|
17814
|
+
{
|
|
17815
|
+
const fieldValue = items.map((item)=>item[rule.field]);
|
|
17816
|
+
return fieldValue.length === rule.total;
|
|
17817
|
+
}
|
|
17818
|
+
}
|
|
17819
|
+
};
|
|
17820
|
+
/**
|
|
17821
|
+
* Retrieves an action configuration from a set of actions by its unique identifier.
|
|
17822
|
+
*
|
|
17823
|
+
* @param {ActionsConfig} actions - An array of action configurations.
|
|
17824
|
+
* @param {string} id - The unique identifier of the desired action configuration.
|
|
17825
|
+
* @returns {DataLibraryActionConfig | undefined} The action configuration with the matching identifier, or undefined if not found.
|
|
17826
|
+
*/ const getActionById = (actions, id)=>{
|
|
17827
|
+
if (!id) return undefined;
|
|
17828
|
+
return actions.find((action)=>action.id === id);
|
|
17829
|
+
};
|
|
17830
|
+
const doesItemFailRule = (item, action)=>{
|
|
17831
|
+
return action?.itemRules?.reduce((acc, rule)=>{
|
|
17832
|
+
if (!evaluateItemRule(rule, item)) {
|
|
17833
|
+
acc.push(rule.errorMessage);
|
|
17834
|
+
}
|
|
17835
|
+
return acc;
|
|
17836
|
+
}, []) ?? [];
|
|
17837
|
+
};
|
|
17838
|
+
const doesGroupFailRule = (items, action)=>{
|
|
17839
|
+
return action?.groupRules?.reduce((acc, rule)=>{
|
|
17840
|
+
if (!evaluateGroupRule(rule, items)) {
|
|
17841
|
+
acc.push(rule.errorMessage);
|
|
17842
|
+
}
|
|
17843
|
+
return acc;
|
|
17844
|
+
}, []) ?? [];
|
|
17845
|
+
};
|
|
17846
|
+
|
|
17847
|
+
const PRESIGNED_URL_TEMPLATE_VARIABLE = '{{PRESIGNED_URL}}';
|
|
17848
|
+
const isSendExistingPFBToURLParameters = (value)=>{
|
|
17849
|
+
if (!value || typeof value !== 'object') {
|
|
17850
|
+
return false;
|
|
17851
|
+
}
|
|
17852
|
+
const candidate = value;
|
|
17853
|
+
return 'targetURLTemplate' in candidate && typeof candidate.targetURLTemplate === 'string';
|
|
17854
|
+
};
|
|
17855
|
+
const sendExistingPFBToURL = async (validatedSelections, params, done = ()=>null, error = ()=>null, onAbort = ()=>null, signal = undefined)=>{
|
|
17856
|
+
if (!isSendExistingPFBToURLParameters(params)) {
|
|
17857
|
+
console.error('Invalid parameters for sendPFBToURL action:', params);
|
|
17858
|
+
return;
|
|
17859
|
+
}
|
|
17860
|
+
const { targetURLTemplate } = params;
|
|
17861
|
+
// get the selection
|
|
17862
|
+
if (validatedSelections.length !== 1 || !isFileItem(validatedSelections[0])) {
|
|
17863
|
+
notifications.show({
|
|
17864
|
+
id: 'data-library-send-existing-pfb-to-url-validate-length',
|
|
17865
|
+
position: 'bottom-center',
|
|
17866
|
+
withCloseButton: true,
|
|
17867
|
+
autoClose: 5000,
|
|
17868
|
+
title: 'Action Error',
|
|
17869
|
+
message: 'Invalid data passed to send PFB to URL',
|
|
17870
|
+
color: 'red',
|
|
17871
|
+
loading: false
|
|
17872
|
+
});
|
|
17873
|
+
return;
|
|
17874
|
+
}
|
|
17875
|
+
const { guid } = validatedSelections[0];
|
|
17876
|
+
// get the pre-signed URL for the selected PFB
|
|
17877
|
+
try {
|
|
17878
|
+
const presignedURL = await fetchFencePresignedURL({
|
|
17879
|
+
guid: guid,
|
|
17880
|
+
onAbort: onAbort,
|
|
17881
|
+
signal: signal
|
|
17882
|
+
});
|
|
17883
|
+
// the PFB export target URL is a template URL that should have a {{PRESIGNED_URL}} template
|
|
17884
|
+
// variable in it.
|
|
17885
|
+
const signedURL = encodeURIComponent(presignedURL);
|
|
17886
|
+
const targetURL = targetURLTemplate.replace(PRESIGNED_URL_TEMPLATE_VARIABLE, signedURL);
|
|
17887
|
+
return new Promise(()=>{
|
|
17888
|
+
if (window) window.open(targetURL, '_blank', 'noopener,noreferrer');
|
|
17889
|
+
if (done) done(targetURL);
|
|
17890
|
+
});
|
|
17891
|
+
} catch (e) {
|
|
17892
|
+
return new Promise(()=>{
|
|
17893
|
+
error(e);
|
|
17894
|
+
});
|
|
17895
|
+
}
|
|
17896
|
+
};
|
|
17897
|
+
|
|
17898
|
+
const registeredDataLibraryActions = {};
|
|
17899
|
+
const NullAction = ()=>{
|
|
17900
|
+
return new Promise((done)=>{
|
|
17901
|
+
if (done) done();
|
|
17902
|
+
});
|
|
17903
|
+
};
|
|
17904
|
+
const registerAction = (actionName, action)=>{
|
|
17905
|
+
registeredDataLibraryActions[actionName] = action;
|
|
17906
|
+
};
|
|
17907
|
+
const findAction = (actionName)=>{
|
|
17908
|
+
if (actionName === undefined) {
|
|
17909
|
+
console.error('DataLibrary: findAction: no name provided');
|
|
17910
|
+
return undefined;
|
|
17911
|
+
}
|
|
17912
|
+
if (!(actionName in registeredDataLibraryActions)) {
|
|
17913
|
+
console.error('getButtonAction: no action found for', actionName);
|
|
17914
|
+
return undefined;
|
|
17915
|
+
}
|
|
17916
|
+
return registeredDataLibraryActions[actionName];
|
|
17917
|
+
};
|
|
17918
|
+
const registerDefaultDataLibraryActions = ()=>{
|
|
17919
|
+
registerAction('export-pfb-to-url', {
|
|
17920
|
+
action: sendExistingPFBToURL
|
|
17921
|
+
});
|
|
17922
|
+
};
|
|
17923
|
+
registerDefaultDataLibraryActions();
|
|
17924
|
+
|
|
17925
|
+
const ModalHeader = ()=>{
|
|
17926
|
+
return /*#__PURE__*/ jsx("div", {
|
|
17927
|
+
className: "flex justify-between items-center",
|
|
17928
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
17929
|
+
fw: 600,
|
|
17930
|
+
className: "text-heading",
|
|
17931
|
+
children: "Retrieve Data"
|
|
17932
|
+
})
|
|
17933
|
+
});
|
|
17934
|
+
};
|
|
17935
|
+
const bindAction = (action)=>{
|
|
17936
|
+
const actionFunction = findAction(action.actionFunction);
|
|
17937
|
+
if (!actionFunction) {
|
|
17938
|
+
return NullAction;
|
|
17939
|
+
}
|
|
17940
|
+
return actionFunction.action;
|
|
17941
|
+
};
|
|
17942
|
+
const SelectedItemsModal = (props)=>{
|
|
17943
|
+
const [value, setValue] = useState(null);
|
|
17944
|
+
const { actions } = props;
|
|
17945
|
+
const { gatheredItems } = useDataLibrarySelection();
|
|
17946
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
17947
|
+
const [actionFunction, setActionFunction] = useState({
|
|
17948
|
+
action: NullAction
|
|
17949
|
+
});
|
|
17950
|
+
const [actionConfig, setActionConfig] = useState(null);
|
|
17951
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
17952
|
+
const destinations = useMemo(()=>{
|
|
17953
|
+
return actions.map((action)=>{
|
|
17954
|
+
return {
|
|
17955
|
+
label: action.label,
|
|
17956
|
+
value: action.id
|
|
17957
|
+
};
|
|
17958
|
+
});
|
|
17959
|
+
}, [
|
|
17960
|
+
actions
|
|
17961
|
+
]);
|
|
17962
|
+
const onError = (error)=>{
|
|
17963
|
+
setIsRunning(false);
|
|
17964
|
+
if (error instanceof HTTPError) {
|
|
17965
|
+
notifications.show({
|
|
17966
|
+
id: 'data-library-selection-action-error',
|
|
17967
|
+
position: 'bottom-center',
|
|
17968
|
+
withCloseButton: true,
|
|
17969
|
+
autoClose: 5000,
|
|
17970
|
+
title: 'Action Error',
|
|
17971
|
+
message: HTTPUserFriendlyErrorMessages[error.status],
|
|
17972
|
+
color: 'red',
|
|
17973
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
17974
|
+
icon: "gen3:outline-error"
|
|
17975
|
+
}),
|
|
17976
|
+
loading: false
|
|
17977
|
+
});
|
|
17978
|
+
}
|
|
17979
|
+
};
|
|
17980
|
+
const onDone = (arg)=>{
|
|
17981
|
+
setIsRunning(false);
|
|
17982
|
+
notifications.show({
|
|
17983
|
+
id: 'data-library-selection-action-done',
|
|
17984
|
+
position: 'bottom-center',
|
|
17985
|
+
withCloseButton: true,
|
|
17986
|
+
autoClose: 5000,
|
|
17987
|
+
title: 'Submission Complete',
|
|
17988
|
+
message: actionConfig ? `${actionConfig.label} completed successfully` : 'Completed successfully',
|
|
17989
|
+
loading: false
|
|
17990
|
+
});
|
|
17991
|
+
};
|
|
17992
|
+
const setSelectionAction = useCallback((actionId)=>{
|
|
17993
|
+
const actionConfig = getActionById(actions, actionId);
|
|
17994
|
+
if (actionConfig) {
|
|
17995
|
+
setActionConfig(actionConfig);
|
|
17996
|
+
const action = bindAction(actionConfig);
|
|
17997
|
+
if (action) setActionFunction({
|
|
17998
|
+
action: action,
|
|
17999
|
+
parameters: actionConfig.parameters
|
|
18000
|
+
});
|
|
18001
|
+
return;
|
|
18002
|
+
}
|
|
18003
|
+
setActionFunction({
|
|
18004
|
+
action: NullAction
|
|
18005
|
+
});
|
|
18006
|
+
}, [
|
|
18007
|
+
actions
|
|
18008
|
+
]);
|
|
18009
|
+
const validatedLibrarySelections = useDeepCompareMemo(()=>{
|
|
18010
|
+
// get the action
|
|
18011
|
+
const action = getActionById(actions, value?.value);
|
|
18012
|
+
// if there are no actions then everything is valid
|
|
18013
|
+
if (!action) return gatheredItems.map((item)=>{
|
|
18014
|
+
return {
|
|
18015
|
+
...item,
|
|
18016
|
+
valid: undefined
|
|
18017
|
+
};
|
|
18018
|
+
});
|
|
18019
|
+
// get all selected items
|
|
18020
|
+
const selectedActionItems = gatheredItems.filter((_, index)=>Object.hasOwn(rowSelection, index));
|
|
18021
|
+
// apply group rules of action if any fail then add error message and set flag
|
|
18022
|
+
const groupFailsRule = doesGroupFailRule(selectedActionItems, action);
|
|
18023
|
+
const validItems = gatheredItems.map((item, index)=>{
|
|
18024
|
+
if (rowSelection[index]) {
|
|
18025
|
+
// if selected then validate item rules
|
|
18026
|
+
const itemFailsRule = doesItemFailRule(item, action);
|
|
18027
|
+
const itemAndGroupTestMessages = [
|
|
18028
|
+
...itemFailsRule,
|
|
18029
|
+
...groupFailsRule
|
|
18030
|
+
];
|
|
18031
|
+
if (itemAndGroupTestMessages.length > 0) return {
|
|
18032
|
+
...item,
|
|
18033
|
+
valid: false,
|
|
18034
|
+
errorMessages: itemAndGroupTestMessages
|
|
18035
|
+
};
|
|
18036
|
+
// defaults return true
|
|
18037
|
+
return {
|
|
18038
|
+
...item,
|
|
18039
|
+
valid: true
|
|
18040
|
+
};
|
|
18041
|
+
} else return {
|
|
18042
|
+
...item,
|
|
18043
|
+
valid: undefined
|
|
18044
|
+
};
|
|
18045
|
+
});
|
|
18046
|
+
return validItems;
|
|
18047
|
+
}, [
|
|
18048
|
+
gatheredItems,
|
|
18049
|
+
rowSelection,
|
|
18050
|
+
actions,
|
|
18051
|
+
value
|
|
18052
|
+
]);
|
|
18053
|
+
const actionButtonDisabled = actionFunction.action === NullAction || validatedLibrarySelections.length === 0 || validatedLibrarySelections.some((x)=>x.valid === false);
|
|
18054
|
+
return /*#__PURE__*/ jsx(Modal, {
|
|
18055
|
+
...props,
|
|
18056
|
+
closeOnEscape: true,
|
|
18057
|
+
centered: true,
|
|
18058
|
+
withinPortal: false,
|
|
18059
|
+
title: /*#__PURE__*/ jsx(ModalHeader, {}),
|
|
18060
|
+
classNames: {
|
|
18061
|
+
header: 'm-0 p-2 min-h-10 bg-primary-lightest',
|
|
18062
|
+
content: 'scroll-smooth'
|
|
18063
|
+
},
|
|
18064
|
+
overlayProps: {
|
|
18065
|
+
opacity: 0.5
|
|
18066
|
+
},
|
|
18067
|
+
children: /*#__PURE__*/ jsxs(Stack, {
|
|
18068
|
+
children: [
|
|
18069
|
+
/*#__PURE__*/ jsx(SelectedItemsTable, {
|
|
18070
|
+
validatedItems: validatedLibrarySelections,
|
|
18071
|
+
rowSelection: rowSelection,
|
|
18072
|
+
setRowSelection: setRowSelection
|
|
18073
|
+
}),
|
|
18074
|
+
/*#__PURE__*/ jsxs(Group, {
|
|
18075
|
+
justify: "space-between",
|
|
18076
|
+
children: [
|
|
18077
|
+
/*#__PURE__*/ jsxs(Group, {
|
|
18078
|
+
children: [
|
|
18079
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18080
|
+
fw: 600,
|
|
18081
|
+
children: "Destination:"
|
|
18082
|
+
}),
|
|
18083
|
+
/*#__PURE__*/ jsx(Select, {
|
|
18084
|
+
data: destinations,
|
|
18085
|
+
value: value ? value.value : null,
|
|
18086
|
+
onChange: (value, option)=>{
|
|
18087
|
+
setValue(option);
|
|
18088
|
+
if (value) setSelectionAction(value);
|
|
18089
|
+
else setActionFunction({
|
|
18090
|
+
action: NullAction
|
|
18091
|
+
});
|
|
18092
|
+
}
|
|
18093
|
+
})
|
|
18094
|
+
]
|
|
18095
|
+
}),
|
|
18096
|
+
/*#__PURE__*/ jsx(Button, {
|
|
18097
|
+
loading: isRunning,
|
|
18098
|
+
rightSection: actionConfig?.rightIcon ? /*#__PURE__*/ jsx(Icon, {
|
|
18099
|
+
icon: actionConfig?.rightIcon
|
|
18100
|
+
}) : undefined,
|
|
18101
|
+
disabled: actionButtonDisabled,
|
|
18102
|
+
onClick: async ()=>{
|
|
18103
|
+
setIsRunning(true);
|
|
18104
|
+
await actionFunction.action(validatedLibrarySelections, actionFunction.parameters, onDone, onError);
|
|
18105
|
+
},
|
|
18106
|
+
children: actionConfig ? actionConfig.buttonLabel : 'Submit'
|
|
18107
|
+
})
|
|
18108
|
+
]
|
|
18109
|
+
})
|
|
18110
|
+
]
|
|
18111
|
+
})
|
|
18112
|
+
});
|
|
18113
|
+
};
|
|
18114
|
+
|
|
18115
|
+
/**
|
|
18116
|
+
* Extracts and consolidates GUIDs and IDs from dataset contents into a single object.
|
|
18117
|
+
*
|
|
18118
|
+
* @param {DatasetContents} dataset - The dataset containing files and queries to extract IDs from.
|
|
18119
|
+
* @returns {SelectedMembers} An object where each key is a unique identifier from the dataset,
|
|
18120
|
+
* with a boolean value set to true.
|
|
18121
|
+
*/ const getObjectIds = (dataset)=>{
|
|
18122
|
+
return [
|
|
18123
|
+
...dataset.files.map((file)=>file.id),
|
|
18124
|
+
...dataset.queries.map((query)=>query.id)
|
|
18125
|
+
].reduce((acc, key)=>{
|
|
18126
|
+
acc[key] = true;
|
|
18127
|
+
return acc;
|
|
18128
|
+
}, {});
|
|
18129
|
+
};
|
|
18130
|
+
/**
|
|
18131
|
+
* Function that generates a mapping of dataset IDs to their respective member objects.
|
|
18132
|
+
*
|
|
18133
|
+
* @param {Array<string>} datasetIds - Array of dataset IDs to be processed.
|
|
18134
|
+
* @param {DatalistMembers} datasetContents - Object containing details about dataset members.
|
|
18135
|
+
* @returns {ListMembers} - An object mapping each dataset ID to its respective member objects.
|
|
18136
|
+
*/ const selectAllDatasetMembers = (datasetIds, datasetContents)=>{
|
|
18137
|
+
return datasetIds.reduce((acc, datasetId)=>{
|
|
18138
|
+
acc[datasetId] = {
|
|
18139
|
+
id: datasetId,
|
|
18140
|
+
objectIds: getObjectIds(datasetContents[datasetId])
|
|
18141
|
+
};
|
|
18142
|
+
return acc;
|
|
18143
|
+
}, {});
|
|
18144
|
+
};
|
|
18145
|
+
/**
|
|
18146
|
+
* Retrieves the members of a given dataset or cohort.
|
|
18147
|
+
*
|
|
18148
|
+
* This function takes either a dataset or a cohort item and returns an
|
|
18149
|
+
* object representing the selected members. In the case of a cohort item,
|
|
18150
|
+
* it returns an object with the cohort's ID set to true. For a dataset,
|
|
18151
|
+
* it iterates through the dataset items and sets the keys of file items
|
|
18152
|
+
* to true in the returned object.
|
|
18153
|
+
*
|
|
18154
|
+
* @param {RegisteredDataListEntry | CohortItem} dataSetOrCohort - The dataset or cohort item to process.
|
|
18155
|
+
* @returns {SelectedMembers} An object representing the selected members.
|
|
18156
|
+
*/ const getDatasetMembers = (dataSetOrCohort)=>{
|
|
18157
|
+
if (isCohortItem(dataSetOrCohort)) {
|
|
18158
|
+
return {
|
|
18159
|
+
[dataSetOrCohort.id]: true
|
|
18160
|
+
};
|
|
18161
|
+
}
|
|
18162
|
+
return Object.entries(dataSetOrCohort.items).reduce((acc, [key, item])=>{
|
|
18163
|
+
if (isFileItem(item)) acc[key] = true;
|
|
18164
|
+
return acc;
|
|
18165
|
+
}, {});
|
|
18166
|
+
};
|
|
18167
|
+
/**
|
|
18168
|
+
* Selects all list items from the provided data list and transforms them into a ListMembers structure.
|
|
18169
|
+
*
|
|
18170
|
+
* @param {Datalist} members - The data list containing items to be transformed.
|
|
18171
|
+
* @return {ListMembers} - Transformed structure containing the selected list items with dataset IDs and their corresponding object IDs.
|
|
18172
|
+
*/ const selectAllListItems = (members)=>{
|
|
18173
|
+
return Object.entries(members.items).reduce((acc, [datasetId, datasetContents])=>{
|
|
18174
|
+
if (isCohortItem(datasetContents)) {
|
|
18175
|
+
acc[datasetId] = {
|
|
18176
|
+
id: datasetId,
|
|
18177
|
+
objectIds: {
|
|
18178
|
+
[datasetId]: true
|
|
18179
|
+
}
|
|
18180
|
+
};
|
|
18181
|
+
} else acc[datasetId] = {
|
|
18182
|
+
id: datasetId,
|
|
18183
|
+
objectIds: getDatasetMembers(datasetContents)
|
|
18184
|
+
};
|
|
18185
|
+
return acc;
|
|
18186
|
+
}, {});
|
|
18187
|
+
};
|
|
18188
|
+
|
|
18189
|
+
const EmptyList = ()=>{
|
|
18190
|
+
return /*#__PURE__*/ jsxs(Group, {
|
|
18191
|
+
gap: "xs",
|
|
18192
|
+
classNames: {
|
|
18193
|
+
root: 'w-100'
|
|
18194
|
+
},
|
|
18195
|
+
children: [
|
|
18196
|
+
/*#__PURE__*/ jsx("span", {
|
|
18197
|
+
className: "text-utility-warning",
|
|
18198
|
+
children: /*#__PURE__*/ jsx(IoMdInformationCircleOutline, {
|
|
18199
|
+
size: "1.5rem"
|
|
18200
|
+
})
|
|
18201
|
+
}),
|
|
18202
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18203
|
+
fw: 600,
|
|
18204
|
+
children: "list is empty"
|
|
18205
|
+
})
|
|
18206
|
+
]
|
|
18207
|
+
});
|
|
18208
|
+
};
|
|
18209
|
+
|
|
18210
|
+
/**
|
|
18211
|
+
* Formats a given date string into a specific format.
|
|
18212
|
+
*
|
|
18213
|
+
* @param {string} datestr - The date string to be formatted.
|
|
18214
|
+
* @returns {string} The formatted date string.
|
|
18215
|
+
* @throws {Error} Throws an error if the provided date string is invalid or the format is incorrect.
|
|
18216
|
+
*
|
|
18217
|
+
* The function parses the provided date string into a timestamp.
|
|
18218
|
+
*/ const formatDate = (datestr)=>{
|
|
18219
|
+
const timestamp = Date.parse(datestr);
|
|
18220
|
+
if (isNaN(timestamp)) {
|
|
18221
|
+
throw new Error('Invalid date string');
|
|
18222
|
+
}
|
|
18223
|
+
const date = new Date(timestamp);
|
|
18224
|
+
const parts = new Intl.DateTimeFormat('en-US', {
|
|
18225
|
+
month: 'short',
|
|
18226
|
+
day: 'numeric',
|
|
18227
|
+
year: 'numeric',
|
|
18228
|
+
hour: '2-digit',
|
|
18229
|
+
minute: '2-digit',
|
|
18230
|
+
second: '2-digit',
|
|
18231
|
+
hour12: false,
|
|
18232
|
+
timeZone: 'UTC'
|
|
18233
|
+
}).formatToParts(date).filter((p)=>p.type !== 'literal') // Filter out literal types like spaces and commas
|
|
18234
|
+
.map((p)=>p.value);
|
|
18235
|
+
if (parts.length !== 6) throw new Error('format date wrong length');
|
|
18236
|
+
const day = parts.slice(0, 3).join('-');
|
|
18237
|
+
const time = parts.slice(3).join(':');
|
|
18238
|
+
return `${day} ${time}`;
|
|
18239
|
+
};
|
|
18240
|
+
|
|
18241
|
+
const DatasetAccordionControl = ({ listName, numberOfItems, updatedTime, createdTime, updateHandler, deleteListHandler, selectListHandler, selectedState, size = 'sm', ...props })=>{
|
|
18242
|
+
const [value, setValue] = useState(undefined);
|
|
18243
|
+
const handleUpdateName = ()=>{
|
|
18244
|
+
updateHandler({
|
|
18245
|
+
name: value
|
|
18246
|
+
});
|
|
18247
|
+
setValue(undefined);
|
|
18248
|
+
};
|
|
18249
|
+
const theme = useMantineTheme();
|
|
18250
|
+
const iconSize = IconSize[size] || IconSize['sm'];
|
|
18251
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18252
|
+
className: "flex justify-start w-full items-center px-4 group-data-[active]:bg-secondary-lightest",
|
|
18253
|
+
children: [
|
|
18254
|
+
/*#__PURE__*/ jsxs("div", {
|
|
18255
|
+
className: "flex items-center w-1/4",
|
|
18256
|
+
children: [
|
|
18257
|
+
/*#__PURE__*/ jsx(Checkbox, {
|
|
18258
|
+
size: size,
|
|
18259
|
+
onChange: (event)=>{
|
|
18260
|
+
selectListHandler(event.currentTarget.checked);
|
|
18261
|
+
event.stopPropagation();
|
|
18262
|
+
},
|
|
18263
|
+
checked: selectedState == 'checked',
|
|
18264
|
+
indeterminate: selectedState == 'indeterminate'
|
|
18265
|
+
}),
|
|
18266
|
+
/*#__PURE__*/ jsx(Accordion.Control, {
|
|
18267
|
+
...props,
|
|
18268
|
+
className: "w-4 mr-3"
|
|
18269
|
+
}),
|
|
18270
|
+
value ? /*#__PURE__*/ jsx(TextInput, {
|
|
18271
|
+
size: size,
|
|
18272
|
+
classNames: {
|
|
18273
|
+
root: 'ml-2',
|
|
18274
|
+
input: 'font-bold'
|
|
18275
|
+
},
|
|
18276
|
+
value: value,
|
|
18277
|
+
onChange: (e)=>setValue(e.target.value),
|
|
18278
|
+
onKeyDown: getHotkeyHandler([
|
|
18279
|
+
[
|
|
18280
|
+
'Enter',
|
|
18281
|
+
handleUpdateName
|
|
18282
|
+
]
|
|
18283
|
+
]),
|
|
18284
|
+
rightSection: /*#__PURE__*/ jsx(CloseButton, {
|
|
18285
|
+
"aria-label": "Clear input",
|
|
18286
|
+
onClick: ()=>setValue(undefined),
|
|
18287
|
+
style: {
|
|
18288
|
+
display: value ? undefined : 'none'
|
|
18289
|
+
}
|
|
18290
|
+
})
|
|
18291
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
18292
|
+
className: "flex items-center justify-end",
|
|
18293
|
+
children: [
|
|
18294
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18295
|
+
fw: 600,
|
|
18296
|
+
className: "ml-2 w-100 py-2 mr-2",
|
|
18297
|
+
"aria-label": listName,
|
|
18298
|
+
size: size,
|
|
18299
|
+
children: listName
|
|
18300
|
+
}),
|
|
18301
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
18302
|
+
label: "Change name of list",
|
|
18303
|
+
children: /*#__PURE__*/ jsx(ActionIcon, {
|
|
18304
|
+
color: "accent.4",
|
|
18305
|
+
variant: "transparent",
|
|
18306
|
+
"aria-label": "Change datalist name",
|
|
18307
|
+
onClick: ()=>setValue(listName),
|
|
18308
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
18309
|
+
icon: "gen3:edit",
|
|
18310
|
+
height: iconSize,
|
|
18311
|
+
width: iconSize,
|
|
18312
|
+
color: theme.colors.accent[4]
|
|
18313
|
+
})
|
|
18314
|
+
})
|
|
18315
|
+
})
|
|
18316
|
+
]
|
|
18317
|
+
})
|
|
18318
|
+
]
|
|
18319
|
+
}),
|
|
18320
|
+
/*#__PURE__*/ jsxs("div", {
|
|
18321
|
+
className: "flex items-center ml-auto space-x-2",
|
|
18322
|
+
children: [
|
|
18323
|
+
numberOfItems === 0 && /*#__PURE__*/ jsx(EmptyList, {}),
|
|
18324
|
+
/*#__PURE__*/ jsxs("div", {
|
|
18325
|
+
className: "flex items-center space-x-2",
|
|
18326
|
+
children: [
|
|
18327
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18328
|
+
fw: 600,
|
|
18329
|
+
c: "base-contrast.2",
|
|
18330
|
+
tt: "uppercase",
|
|
18331
|
+
size: size,
|
|
18332
|
+
children: "Created:"
|
|
18333
|
+
}),
|
|
18334
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18335
|
+
fw: 500,
|
|
18336
|
+
c: "base-contrast.2",
|
|
18337
|
+
size: size,
|
|
18338
|
+
children: formatDate(createdTime)
|
|
18339
|
+
}),
|
|
18340
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
18341
|
+
icon: "gen3:dot",
|
|
18342
|
+
height: iconSize,
|
|
18343
|
+
width: iconSize,
|
|
18344
|
+
color: theme.colors.accent[4]
|
|
18345
|
+
}),
|
|
18346
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18347
|
+
fw: 600,
|
|
18348
|
+
c: "base-contrast.2",
|
|
18349
|
+
tt: "uppercase",
|
|
18350
|
+
size: size,
|
|
18351
|
+
children: "Updated:"
|
|
18352
|
+
}),
|
|
18353
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18354
|
+
fw: 500,
|
|
18355
|
+
c: "base-contrast.2",
|
|
18356
|
+
size: size,
|
|
18357
|
+
children: formatDate(updatedTime)
|
|
18358
|
+
})
|
|
18359
|
+
]
|
|
18360
|
+
}),
|
|
18361
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
18362
|
+
label: `Delete ${listName}. Will not delete dataset`,
|
|
18363
|
+
children: /*#__PURE__*/ jsx(ActionIcon, {
|
|
18364
|
+
color: "accent.4",
|
|
18365
|
+
variant: "transparent",
|
|
18366
|
+
"aria-label": "delete list",
|
|
18367
|
+
onClick: ()=>deleteListHandler(),
|
|
18368
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
18369
|
+
icon: "gen3:delete",
|
|
18370
|
+
height: iconSize,
|
|
18371
|
+
width: iconSize,
|
|
18372
|
+
color: theme.colors.primary[5]
|
|
18373
|
+
})
|
|
18374
|
+
})
|
|
18375
|
+
})
|
|
18376
|
+
]
|
|
18377
|
+
})
|
|
18378
|
+
]
|
|
18379
|
+
});
|
|
18380
|
+
};
|
|
18381
|
+
|
|
18382
|
+
const commonTableSettings = (size = 'sm')=>{
|
|
18383
|
+
return {
|
|
18384
|
+
enableColumnResizing: false,
|
|
18385
|
+
icons: TableIcons,
|
|
18386
|
+
enableTopToolbar: false,
|
|
18387
|
+
enableColumnFilters: false,
|
|
18388
|
+
enableColumnActions: false,
|
|
18389
|
+
enableRowActions: true,
|
|
18390
|
+
enableColumnOrdering: false,
|
|
18391
|
+
enableFacetedValues: true,
|
|
18392
|
+
enableGrouping: false,
|
|
18393
|
+
enableColumnPinning: false,
|
|
18394
|
+
enableRowSelection: true,
|
|
18395
|
+
enablePagination: false,
|
|
18396
|
+
enableSelectAll: false,
|
|
18397
|
+
enableExpandAll: false,
|
|
18398
|
+
displayColumnDefOptions: {
|
|
18399
|
+
'mrt-row-select': {
|
|
18400
|
+
size: 5,
|
|
18401
|
+
header: ''
|
|
18402
|
+
},
|
|
18403
|
+
'mrt-row-expand': {
|
|
18404
|
+
size: 5,
|
|
18405
|
+
header: ''
|
|
18406
|
+
},
|
|
18407
|
+
'mrt-row-actions': {
|
|
18408
|
+
header: ''
|
|
18409
|
+
}
|
|
18410
|
+
},
|
|
18411
|
+
initialState: {
|
|
18412
|
+
density: 'xs',
|
|
18413
|
+
columnPinning: {
|
|
18414
|
+
left: [
|
|
18415
|
+
'mrt-row-select',
|
|
18416
|
+
'mrt-row-expand'
|
|
18417
|
+
],
|
|
18418
|
+
right: [
|
|
18419
|
+
'mrt-row-actions'
|
|
18420
|
+
]
|
|
18421
|
+
}
|
|
18422
|
+
},
|
|
18423
|
+
layoutMode: 'semantic',
|
|
18424
|
+
mantineDetailPanelProps: {
|
|
18425
|
+
style: {
|
|
18426
|
+
boxShadow: '0 -2px 0px 0px var(--table-border-color) inset'
|
|
18427
|
+
}
|
|
18428
|
+
},
|
|
18429
|
+
mantineTableProps: {
|
|
18430
|
+
style: {
|
|
18431
|
+
backgroundColor: 'var(--mantine-color-base-1)',
|
|
18432
|
+
'--mrt-striped-row-background-color': 'var(--mantine-color-base-3)',
|
|
18433
|
+
fontSize: `var(--mantine-font-size-${size})`
|
|
18434
|
+
}
|
|
18435
|
+
},
|
|
18436
|
+
mantineTableHeadCellProps: {
|
|
18437
|
+
style: {
|
|
18438
|
+
backgroundColor: 'var(--mantine-color-table-1)',
|
|
18439
|
+
color: 'var(--mantine-color-table-contrast-1)',
|
|
18440
|
+
textAlign: 'center',
|
|
18441
|
+
fontWeight: 600,
|
|
18442
|
+
fontSize: `var(--mantine-font-size-${size})`,
|
|
18443
|
+
textTransform: 'uppercase'
|
|
18444
|
+
}
|
|
18445
|
+
}
|
|
18446
|
+
};
|
|
18447
|
+
};
|
|
18448
|
+
|
|
18449
|
+
const columns$2 = [
|
|
18450
|
+
{
|
|
18451
|
+
accessorKey: 'name',
|
|
18452
|
+
header: 'Name'
|
|
18453
|
+
},
|
|
18454
|
+
{
|
|
18455
|
+
accessorKey: 'description',
|
|
18456
|
+
header: 'Description'
|
|
18457
|
+
},
|
|
18458
|
+
{
|
|
18459
|
+
accessorKey: 'documentation',
|
|
18460
|
+
header: 'Documentation'
|
|
18461
|
+
}
|
|
18462
|
+
];
|
|
18463
|
+
const AdditionalDataTableTable = ({ data, header, size = 'sm' })=>{
|
|
18464
|
+
const table = useMantineReactTable({
|
|
18465
|
+
columns: columns$2,
|
|
18466
|
+
data: data,
|
|
18467
|
+
...commonTableSettings(size),
|
|
18468
|
+
enableRowActions: false,
|
|
18469
|
+
enableRowSelection: false,
|
|
18470
|
+
enableBottomToolbar: data.length > 10,
|
|
18471
|
+
enablePagination: data.length > 10
|
|
18472
|
+
});
|
|
18473
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18474
|
+
className: "flex flex-col w-inherit gap-y-1",
|
|
18475
|
+
children: [
|
|
18476
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18477
|
+
fw: 600,
|
|
18478
|
+
fs: "md",
|
|
18479
|
+
c: "secondary.5",
|
|
18480
|
+
tt: "uppercase",
|
|
18481
|
+
children: header
|
|
18482
|
+
}),
|
|
18483
|
+
/*#__PURE__*/ jsx(MantineReactTable, {
|
|
18484
|
+
table: table
|
|
18485
|
+
})
|
|
18486
|
+
]
|
|
18487
|
+
});
|
|
18488
|
+
};
|
|
18489
|
+
|
|
18490
|
+
const columns$1 = [
|
|
18491
|
+
{
|
|
18492
|
+
accessorKey: 'name',
|
|
18493
|
+
header: 'Name'
|
|
18494
|
+
},
|
|
18495
|
+
{
|
|
18496
|
+
accessorKey: 'description',
|
|
18497
|
+
header: 'Description'
|
|
18498
|
+
},
|
|
18499
|
+
{
|
|
18500
|
+
accessorKey: 'type',
|
|
18501
|
+
header: 'Type'
|
|
18502
|
+
},
|
|
18503
|
+
{
|
|
18504
|
+
accessorKey: 'size',
|
|
18505
|
+
header: 'Size'
|
|
18506
|
+
}
|
|
18507
|
+
];
|
|
18508
|
+
const FilesTable = ({ listId, datasetId, data, header, size = 'sm' })=>{
|
|
18509
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
18510
|
+
const { selections, updateListMemberSelections } = useDataLibrarySelection();
|
|
18511
|
+
useEffect(()=>{
|
|
18512
|
+
const sel = selections?.[listId]?.[datasetId]?.objectIds ?? {};
|
|
18513
|
+
setRowSelection(sel);
|
|
18514
|
+
}, [
|
|
18515
|
+
listId,
|
|
18516
|
+
datasetId,
|
|
18517
|
+
selections
|
|
18518
|
+
]);
|
|
18519
|
+
const handleRowSelectionChange = (updater)=>{
|
|
18520
|
+
let value = {};
|
|
18521
|
+
setRowSelection((prevSelection)=>{
|
|
18522
|
+
value = updater instanceof Function ? updater(prevSelection) : updater;
|
|
18523
|
+
return value;
|
|
18524
|
+
});
|
|
18525
|
+
updateListMemberSelections(listId, datasetId, value);
|
|
18526
|
+
};
|
|
18527
|
+
const table = useMantineReactTable({
|
|
18528
|
+
columns: columns$1,
|
|
18529
|
+
data: data,
|
|
18530
|
+
...commonTableSettings(size),
|
|
18531
|
+
enableBottomToolbar: data.length > 10,
|
|
18532
|
+
enablePagination: data.length > 10,
|
|
18533
|
+
enableRowActions: true,
|
|
18534
|
+
enableHiding: true,
|
|
18535
|
+
getRowId: (originalRow)=>originalRow.id,
|
|
18536
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
18537
|
+
state: {
|
|
18538
|
+
rowSelection
|
|
18539
|
+
}
|
|
18540
|
+
});
|
|
18541
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18542
|
+
className: "flex flex-col gap-y-1",
|
|
18543
|
+
children: [
|
|
18544
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18545
|
+
fw: 600,
|
|
18546
|
+
fs: size,
|
|
18547
|
+
c: "secondary.5",
|
|
18548
|
+
tt: "uppercase",
|
|
18549
|
+
children: header
|
|
18550
|
+
}),
|
|
18551
|
+
/*#__PURE__*/ jsx(MantineReactTable, {
|
|
18552
|
+
table: table
|
|
18553
|
+
})
|
|
18554
|
+
]
|
|
18555
|
+
});
|
|
18556
|
+
};
|
|
18557
|
+
|
|
18558
|
+
const LabeledText = ({ label, text })=>{
|
|
18559
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18560
|
+
className: "flex p-1 space-x-2",
|
|
18561
|
+
children: [
|
|
18562
|
+
/*#__PURE__*/ jsxs(Text, {
|
|
18563
|
+
fw: 600,
|
|
18564
|
+
children: [
|
|
18565
|
+
label,
|
|
18566
|
+
":"
|
|
18567
|
+
]
|
|
18568
|
+
}),
|
|
18569
|
+
/*#__PURE__*/ jsxs(Text, {
|
|
18570
|
+
fw: 400,
|
|
18571
|
+
children: [
|
|
18572
|
+
" ",
|
|
18573
|
+
text
|
|
18574
|
+
]
|
|
18575
|
+
})
|
|
18576
|
+
]
|
|
18577
|
+
});
|
|
18578
|
+
};
|
|
18579
|
+
const QueryDetails = ({ name, schemaVersion, index, data, id })=>{
|
|
18580
|
+
if (!data) {
|
|
18581
|
+
return /*#__PURE__*/ jsx(ErrorCard, {
|
|
18582
|
+
message: "No cohort query"
|
|
18583
|
+
});
|
|
18584
|
+
}
|
|
18585
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18586
|
+
className: "flex flex-col",
|
|
18587
|
+
children: [
|
|
18588
|
+
/*#__PURE__*/ jsxs(Group, {
|
|
18589
|
+
classNames: {
|
|
18590
|
+
root: 'p-2 bg-base-lighter rounded-t-lg border-2 border-b-0 border-base-light'
|
|
18591
|
+
},
|
|
18592
|
+
children: [
|
|
18593
|
+
/*#__PURE__*/ jsx(Text, {
|
|
18594
|
+
fw: 700,
|
|
18595
|
+
children: name
|
|
18596
|
+
}),
|
|
18597
|
+
/*#__PURE__*/ jsx(LabeledText, {
|
|
18598
|
+
label: "Index:",
|
|
18599
|
+
text: index
|
|
18600
|
+
}),
|
|
18601
|
+
/*#__PURE__*/ jsx(LabeledText, {
|
|
18602
|
+
label: "Schema Version:",
|
|
18603
|
+
text: schemaVersion
|
|
18604
|
+
}),
|
|
18605
|
+
/*#__PURE__*/ jsx(LabeledText, {
|
|
18606
|
+
label: "ID:",
|
|
18607
|
+
text: id
|
|
18608
|
+
})
|
|
18609
|
+
]
|
|
18610
|
+
}),
|
|
18611
|
+
/*#__PURE__*/ jsx("div", {
|
|
18612
|
+
className: "p-2 overflow-scroll w-full bg-base-lighter rounded-b-lg border-2 border-t-0 border-base-light",
|
|
18613
|
+
children: isFilterSet(data) ? /*#__PURE__*/ jsx(QueryExpressionSection, {
|
|
18614
|
+
currentCohortId: id,
|
|
18615
|
+
index: index,
|
|
18616
|
+
currentCohortName: name,
|
|
18617
|
+
filters: data,
|
|
18618
|
+
displayOnly: true,
|
|
18619
|
+
showTitle: false
|
|
18620
|
+
}) : /*#__PURE__*/ jsx(Text, {
|
|
18621
|
+
fw: 400,
|
|
18622
|
+
children: JSON.stringify(data, null, 2)
|
|
18623
|
+
})
|
|
18624
|
+
})
|
|
18625
|
+
]
|
|
18626
|
+
});
|
|
18627
|
+
};
|
|
18628
|
+
|
|
18629
|
+
/**
|
|
18630
|
+
* Component that manages a List items, which are composed of Dataset and/or Cohorts
|
|
18631
|
+
*/ const columns = [
|
|
18632
|
+
{
|
|
18633
|
+
accessorKey: 'name',
|
|
18634
|
+
header: 'Name'
|
|
18635
|
+
},
|
|
18636
|
+
{
|
|
18637
|
+
accessorKey: 'id',
|
|
18638
|
+
header: 'Id'
|
|
18639
|
+
},
|
|
18640
|
+
{
|
|
18641
|
+
accessorKey: 'numFiles',
|
|
18642
|
+
header: '# Files'
|
|
18643
|
+
},
|
|
18644
|
+
{
|
|
18645
|
+
accessorKey: 'isAddDataSource',
|
|
18646
|
+
header: 'Additional Data Sources'
|
|
18647
|
+
}
|
|
18648
|
+
];
|
|
18649
|
+
const DataSetContentsTable = ({ listId, data, removeList, size = 'sm' })=>{
|
|
18650
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
18651
|
+
const { selections, updateSelections } = useDataLibrarySelection();
|
|
18652
|
+
// build the rows
|
|
18653
|
+
const rows = useDeepCompareMemo(()=>Object.keys(data).map((key)=>{
|
|
18654
|
+
return {
|
|
18655
|
+
name: data[key].name,
|
|
18656
|
+
id: data[key].id,
|
|
18657
|
+
numFiles: data[key]?.files.length || 0,
|
|
18658
|
+
numItems: (data[key]?.files.length || 0) + (data[key]?.queries.length || 0),
|
|
18659
|
+
isAddDataSource: data[key]?.additionalData.length !== 0 ? 'True' : 'False',
|
|
18660
|
+
isCohort: data[key]?.queries.length !== 0 ? 'True' : 'False'
|
|
18661
|
+
};
|
|
18662
|
+
}), [
|
|
18663
|
+
data
|
|
18664
|
+
]);
|
|
18665
|
+
/**
|
|
18666
|
+
* Handles the change in row selection.
|
|
18667
|
+
*
|
|
18668
|
+
* @param {MRT_Updater<MRT_RowSelectionState>} updater - A function or value
|
|
18669
|
+
* that provides the new state of row selection. If a function is provided,
|
|
18670
|
+
* it will be called with the previous selection state.
|
|
18671
|
+
*
|
|
18672
|
+
* This function updates the state of selected rows by transforming the
|
|
18673
|
+
* updater's value. It generates a mapping of selected members for each
|
|
18674
|
+
* dataset, containing the dataset ID and an object representing the selected
|
|
18675
|
+
* object IDs. It then updates the selections for a given list and filters
|
|
18676
|
+
* the values to indicate whether each dataset has any selected objects.
|
|
18677
|
+
*/ const handleRowSelectionChange = (updater)=>{
|
|
18678
|
+
setRowSelection((prevSelection)=>{
|
|
18679
|
+
const value = updater instanceof Function ? updater(prevSelection) : updater;
|
|
18680
|
+
const members = selectAllDatasetMembers(Object.keys(value), data);
|
|
18681
|
+
updateSelections(listId, members);
|
|
18682
|
+
return Object.keys(members).reduce((acc, key)=>{
|
|
18683
|
+
acc[key] = Object.keys(members[key].objectIds).length > 0;
|
|
18684
|
+
return acc;
|
|
18685
|
+
}, {});
|
|
18686
|
+
});
|
|
18687
|
+
};
|
|
18688
|
+
useDeepCompareEffect(()=>{
|
|
18689
|
+
if (!selections[listId]) {
|
|
18690
|
+
// not found in selections, unselect all
|
|
18691
|
+
setRowSelection({});
|
|
18692
|
+
return;
|
|
18693
|
+
}
|
|
18694
|
+
const filteredValues = Object.keys(selections[listId]).reduce((acc, key)=>{
|
|
18695
|
+
const objectIds = selections[listId][key]?.objectIds;
|
|
18696
|
+
if (!objectIds) {
|
|
18697
|
+
console.warn(`Object IDs for key ${key} in list ${listId} are not available`);
|
|
18698
|
+
return acc;
|
|
18699
|
+
}
|
|
18700
|
+
acc[key] = Object.keys(objectIds).length > 0;
|
|
18701
|
+
return acc;
|
|
18702
|
+
}, {});
|
|
18703
|
+
setRowSelection(filteredValues);
|
|
18704
|
+
}, [
|
|
18705
|
+
setRowSelection,
|
|
18706
|
+
selections,
|
|
18707
|
+
listId
|
|
18708
|
+
]);
|
|
18709
|
+
const table = useMantineReactTable({
|
|
18710
|
+
columns: columns,
|
|
18711
|
+
data: rows,
|
|
18712
|
+
...commonTableSettings(size),
|
|
18713
|
+
getRowId: (originalRow)=>originalRow.id,
|
|
18714
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
18715
|
+
enableSelectAll: false,
|
|
18716
|
+
enableBottomToolbar: rows.length > 10,
|
|
18717
|
+
enablePagination: rows.length > 10,
|
|
18718
|
+
enableRowSelection: true,
|
|
18719
|
+
state: {
|
|
18720
|
+
rowSelection
|
|
18721
|
+
},
|
|
18722
|
+
renderEmptyRowsFallback: ()=>/*#__PURE__*/ jsx(EmptyList, {}),
|
|
18723
|
+
defaultColumn: {
|
|
18724
|
+
minSize: 2
|
|
18725
|
+
},
|
|
18726
|
+
displayColumnDefOptions: {
|
|
18727
|
+
'mrt-row-select': {
|
|
18728
|
+
size: 5,
|
|
18729
|
+
maxSize: 5,
|
|
18730
|
+
header: ''
|
|
18731
|
+
},
|
|
18732
|
+
'mrt-row-expand': {
|
|
18733
|
+
size: 5,
|
|
18734
|
+
maxSize: 5,
|
|
18735
|
+
header: ''
|
|
18736
|
+
},
|
|
18737
|
+
'mrt-row-actions': {
|
|
18738
|
+
size: 10,
|
|
18739
|
+
header: ''
|
|
18740
|
+
}
|
|
18741
|
+
},
|
|
18742
|
+
mantineSelectCheckboxProps: ({ row })=>{
|
|
18743
|
+
const selectedCount = getNumberOfDataSetItemsSelected(selections, listId, row.id);
|
|
18744
|
+
const isIndeterminate = selectedCount > 0 && selectedCount != row.original.numItems;
|
|
18745
|
+
return {
|
|
18746
|
+
indeterminate: isIndeterminate,
|
|
18747
|
+
...isIndeterminate ? {
|
|
18748
|
+
checked: false
|
|
18749
|
+
} : {}
|
|
18750
|
+
};
|
|
18751
|
+
},
|
|
18752
|
+
renderRowActions: ({ row })=>/*#__PURE__*/ jsx(Tooltip, {
|
|
18753
|
+
label: row.original.isCohort ? 'Remove cohort from list' : 'Remove dataset from list',
|
|
18754
|
+
children: /*#__PURE__*/ jsxs(Button, {
|
|
18755
|
+
variant: "transparent",
|
|
18756
|
+
"aria-label": `remove ${row.original.isCohort ? 'cohort' : 'dataset'} ${row.original.name} from list`,
|
|
18757
|
+
onClick: ()=>{
|
|
18758
|
+
removeList(row.id);
|
|
18759
|
+
},
|
|
18760
|
+
children: [
|
|
18761
|
+
/*#__PURE__*/ jsx(MdOutlineRemoveCircle, {
|
|
18762
|
+
size: "1.5rem"
|
|
18763
|
+
}),
|
|
18764
|
+
row.original.itemType
|
|
18765
|
+
]
|
|
18766
|
+
})
|
|
18767
|
+
}),
|
|
18768
|
+
mantineDetailPanelProps: {
|
|
18769
|
+
style: {
|
|
18770
|
+
padding: '0px',
|
|
18771
|
+
margin: '0px'
|
|
18772
|
+
}
|
|
18773
|
+
},
|
|
18774
|
+
renderDetailPanel: ({ row })=>{
|
|
18775
|
+
const rowData = data[row.id];
|
|
18776
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18777
|
+
className: "flex flex-col w-full gap-y-4 pr-4",
|
|
18778
|
+
children: [
|
|
18779
|
+
rowData?.files.length > 0 && /*#__PURE__*/ jsx(FilesTable, {
|
|
18780
|
+
header: 'Files',
|
|
18781
|
+
datasetId: rowData.id,
|
|
18782
|
+
listId: listId,
|
|
18783
|
+
data: rowData?.files
|
|
18784
|
+
}),
|
|
18785
|
+
rowData.additionalData.length > 0 && /*#__PURE__*/ jsx(AdditionalDataTableTable, {
|
|
18786
|
+
header: 'Additional Data',
|
|
18787
|
+
data: rowData?.additionalData
|
|
18788
|
+
}),
|
|
18789
|
+
/*#__PURE__*/ jsx(Stack, {
|
|
18790
|
+
children: rowData?.queries.map((query)=>/*#__PURE__*/ createElement(QueryDetails, {
|
|
18791
|
+
header: "Queries",
|
|
18792
|
+
...query,
|
|
18793
|
+
key: query.id
|
|
18794
|
+
}))
|
|
18795
|
+
})
|
|
18796
|
+
]
|
|
18797
|
+
});
|
|
18798
|
+
}
|
|
18799
|
+
});
|
|
18800
|
+
return /*#__PURE__*/ jsx("div", {
|
|
18801
|
+
className: "flex flex-col w-full mr-8",
|
|
18802
|
+
children: /*#__PURE__*/ jsx(MantineReactTable, {
|
|
18803
|
+
table: table
|
|
18804
|
+
})
|
|
18805
|
+
});
|
|
18806
|
+
};
|
|
18807
|
+
|
|
18808
|
+
/**
|
|
18809
|
+
* Renders an accordion item with data list details.
|
|
18810
|
+
*
|
|
18811
|
+
* @param {Object} dataListAccordionItemParams - Parameters for the DataListAccordionItem.
|
|
18812
|
+
* @param {Object} dataListAccordionItemParams.dataList - The data list to be displayed in the accordion item.
|
|
18813
|
+
* @param {Function} dataListAccordionItemParams.updateListInDataLibrary - Function to update the list in the data library.
|
|
18814
|
+
* @param {Function} dataListAccordionItemParams.deleteListFromDataLibrary - Function to delete the list from the data library.
|
|
18815
|
+
*
|
|
18816
|
+
* @return {JSX.Element} A rendered accordion item component with controls for data list updates and deletions.
|
|
18817
|
+
*/ const DatalistAccordionItem = ({ dataList, updateListInDataLibrary, deleteListFromDataLibrary, size = 'sm' })=>{
|
|
18818
|
+
const [selectedState, setSelectedState] = useState('unchecked');
|
|
18819
|
+
const { id: listId, name: listName } = dataList;
|
|
18820
|
+
const numberOfItemsInList = useMemo(()=>{
|
|
18821
|
+
return getNumberOfItemsInDatalist(dataList);
|
|
18822
|
+
}, [
|
|
18823
|
+
dataList
|
|
18824
|
+
]);
|
|
18825
|
+
const { selections, updateSelections, removeListMember, removeList } = useDataLibrarySelection();
|
|
18826
|
+
const updateList = async (update)=>{
|
|
18827
|
+
await updateListInDataLibrary(listId, {
|
|
18828
|
+
...dataList,
|
|
18829
|
+
...update,
|
|
18830
|
+
updatedTime: getTimestamp()
|
|
18831
|
+
});
|
|
18832
|
+
};
|
|
18833
|
+
const tableRowData = useMemo(()=>Object.entries(dataList.items).reduce((acc, [datasetId, dataItem])=>{
|
|
18834
|
+
const [queries, files, additionalData] = [
|
|
18835
|
+
[],
|
|
18836
|
+
[],
|
|
18837
|
+
[]
|
|
18838
|
+
];
|
|
18839
|
+
if (isCohortItem(dataItem)) {
|
|
18840
|
+
queries.push({
|
|
18841
|
+
...dataItem,
|
|
18842
|
+
description: '',
|
|
18843
|
+
index: dataItem.index,
|
|
18844
|
+
id: datasetId
|
|
18845
|
+
});
|
|
18846
|
+
} else {
|
|
18847
|
+
// handle RegisteredDataListEntry
|
|
18848
|
+
Object.entries(dataItem.items).forEach(([itemId, item])=>{
|
|
18849
|
+
if (isFileItem(item)) {
|
|
18850
|
+
files.push({
|
|
18851
|
+
...item,
|
|
18852
|
+
id: itemId
|
|
18853
|
+
});
|
|
18854
|
+
} else if (isAdditionalDataItem(item)) {
|
|
18855
|
+
additionalData.push(item);
|
|
18856
|
+
} else {
|
|
18857
|
+
console.warn('DataLibrary: unknown item', item);
|
|
18858
|
+
}
|
|
18859
|
+
});
|
|
18860
|
+
}
|
|
18861
|
+
// return the
|
|
18862
|
+
acc[datasetId] = {
|
|
18863
|
+
id: datasetId,
|
|
18864
|
+
name: dataItem.name,
|
|
18865
|
+
queries: queries,
|
|
18866
|
+
files: files,
|
|
18867
|
+
additionalData: additionalData
|
|
18868
|
+
};
|
|
18869
|
+
return acc;
|
|
18870
|
+
}, {}), [
|
|
18871
|
+
dataList
|
|
18872
|
+
]);
|
|
18873
|
+
useEffect(()=>{
|
|
18874
|
+
// list is not in selection
|
|
18875
|
+
if (!isListInSelection(listId, selections)) {
|
|
18876
|
+
setSelectedState('unchecked');
|
|
18877
|
+
return;
|
|
18878
|
+
}
|
|
18879
|
+
const numberOfSelectedItemsInList = getNumberOfSelectedItemsInList(selections, listId);
|
|
18880
|
+
// everything in the list is selected
|
|
18881
|
+
if (numberOfSelectedItemsInList == numberOfItemsInList) {
|
|
18882
|
+
setSelectedState('checked');
|
|
18883
|
+
return;
|
|
18884
|
+
}
|
|
18885
|
+
// list is not in selections
|
|
18886
|
+
if (numberOfSelectedItemsInList === 0) {
|
|
18887
|
+
setSelectedState('unchecked');
|
|
18888
|
+
return;
|
|
18889
|
+
}
|
|
18890
|
+
// some checked items
|
|
18891
|
+
if (numberOfSelectedItemsInList < numberOfItemsInList) setSelectedState('indeterminate');
|
|
18892
|
+
}, [
|
|
18893
|
+
listId,
|
|
18894
|
+
numberOfItemsInList,
|
|
18895
|
+
selections
|
|
18896
|
+
]);
|
|
18897
|
+
const removeItemFromList = async (itemId)=>{
|
|
18898
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18899
|
+
const { [itemId]: _removedKey, ...newObject } = dataList.items;
|
|
18900
|
+
await updateListInDataLibrary(listId, {
|
|
18901
|
+
...dataList,
|
|
18902
|
+
items: newObject,
|
|
18903
|
+
updatedTime: getTimestamp()
|
|
18904
|
+
});
|
|
18905
|
+
// update selections
|
|
18906
|
+
removeListMember(listId, itemId);
|
|
18907
|
+
};
|
|
18908
|
+
const handleSelectList = (checked)=>{
|
|
18909
|
+
if (!checked) {
|
|
18910
|
+
removeList(listId);
|
|
18911
|
+
return;
|
|
18912
|
+
}
|
|
18913
|
+
const selectAllDatasets = selectAllListItems(dataList);
|
|
18914
|
+
updateSelections(listId, selectAllDatasets); // select all the datasets in the list
|
|
18915
|
+
};
|
|
18916
|
+
return /*#__PURE__*/ jsxs(Accordion.Item, {
|
|
18917
|
+
value: listName,
|
|
18918
|
+
className: "group",
|
|
18919
|
+
children: [
|
|
18920
|
+
/*#__PURE__*/ jsx(DatasetAccordionControl, {
|
|
18921
|
+
listName: listName,
|
|
18922
|
+
numberOfItems: numberOfItemsInList,
|
|
18923
|
+
updatedTime: dataList.updatedTime,
|
|
18924
|
+
createdTime: dataList.createdTime,
|
|
18925
|
+
updateHandler: updateList,
|
|
18926
|
+
deleteListHandler: ()=>deleteListFromDataLibrary(listId),
|
|
18927
|
+
selectListHandler: handleSelectList,
|
|
18928
|
+
selectedState: selectedState,
|
|
18929
|
+
size: size
|
|
18930
|
+
}),
|
|
18931
|
+
/*#__PURE__*/ jsx(Accordion.Panel, {
|
|
18932
|
+
children: /*#__PURE__*/ jsx(DataSetContentsTable, {
|
|
18933
|
+
listId: listId,
|
|
18934
|
+
data: tableRowData,
|
|
18935
|
+
removeList: removeItemFromList,
|
|
18936
|
+
size: size
|
|
18937
|
+
})
|
|
18938
|
+
})
|
|
18939
|
+
]
|
|
18940
|
+
}, listName);
|
|
18941
|
+
};
|
|
18942
|
+
|
|
18943
|
+
const DataLibraryLists = ({ useAPI, actions, size })=>{
|
|
18944
|
+
const { dataLibrary, isError, isLoading, error: dataLibraryError, addListToDataLibrary, updateListInDataLibrary, deleteListFromDataLibrary } = useDataLibrary(useAPI);
|
|
18945
|
+
const [selectedItemsOpen, { open, close }] = useDisclosure(false);
|
|
18946
|
+
const { gatherSelectedItems } = useDataLibrarySelection();
|
|
18947
|
+
const gatherData = ()=>{
|
|
18948
|
+
gatherSelectedItems(dataLibrary);
|
|
18949
|
+
open();
|
|
18950
|
+
};
|
|
18951
|
+
if (isError) {
|
|
18952
|
+
let message = 'There was a error getting the library';
|
|
18953
|
+
if (dataLibraryError && 'data' in dataLibraryError && dataLibraryError?.status in HTTPUserFriendlyErrorMessages) {
|
|
18954
|
+
message = HTTPUserFriendlyErrorMessages[dataLibraryError?.status];
|
|
18955
|
+
}
|
|
18956
|
+
return /*#__PURE__*/ jsx("div", {
|
|
18957
|
+
className: "flex flex-col w-full ml-2",
|
|
18958
|
+
children: /*#__PURE__*/ jsx(Center, {
|
|
18959
|
+
children: /*#__PURE__*/ jsx(ErrorCard, {
|
|
18960
|
+
message: message
|
|
18961
|
+
})
|
|
18962
|
+
})
|
|
18963
|
+
});
|
|
18964
|
+
}
|
|
18965
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18966
|
+
className: "flex flex-col w-full ml-2",
|
|
18967
|
+
children: [
|
|
18968
|
+
/*#__PURE__*/ jsx(LoadingOverlay, {
|
|
18969
|
+
visible: isLoading
|
|
18970
|
+
}),
|
|
18971
|
+
/*#__PURE__*/ jsx(SelectedItemsModal, {
|
|
18972
|
+
opened: selectedItemsOpen,
|
|
18973
|
+
onClose: close,
|
|
18974
|
+
size: "auto",
|
|
18975
|
+
actions: actions
|
|
18976
|
+
}),
|
|
18977
|
+
/*#__PURE__*/ jsx(SearchAndActions, {
|
|
18978
|
+
createList: addListToDataLibrary,
|
|
18979
|
+
gatherData: gatherData
|
|
18980
|
+
}),
|
|
18981
|
+
/*#__PURE__*/ jsx("div", {
|
|
18982
|
+
className: "flex items-center",
|
|
18983
|
+
children: /*#__PURE__*/ jsx(Accordion, {
|
|
18984
|
+
chevronPosition: "left",
|
|
18985
|
+
classNames: {
|
|
18986
|
+
root: 'w-full',
|
|
18987
|
+
control: 'data-active:bg-secondary-lightest'
|
|
18988
|
+
},
|
|
18989
|
+
children: dataLibrary && Object.values(dataLibrary).map((datalist)=>{
|
|
18990
|
+
return /*#__PURE__*/ jsx(DatalistAccordionItem, {
|
|
18991
|
+
dataList: datalist,
|
|
18992
|
+
size: size,
|
|
18993
|
+
updateListInDataLibrary: updateListInDataLibrary,
|
|
18994
|
+
deleteListFromDataLibrary: deleteListFromDataLibrary
|
|
18995
|
+
}, datalist.id);
|
|
18996
|
+
})
|
|
18997
|
+
})
|
|
18998
|
+
})
|
|
18999
|
+
]
|
|
19000
|
+
});
|
|
19001
|
+
};
|
|
19002
|
+
|
|
19003
|
+
const DataLibrary = (config)=>{
|
|
19004
|
+
return /*#__PURE__*/ jsx(DataLibrarySelectionProvider, {
|
|
19005
|
+
children: /*#__PURE__*/ jsx(DataLibraryLists, {
|
|
19006
|
+
...config
|
|
19007
|
+
})
|
|
19008
|
+
});
|
|
19009
|
+
};
|
|
19010
|
+
|
|
19011
|
+
const DataLibraryPage = ({ headerProps, footerProps, config })=>{
|
|
19012
|
+
return /*#__PURE__*/ jsx(NavPageLayout, {
|
|
19013
|
+
headerProps,
|
|
19014
|
+
footerProps,
|
|
19015
|
+
headerData: {
|
|
19016
|
+
title: 'Gen3 DataLibrary Page',
|
|
19017
|
+
content: 'DataLibrary Data',
|
|
19018
|
+
key: 'gen3-data-library-page'
|
|
19019
|
+
},
|
|
19020
|
+
children: /*#__PURE__*/ jsx(DataLibrary, {
|
|
19021
|
+
...config
|
|
19022
|
+
})
|
|
19023
|
+
});
|
|
19024
|
+
};
|
|
19025
|
+
|
|
19026
|
+
const DataLibraryPageGetServerSideProps = async ()=>{
|
|
19027
|
+
try {
|
|
19028
|
+
const datalibraryConfig = await ContentSource.get(`config/${GEN3_COMMONS_NAME}/dataLibrary.json`);
|
|
19029
|
+
return {
|
|
19030
|
+
props: {
|
|
19031
|
+
...await getNavPageLayoutPropsFromConfig(),
|
|
19032
|
+
config: datalibraryConfig
|
|
19033
|
+
}
|
|
19034
|
+
};
|
|
19035
|
+
} catch (err) {
|
|
19036
|
+
console.error(err);
|
|
19037
|
+
return {
|
|
19038
|
+
props: {
|
|
19039
|
+
...await getNavPageLayoutPropsFromConfig(),
|
|
19040
|
+
config: {
|
|
19041
|
+
useAPI: false,
|
|
19042
|
+
actions: []
|
|
19043
|
+
}
|
|
19044
|
+
}
|
|
19045
|
+
};
|
|
19046
|
+
}
|
|
19047
|
+
};
|
|
19048
|
+
|
|
17197
19049
|
const CrosswalkTable = ({ mapping, data, isFetching, isError, tableMessage, showSubmittedIdInTable })=>{
|
|
17198
19050
|
const cols = useMemo(()=>{
|
|
17199
19051
|
return [
|
|
@@ -17766,5 +19618,5 @@ async function credentialsLogout(req, res) {
|
|
|
17766
19618
|
res.redirect(307, '/');
|
|
17767
19619
|
}
|
|
17768
19620
|
|
|
17769
|
-
export { AISearchPageGetServerSideProps, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BaseModal, Charts, CohortBuilder, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, EnumFacetChart, ErrorCard, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FirstTimeModal, Footer, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header, HoverLink, LandingPage, LandingPageGetStaticProps, LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryPage, QueryPageGetServerSideProps, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SessionExpiredModal, StudyGroup, SubmissionPage, SubmissionPageGetServerSideProps, TagCloud, TailwindConfig, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, capitalize, computeRowSpan, create10ColorAccessibleContrast, create10ColorPallet, credentialsLogin, credentialsLogout, extractObjectKey, focusStyles, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isPropertyKey, isTextTransform$1 as isTextTransform, processLabel$1 as processLabel, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortDiversityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, removeKey$1 as removeKey, resourcePathFromProjectID, sessionLogout, sessionToken, stripTrailingSlash, toDisplayName, truncateString, unixTimeToString, useDiscoveryContext, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
|
|
19621
|
+
export { AISearchPageGetServerSideProps, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BaseModal, Charts, CohortBuilder, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DataLibraryPage, DataLibraryPageGetServerSideProps, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, EnumFacetChart, ErrorCard, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FirstTimeModal, Footer, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header, HoverLink, LandingPage, LandingPageGetStaticProps, LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryPage, QueryPageGetServerSideProps, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SessionExpiredModal, StudyGroup, SubmissionPage, SubmissionPageGetServerSideProps, TagCloud, TailwindConfig, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, capitalize, computeRowSpan, create10ColorAccessibleContrast, create10ColorPallet, credentialsLogin, credentialsLogout, extractObjectKey, focusStyles, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isPropertyKey, isTextTransform$1 as isTextTransform, processLabel$1 as processLabel, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortDiversityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, removeKey$1 as removeKey, resourcePathFromProjectID, sessionLogout, sessionToken, stripTrailingSlash, toDisplayName, truncateString, unixTimeToString, useDiscoveryContext, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
|
|
17770
19622
|
//# sourceMappingURL=index.js.map
|