@databiosphere/findable-ui 35.0.3 → 35.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +19 -0
- package/lib/common/entities.d.ts +1 -0
- package/lib/components/DataDictionary/components/Table/hook.js +1 -0
- package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +15 -2
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.js +21 -29
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.js +21 -36
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.d.ts +2 -0
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.js +22 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.d.ts +3 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.js +9 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.d.ts +5 -0
- package/lib/components/Table/components/TableCell/components/CodeCell/codeCell.styles.js +15 -0
- package/lib/hooks/useFileManifest/useFileManifestDownload.d.ts +2 -2
- package/lib/hooks/useFileManifest/useFileManifestDownload.js +3 -10
- package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.d.ts +5 -4
- package/lib/hooks/useFileManifest/useFileManifestSpreadsheet.js +24 -20
- package/package.json +1 -1
- package/src/common/entities.ts +1 -0
- package/src/components/DataDictionary/components/Table/hook.ts +1 -0
- package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +17 -4
- package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestDownload/fileManifestDownload.tsx +43 -71
- package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/components/FileManifestSpreadsheet/fileManifestSpreadsheet.tsx +52 -74
- package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/constants.ts +24 -0
- package/src/components/Table/components/TableCell/components/CodeCell/codeCell.styles.ts +16 -0
- package/src/components/Table/components/TableCell/components/CodeCell/codeCell.tsx +21 -0
- package/src/hooks/useFileManifest/useFileManifestDownload.ts +9 -16
- package/src/hooks/useFileManifest/useFileManifestSpreadsheet.ts +41 -26
- package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +0 -6
- package/lib/components/DataDictionary/components/Table/columns/columnDef.js +0 -33
- package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +0 -5
- package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +0 -5
- package/lib/components/DataDictionary/components/Table/columns/types.d.ts +0 -2
- package/lib/components/DataDictionary/components/Table/columns/types.js +0 -1
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +0 -4
- package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +0 -1
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +0 -8
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +0 -36
- package/lib/components/Filter/components/Filter/filter.stories.d.ts +0 -25
- package/lib/components/Filter/components/Filter/filter.stories.js +0 -42
- package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +0 -16
- package/lib/components/Filter/components/FilterTag/filterTag.stories.js +0 -17
- package/lib/components/Filter/components/Filters/filters.stories.d.ts +0 -6
- package/lib/components/Filter/components/Filters/filters.stories.js +0 -91
- package/lib/components/Index/components/Cell/cell.d.ts +0 -7
- package/lib/components/Index/components/Cell/cell.js +0 -10
- package/lib/components/Index/components/EntitiesView/constants.d.ts +0 -1
- package/lib/components/Index/components/EntitiesView/constants.js +0 -1
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +0 -13
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +0 -18
- package/lib/components/Index/components/Hero/hero.stories.d.ts +0 -23
- package/lib/components/Index/components/Hero/hero.stories.js +0 -22
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +0 -8
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +0 -57
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +0 -4
- package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +0 -10
- package/lib/components/Index/components/NTag/nTag.d.ts +0 -10
- package/lib/components/Index/components/NTag/nTag.js +0 -8
- package/lib/components/Index/components/NTagCell/nTagCell.d.ts +0 -11
- package/lib/components/Index/components/NTagCell/nTagCell.js +0 -29
- package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +0 -5
- package/lib/components/Index/components/NTagCell/nTagCell.stories.js +0 -16
- package/lib/components/Index/components/TitleCell/titleCell.d.ts +0 -6
- package/lib/components/Index/components/TitleCell/titleCell.js +0 -10
- package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +0 -3
- package/lib/components/Index/components/TitleCell/titleCell.styles.js +0 -6
- package/lib/components/Index/index.stories.d.ts +0 -6
- package/lib/components/Index/index.stories.js +0 -26
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +0 -6
- package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +0 -10
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +0 -5
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +0 -29
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +0 -6
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +0 -13
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +0 -36
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +0 -9
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +0 -5
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +0 -10
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +0 -36
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +0 -9
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +0 -5
- package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +0 -19
- package/lib/components/Layout/components/Outline/common/constants.d.ts +0 -2
- package/lib/components/Layout/components/Outline/common/constants.js +0 -1
- package/lib/components/Login/login.stories.d.ts +0 -6
- package/lib/components/Login/login.stories.js +0 -31
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +0 -16
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +0 -28
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +0 -5
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +0 -46
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +0 -3
- package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +0 -21
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +0 -2
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +0 -37
- package/lib/components/TableCreator/common/constants.d.ts +0 -6
- package/lib/components/TableCreator/common/constants.js +0 -19
- package/lib/components/TableCreator/common/entities.d.ts +0 -5
- package/lib/components/TableCreator/common/entities.js +0 -1
- package/lib/components/TableCreator/tableCreator.styles.d.ts +0 -4
- package/lib/components/TableCreator/tableCreator.styles.js +0 -4
- package/lib/components/common/Alert/alert.stories.d.ts +0 -6
- package/lib/components/common/Alert/alert.stories.js +0 -36
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +0 -4
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +0 -19
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +0 -7
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +0 -5
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +0 -3
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +0 -19
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +0 -10
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +0 -16
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +0 -3
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +0 -21
- package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +0 -3
- package/lib/components/common/Button/components/LoginButton/loginButton.js +0 -6
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +0 -7
- package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +0 -11
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +0 -5
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +0 -10
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +0 -3
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +0 -9
- package/lib/hooks/useAuthentication/common/constants.d.ts +0 -4
- package/lib/hooks/useAuthentication/common/constants.js +0 -19
- package/lib/hooks/useAuthentication/common/entities.d.ts +0 -25
- package/lib/hooks/useAuthentication/common/entities.js +0 -11
- package/lib/hooks/useAuthentication/common/utils.d.ts +0 -15
- package/lib/hooks/useAuthentication/common/utils.js +0 -25
- package/lib/hooks/useAuthentication/useAuthentication.d.ts +0 -6
- package/lib/hooks/useAuthentication/useAuthentication.js +0 -9
- package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +0 -6
- package/lib/hooks/useAuthentication/useAuthenticationComplete.js +0 -55
- package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +0 -20
- package/lib/hooks/useAuthentication/useAuthenticationForm.js +0 -88
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +0 -18
- package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +0 -50
- package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +0 -20
- package/lib/hooks/useAuthentication/useAuthenticationStatus.js +0 -32
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +0 -21
- package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +0 -41
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +0 -18
- package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +0 -62
- package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +0 -24
- package/lib/hooks/useAuthentication/useFetchTerraProfile.js +0 -62
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +0 -15
- package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +0 -62
- package/lib/hooks/useAuthentication/useTokenClient.d.ts +0 -11
- package/lib/hooks/useAuthentication/useTokenClient.js +0 -29
- package/lib/hooks/useAuthenticationConfig.d.ts +0 -6
- package/lib/hooks/useAuthenticationConfig.js +0 -14
- package/lib/hooks/useCategoryConfigs.d.ts +0 -6
- package/lib/hooks/useCategoryConfigs.js +0 -17
- package/lib/hooks/useEntityListRelatedView.d.ts +0 -15
- package/lib/hooks/useEntityListRelatedView.js +0 -62
- package/lib/hooks/useExploreMode.d.ts +0 -14
- package/lib/hooks/useExploreMode.js +0 -20
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +0 -15
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +0 -27
- package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +0 -5
- package/lib/hooks/useFileManifest/useFileManifestURL.js +0 -11
- package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +0 -9
- package/lib/hooks/useFileManifest/useRequestFileManifest.js +0 -37
- package/lib/hooks/useLayoutState.d.ts +0 -6
- package/lib/hooks/useLayoutState.js +0 -9
- package/lib/hooks/useMenu.d.ts +0 -10
- package/lib/hooks/useMenu.js +0 -17
- package/lib/hooks/useMenuWithPosition.d.ts +0 -14
- package/lib/hooks/useMenuWithPosition.js +0 -33
- package/lib/hooks/useSessionTimeout.d.ts +0 -11
- package/lib/hooks/useSessionTimeout.js +0 -28
- package/lib/providers/authentication.d.ts +0 -51
- package/lib/providers/authentication.js +0 -110
- package/lib/providers/layoutState.d.ts +0 -40
- package/lib/providers/layoutState.js +0 -47
- package/lib/styles/common/mixins/shadows.d.ts +0 -3
- package/lib/styles/common/mixins/shadows.js +0 -4
- package/lib/styles/common/mui/palette.d.ts +0 -47
- package/lib/styles/common/mui/palette.js +0 -47
- package/lib/theme/common/entities.d.ts +0 -6
- package/lib/theme/common/entities.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [35.2.0](https://github.com/DataBiosphere/findable-ui/compare/v35.1.0...v35.2.0) (2025-06-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add table <code> element ([#525](https://github.com/DataBiosphere/findable-ui/issues/525)) ([#527](https://github.com/DataBiosphere/findable-ui/issues/527)) ([02cb3b6](https://github.com/DataBiosphere/findable-ui/commit/02cb3b698b25a4295fc5ea2048541869301b918f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* make user request project metadata by clicking the request link button ([#530](https://github.com/DataBiosphere/findable-ui/issues/530)) ([#531](https://github.com/DataBiosphere/findable-ui/issues/531)) ([b645e0f](https://github.com/DataBiosphere/findable-ui/commit/b645e0fe5604dfc7fc195f91747d4a7985b39e4d))
|
|
14
|
+
|
|
15
|
+
## [35.1.0](https://github.com/DataBiosphere/findable-ui/compare/v35.0.3...v35.1.0) (2025-06-05)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* added handling of multiple dictionaries [#423](https://github.com/DataBiosphere/findable-ui/issues/423) ([#523](https://github.com/DataBiosphere/findable-ui/issues/523)) ([212d09a](https://github.com/DataBiosphere/findable-ui/commit/212d09a55f0699a19f5a9dd9c5f917bd46de7a14))
|
|
21
|
+
|
|
3
22
|
## [35.0.3](https://github.com/DataBiosphere/findable-ui/compare/v35.0.2...v35.0.3) (2025-06-04)
|
|
4
23
|
|
|
5
24
|
|
package/lib/common/entities.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export interface DataDictionary<T extends RowData = Attribute> {
|
|
|
65
65
|
export interface DataDictionaryConfig<T extends RowData = Attribute> {
|
|
66
66
|
columnDefs: ColumnDef<T, T[keyof T]>[];
|
|
67
67
|
dataDictionary: DataDictionary<T>;
|
|
68
|
+
path: string;
|
|
68
69
|
tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">;
|
|
69
70
|
}
|
|
70
71
|
/**
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
+
import { useRouter } from "next/router";
|
|
1
2
|
import { useMemo } from "react";
|
|
2
3
|
import { useConfig } from "../../../../hooks/useConfig";
|
|
3
4
|
import { buildClassesOutline } from "../../components/Outline/utils";
|
|
4
5
|
import { useTable } from "../../components/Table/hook";
|
|
5
6
|
export const useDataDictionary = () => {
|
|
6
7
|
const { config: { dataDictionaries: dataDictionaryConfigs }, } = useConfig();
|
|
7
|
-
//
|
|
8
|
-
|
|
8
|
+
// Dynamic paths must be resolved at this point otherwise the initial settings
|
|
9
|
+
// passed to useTable on subsequent renders will be ignored (as the table will have
|
|
10
|
+
// already been initialized).
|
|
11
|
+
const router = useRouter();
|
|
12
|
+
const query = router.query;
|
|
13
|
+
const { dictionary } = query;
|
|
14
|
+
// Get dictionary config by matching the current path with the data dictionary path
|
|
15
|
+
const dataDictionaryConfig = useMemo(() => {
|
|
16
|
+
if (!dataDictionaryConfigs?.length)
|
|
17
|
+
return undefined;
|
|
18
|
+
// Find the data dictionary with a path that matches the current route
|
|
19
|
+
// We check if the current path starts with the dictionary path to handle nested routes
|
|
20
|
+
return dataDictionaryConfigs.find((config) => config.path === dictionary);
|
|
21
|
+
}, [dataDictionaryConfigs, dictionary]);
|
|
9
22
|
// Get configured dictionary classes, column definitions and table options.
|
|
10
23
|
const { classes, columnDefs, tableOptions, title } = useMemo(() => {
|
|
11
24
|
return {
|
|
@@ -1,49 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button, TableBody, TableCell, TableRow, Tooltip } from "@mui/material";
|
|
2
2
|
import copy from "copy-to-clipboard";
|
|
3
|
-
import React
|
|
3
|
+
import React from "react";
|
|
4
4
|
import { useDownloadStatus } from "../../../../../../../../hooks/useDownloadStatus";
|
|
5
5
|
import { useFileManifestDownload } from "../../../../../../../../hooks/useFileManifest/useFileManifestDownload";
|
|
6
6
|
import { useLoginGuard } from "../../../../../../../../providers/loginGuard/hook";
|
|
7
|
+
import { BUTTON_PROPS } from "../../../../../../../common/Button/constants";
|
|
7
8
|
import { ButtonGroup } from "../../../../../../../common/ButtonGroup/buttonGroup";
|
|
8
|
-
import { ButtonGroupButton } from "../../../../../../../common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
|
|
9
9
|
import { ContentCopyIconSmall, DownloadIconSmall, } from "../../../../../../../common/CustomIcon/common/constants";
|
|
10
10
|
import { FluidPaper, GridPaper, } from "../../../../../../../common/Paper/paper.styles";
|
|
11
11
|
import { Loading, LOADING_PANEL_STYLE, } from "../../../../../../../Loading/loading";
|
|
12
12
|
import { GridTable } from "../../../../../../../Table/common/gridTable.styles";
|
|
13
|
+
import { TOOLTIP_PROPS } from "../../constants";
|
|
13
14
|
import { SectionTitle, TableContainer, } from "../../manifestDownloadEntity.styles";
|
|
14
15
|
export const FileManifestDownload = ({ filters, }) => {
|
|
15
|
-
const downloadRef = useRef(null);
|
|
16
16
|
const { disabled, message } = useDownloadStatus();
|
|
17
|
-
const { fileName, isIdle, isLoading, manifestURL } = useFileManifestDownload(filters
|
|
18
|
-
const isInProgress = (isIdle || isLoading) && !disabled;
|
|
19
|
-
const isReady = Boolean(manifestURL) || disabled;
|
|
17
|
+
const { fileName, isIdle, isLoading, manifestURL, requestManifest } = useFileManifestDownload(filters);
|
|
20
18
|
// Prompt user for login before download and copy, if required.
|
|
21
19
|
const { requireLogin } = useLoginGuard();
|
|
22
|
-
// Copies file manifest.
|
|
23
|
-
const copyManifestURL = (url) => {
|
|
24
|
-
if (!url)
|
|
25
|
-
return;
|
|
26
|
-
copy(url);
|
|
27
|
-
};
|
|
28
|
-
// Downloads file manifest.
|
|
29
|
-
const downloadManifestURL = () => {
|
|
30
|
-
downloadRef.current?.click();
|
|
31
|
-
};
|
|
32
20
|
return (React.createElement(FluidPaper, null,
|
|
33
21
|
React.createElement(GridPaper, null,
|
|
34
22
|
React.createElement(SectionTitle, null, "File Manifest"),
|
|
35
23
|
React.createElement(TableContainer, null,
|
|
36
|
-
React.createElement(Loading, { loading:
|
|
37
|
-
React.createElement(GridTable, { gridTemplateColumns:
|
|
24
|
+
React.createElement(Loading, { loading: isLoading, panelStyle: LOADING_PANEL_STYLE.INHERIT }),
|
|
25
|
+
React.createElement(GridTable, { gridTemplateColumns: "auto 1fr" },
|
|
38
26
|
React.createElement(TableBody, null,
|
|
39
|
-
React.createElement(TableRow, null,
|
|
40
|
-
React.createElement(
|
|
41
|
-
React.createElement(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
React.createElement(TableRow, null, isIdle || isLoading ? (React.createElement(TableCell, null,
|
|
28
|
+
React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: message },
|
|
29
|
+
React.createElement("span", null,
|
|
30
|
+
React.createElement(Button, { ...BUTTON_PROPS.PRIMARY_CONTAINED, disabled: disabled || isLoading, onClick: () => requireLogin(requestManifest) }, "Request link"))))) : (React.createElement(React.Fragment, null,
|
|
31
|
+
manifestURL && (React.createElement(TableCell, null,
|
|
32
|
+
React.createElement(ButtonGroup, { Buttons: [
|
|
33
|
+
React.createElement(Button, { key: "download", download: true, href: manifestURL },
|
|
34
|
+
React.createElement(DownloadIconSmall, null)),
|
|
35
|
+
React.createElement(Button, { key: "copy", onClick: () => copy(manifestURL) },
|
|
36
|
+
React.createElement(ContentCopyIconSmall, null)),
|
|
37
|
+
] }))),
|
|
38
|
+
React.createElement(TableCell, null, manifestURL
|
|
39
|
+
? fileName
|
|
40
|
+
: "The manifest is not available for this project."))))))))));
|
|
49
41
|
};
|
|
@@ -1,53 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button, TableBody, TableCell, TableRow, Tooltip } from "@mui/material";
|
|
2
2
|
import copy from "copy-to-clipboard";
|
|
3
|
-
import React
|
|
3
|
+
import React from "react";
|
|
4
4
|
import { useDownloadStatus } from "../../../../../../../../hooks/useDownloadStatus";
|
|
5
5
|
import { useFileManifestSpreadsheet } from "../../../../../../../../hooks/useFileManifest/useFileManifestSpreadsheet";
|
|
6
|
-
import {
|
|
6
|
+
import { BUTTON_PROPS } from "../../../../../../../common/Button/constants";
|
|
7
7
|
import { ButtonGroup } from "../../../../../../../common/ButtonGroup/buttonGroup";
|
|
8
|
-
import { ButtonGroupButton } from "../../../../../../../common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
|
|
9
8
|
import { ContentCopyIconSmall, DownloadIconSmall, } from "../../../../../../../common/CustomIcon/common/constants";
|
|
10
9
|
import { FluidPaper, GridPaper, } from "../../../../../../../common/Paper/paper.styles";
|
|
11
10
|
import { Loading, LOADING_PANEL_STYLE, } from "../../../../../../../Loading/loading";
|
|
12
11
|
import { GridTable } from "../../../../../../../Table/common/gridTable.styles";
|
|
12
|
+
import { TOOLTIP_PROPS } from "../../constants";
|
|
13
13
|
import { SectionTitle, TableContainer, } from "../../manifestDownloadEntity.styles";
|
|
14
14
|
export const FileManifestSpreadsheet = ({ filters, }) => {
|
|
15
|
-
const downloadRef = useRef(null);
|
|
16
15
|
const { disabled, message } = useDownloadStatus();
|
|
17
|
-
const {
|
|
18
|
-
const { data, isLoading, run } = useRequestFileLocation(fileUrl);
|
|
19
|
-
const spreadsheetURL = data?.location;
|
|
20
|
-
const isInProgress = (exists === undefined || isLoading) && !disabled;
|
|
21
|
-
const isReady = Boolean(spreadsheetURL) || disabled;
|
|
22
|
-
// Copies metadata spreadsheet.
|
|
23
|
-
const copyMetadataURL = (url) => {
|
|
24
|
-
if (!url)
|
|
25
|
-
return;
|
|
26
|
-
copy(url);
|
|
27
|
-
};
|
|
28
|
-
// Downloads metadata spreadsheet.
|
|
29
|
-
const downloadMetadataURL = () => {
|
|
30
|
-
downloadRef.current?.click();
|
|
31
|
-
};
|
|
32
|
-
// Requests metadata spreadsheet.
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
run();
|
|
35
|
-
}, [fileUrl, run]);
|
|
16
|
+
const { fileName, isIdle = false, isLoading = false, requestManifest, spreadsheetUrl, } = useFileManifestSpreadsheet(filters) || {};
|
|
36
17
|
return (React.createElement(FluidPaper, null,
|
|
37
18
|
React.createElement(GridPaper, null,
|
|
38
19
|
React.createElement(SectionTitle, null, "Metadata"),
|
|
39
20
|
React.createElement(TableContainer, null,
|
|
40
|
-
React.createElement(Loading, { loading:
|
|
41
|
-
React.createElement(GridTable, { gridTemplateColumns:
|
|
21
|
+
React.createElement(Loading, { loading: isLoading, panelStyle: LOADING_PANEL_STYLE.INHERIT }),
|
|
22
|
+
React.createElement(GridTable, { gridTemplateColumns: "auto 1fr" },
|
|
42
23
|
React.createElement(TableBody, null,
|
|
43
|
-
React.createElement(TableRow, null,
|
|
44
|
-
React.createElement(
|
|
45
|
-
React.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
24
|
+
React.createElement(TableRow, null, isIdle || isLoading ? (React.createElement(TableCell, null,
|
|
25
|
+
React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: message },
|
|
26
|
+
React.createElement("span", null,
|
|
27
|
+
React.createElement(Button, { ...BUTTON_PROPS.PRIMARY_CONTAINED, disabled: disabled || isLoading, onClick: () => requestManifest?.() }, "Request link"))))) : (React.createElement(React.Fragment, null,
|
|
28
|
+
spreadsheetUrl && (React.createElement(TableCell, null,
|
|
29
|
+
React.createElement(ButtonGroup, { Buttons: [
|
|
30
|
+
React.createElement(Button, { key: "download", download: true, href: spreadsheetUrl },
|
|
31
|
+
React.createElement(DownloadIconSmall, null)),
|
|
32
|
+
React.createElement(Button, { key: "copy", onClick: () => copy(spreadsheetUrl) },
|
|
33
|
+
React.createElement(ContentCopyIconSmall, null)),
|
|
34
|
+
] }))),
|
|
35
|
+
React.createElement(TableCell, null, spreadsheetUrl
|
|
36
|
+
? fileName
|
|
37
|
+
: "The metadata is not available for this project."))))))))));
|
|
53
38
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const TOOLTIP_PROPS = {
|
|
2
|
+
arrow: true,
|
|
3
|
+
slotProps: {
|
|
4
|
+
popper: {
|
|
5
|
+
modifiers: [
|
|
6
|
+
{
|
|
7
|
+
name: "offset",
|
|
8
|
+
options: {
|
|
9
|
+
offset: [0, -4],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "preventOverflow",
|
|
14
|
+
options: { padding: 8 },
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
tooltip: {
|
|
19
|
+
sx: { maxWidth: "none" },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CellContext, RowData } from "@tanstack/react-table";
|
|
2
|
+
import { BaseComponentProps } from "../../../../../types";
|
|
3
|
+
export declare const CodeCell: <T extends RowData, TValue extends string = string>({ className, getValue, }: BaseComponentProps & CellContext<T, TValue>) => JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CHIP_PROPS } from "../../../../../../styles/common/mui/chip";
|
|
3
|
+
import { StyledChip } from "./codeCell.styles";
|
|
4
|
+
export const CodeCell = ({ className, getValue, }) => {
|
|
5
|
+
const value = getValue();
|
|
6
|
+
if (!value)
|
|
7
|
+
return null;
|
|
8
|
+
return (React.createElement(StyledChip, { className: className, color: CHIP_PROPS.COLOR.DEFAULT, label: value, size: CHIP_PROPS.SIZE.SMALL }));
|
|
9
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledChip: import("@emotion/styled").StyledComponent<import("@mui/material").ChipOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
+
}, "label" | "style" | "className" | "classes" | "tabIndex" | "color" | "children" | "sx" | "variant" | "disabled" | "size" | "avatar" | "clickable" | "deleteIcon" | "icon" | "onDelete" | "skipFocusWhenDisabled"> & {
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Chip } from "@mui/material";
|
|
3
|
+
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
4
|
+
export const StyledChip = styled(Chip) `
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
box-shadow: 0 0 0 2px ${PALETTE.COMMON_WHITE};
|
|
7
|
+
height: auto;
|
|
8
|
+
justify-self: flex-start;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
|
|
11
|
+
.MuiChip-label {
|
|
12
|
+
padding: 2px 8px;
|
|
13
|
+
white-space: normal;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
@@ -4,11 +4,11 @@ export interface ManifestDownload {
|
|
|
4
4
|
isIdle: boolean;
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
manifestURL?: string;
|
|
7
|
+
requestManifest: () => void;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Returns file manifest download url and file name.
|
|
10
11
|
* @param filters - Filters.
|
|
11
|
-
* @param disabled - Disabled.
|
|
12
12
|
* @returns file manifest download url and file name.
|
|
13
13
|
*/
|
|
14
|
-
export declare const useFileManifestDownload: (filters: Filters
|
|
14
|
+
export declare const useFileManifestDownload: (filters: Filters) => ManifestDownload;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
1
|
import { MANIFEST_DOWNLOAD_FORMAT } from "../../apis/azul/common/entities";
|
|
3
2
|
import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT } from "../../components/Export/common/entities";
|
|
4
3
|
import { useCatalog } from "../useCatalog";
|
|
@@ -8,10 +7,9 @@ import { buildRequestManifest } from "../useRequestManifest/utils";
|
|
|
8
7
|
/**
|
|
9
8
|
* Returns file manifest download url and file name.
|
|
10
9
|
* @param filters - Filters.
|
|
11
|
-
* @param disabled - Disabled.
|
|
12
10
|
* @returns file manifest download url and file name.
|
|
13
11
|
*/
|
|
14
|
-
export const useFileManifestDownload = (filters
|
|
12
|
+
export const useFileManifestDownload = (filters) => {
|
|
15
13
|
// Retrieve the endpoint URL from configured data source.
|
|
16
14
|
const config = useConfig();
|
|
17
15
|
const endpointUrl = config.config.dataSource.url;
|
|
@@ -19,20 +17,15 @@ export const useFileManifestDownload = (filters, disabled) => {
|
|
|
19
17
|
const catalog = useCatalog(); // catalog should be defined.
|
|
20
18
|
// Build request manifest request URL.
|
|
21
19
|
const { requestMethod, requestUrl } = buildRequestManifest(endpointUrl, catalog, filters, MANIFEST_DOWNLOAD_FORMAT.COMPACT);
|
|
22
|
-
const { data, isIdle, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
|
|
20
|
+
const { data, isIdle, isLoading, run: requestManifest, } = useRequestFileLocation(requestUrl, requestMethod);
|
|
23
21
|
const manifestURL = getManifestDownloadURL(data);
|
|
24
22
|
const fileName = getManifestDownloadFileName(data);
|
|
25
|
-
// Requests file manifest.
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (disabled)
|
|
28
|
-
return;
|
|
29
|
-
run();
|
|
30
|
-
}, [disabled, requestUrl, run]);
|
|
31
23
|
return {
|
|
32
24
|
fileName,
|
|
33
25
|
isIdle,
|
|
34
26
|
isLoading,
|
|
35
27
|
manifestURL,
|
|
28
|
+
requestManifest,
|
|
36
29
|
};
|
|
37
30
|
};
|
|
38
31
|
/**
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Filters } from "../../common/entities";
|
|
2
2
|
export interface ManifestSpreadsheet {
|
|
3
|
-
exists?: boolean;
|
|
4
|
-
fileFormat?: string;
|
|
5
3
|
fileName?: string;
|
|
6
4
|
fileUrl?: string;
|
|
5
|
+
isIdle?: boolean;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
requestManifest?: () => void;
|
|
8
|
+
spreadsheetUrl?: string;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* Returns file manifest spreadsheet.
|
|
10
12
|
* @param filters - Filters.
|
|
11
|
-
* @param disabled - Disabled.
|
|
12
13
|
* @returns file manifest spreadsheet.
|
|
13
14
|
*/
|
|
14
|
-
export declare const useFileManifestSpreadsheet: (filters: Filters
|
|
15
|
+
export declare const useFileManifestSpreadsheet: (filters: Filters) => Omit<ManifestSpreadsheet, "fileUrl">;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { useEffect, useMemo } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
2
2
|
import { APIEndpoints, } from "../../apis/azul/common/entities";
|
|
3
3
|
import { fetchEntitiesFromURL } from "../../entity/common/service";
|
|
4
4
|
import { fetchQueryParams } from "../../utils/fetchQueryParams";
|
|
5
5
|
import { useAsync } from "../useAsync";
|
|
6
6
|
import { useCatalog } from "../useCatalog";
|
|
7
7
|
import { useFetchRequestURL } from "../useFetchRequestURL";
|
|
8
|
+
import { useRequestFileLocation } from "../useRequestFileLocation";
|
|
8
9
|
/**
|
|
9
10
|
* Returns file manifest spreadsheet.
|
|
10
11
|
* @param filters - Filters.
|
|
11
|
-
* @param disabled - Disabled.
|
|
12
12
|
* @returns file manifest spreadsheet.
|
|
13
13
|
*/
|
|
14
|
-
export const useFileManifestSpreadsheet = (filters
|
|
14
|
+
export const useFileManifestSpreadsheet = (filters) => {
|
|
15
15
|
// Determine catalog.
|
|
16
16
|
const catalog = useCatalog(); // catalog should be defined.
|
|
17
17
|
// Build request params.
|
|
@@ -19,16 +19,26 @@ export const useFileManifestSpreadsheet = (filters, disabled) => {
|
|
|
19
19
|
// Build request URL.
|
|
20
20
|
const requestURL = useFetchRequestURL(APIEndpoints.FILES, requestParams);
|
|
21
21
|
// Fetch files to determine if file exists.
|
|
22
|
-
const { data, run } = useAsync();
|
|
22
|
+
const { data: files, isIdle, isLoading: isFilesLoading, run: requestFiles, } = useAsync();
|
|
23
23
|
// Grab manifest spreadsheet.
|
|
24
|
-
const
|
|
24
|
+
const { fileName, fileUrl } = useMemo(() => getManifestSpreadsheet(files?.hits), [files]);
|
|
25
|
+
// Fetch file manifest.
|
|
26
|
+
const { data, isLoading, run } = useRequestFileLocation(fileUrl);
|
|
25
27
|
// Fetch response from files endpoint.
|
|
28
|
+
const requestManifest = useCallback(() => {
|
|
29
|
+
requestFiles(fetchEntitiesFromURL(requestURL, undefined));
|
|
30
|
+
}, [requestFiles, requestURL]);
|
|
31
|
+
// Fetch file manifest.
|
|
26
32
|
useEffect(() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
run();
|
|
34
|
+
}, [fileUrl, run]);
|
|
35
|
+
return {
|
|
36
|
+
fileName,
|
|
37
|
+
isIdle,
|
|
38
|
+
isLoading: isFilesLoading || isLoading,
|
|
39
|
+
requestManifest,
|
|
40
|
+
spreadsheetUrl: data?.location,
|
|
41
|
+
};
|
|
32
42
|
};
|
|
33
43
|
/**
|
|
34
44
|
* Prepend "/fetch" to the path of the specified file URL, if not already included.
|
|
@@ -52,20 +62,14 @@ function buildFetchFileUrl(fileUrl) {
|
|
|
52
62
|
* @returns manifest spreadsheet.
|
|
53
63
|
*/
|
|
54
64
|
function getManifestSpreadsheet(files) {
|
|
55
|
-
if (!files)
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
65
|
+
if (!files)
|
|
66
|
+
return { fileName: undefined, fileUrl: undefined };
|
|
58
67
|
// Handle case where file does not exist.
|
|
59
|
-
if (files.length === 0)
|
|
60
|
-
return {
|
|
61
|
-
exists: false,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
68
|
+
if (files.length === 0)
|
|
69
|
+
return { fileName: undefined, fileUrl: undefined };
|
|
64
70
|
// Project manifest spreadsheet exists.
|
|
65
71
|
const file = files[0];
|
|
66
72
|
return {
|
|
67
|
-
exists: true,
|
|
68
|
-
fileFormat: file.files[0]?.format,
|
|
69
73
|
fileName: file.files[0]?.name,
|
|
70
74
|
fileUrl: buildFetchFileUrl(file.files[0]?.url),
|
|
71
75
|
};
|
package/package.json
CHANGED
package/src/common/entities.ts
CHANGED
|
@@ -74,6 +74,7 @@ export interface DataDictionary<T extends RowData = Attribute> {
|
|
|
74
74
|
export interface DataDictionaryConfig<T extends RowData = Attribute> {
|
|
75
75
|
columnDefs: ColumnDef<T, T[keyof T]>[];
|
|
76
76
|
dataDictionary: DataDictionary<T>;
|
|
77
|
+
path: string; // Used as a key to find the dictionary to display
|
|
77
78
|
tableOptions?: Omit<TableOptions<T>, "columns" | "data" | "getCoreRowModel">;
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RowData } from "@tanstack/react-table";
|
|
2
|
+
import { useRouter } from "next/router";
|
|
2
3
|
import { useMemo } from "react";
|
|
3
4
|
import { Attribute, DataDictionaryConfig } from "../../../../common/entities";
|
|
4
5
|
import { useConfig } from "../../../../hooks/useConfig";
|
|
@@ -12,11 +13,23 @@ export const useDataDictionary = <
|
|
|
12
13
|
const {
|
|
13
14
|
config: { dataDictionaries: dataDictionaryConfigs },
|
|
14
15
|
} = useConfig();
|
|
16
|
+
// Dynamic paths must be resolved at this point otherwise the initial settings
|
|
17
|
+
// passed to useTable on subsequent renders will be ignored (as the table will have
|
|
18
|
+
// already been initialized).
|
|
19
|
+
const router = useRouter();
|
|
20
|
+
const query = router.query;
|
|
21
|
+
const { dictionary } = query;
|
|
15
22
|
|
|
16
|
-
// Get dictionary config
|
|
17
|
-
const dataDictionaryConfig =
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
// Get dictionary config by matching the current path with the data dictionary path
|
|
24
|
+
const dataDictionaryConfig = useMemo(() => {
|
|
25
|
+
if (!dataDictionaryConfigs?.length) return undefined;
|
|
26
|
+
|
|
27
|
+
// Find the data dictionary with a path that matches the current route
|
|
28
|
+
// We check if the current path starts with the dictionary path to handle nested routes
|
|
29
|
+
return dataDictionaryConfigs.find(
|
|
30
|
+
(config) => config.path === dictionary
|
|
31
|
+
) as DataDictionaryConfig<T> | undefined;
|
|
32
|
+
}, [dataDictionaryConfigs, dictionary]);
|
|
20
33
|
|
|
21
34
|
// Get configured dictionary classes, column definitions and table options.
|
|
22
35
|
const { classes, columnDefs, tableOptions, title } = useMemo(() => {
|