@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
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ButtonBase,
|
|
3
|
-
TableBody,
|
|
4
|
-
TableCell,
|
|
5
|
-
TableRow,
|
|
6
|
-
Tooltip,
|
|
7
|
-
} from "@mui/material";
|
|
1
|
+
import { Button, TableBody, TableCell, TableRow, Tooltip } from "@mui/material";
|
|
8
2
|
import copy from "copy-to-clipboard";
|
|
9
|
-
import React
|
|
3
|
+
import React from "react";
|
|
10
4
|
import { Filters } from "../../../../../../../../common/entities";
|
|
11
5
|
import { useDownloadStatus } from "../../../../../../../../hooks/useDownloadStatus";
|
|
12
6
|
import { useFileManifestDownload } from "../../../../../../../../hooks/useFileManifest/useFileManifestDownload";
|
|
13
7
|
import { useLoginGuard } from "../../../../../../../../providers/loginGuard/hook";
|
|
8
|
+
import { BUTTON_PROPS } from "../../../../../../../common/Button/constants";
|
|
14
9
|
import { ButtonGroup } from "../../../../../../../common/ButtonGroup/buttonGroup";
|
|
15
|
-
import { ButtonGroupButton } from "../../../../../../../common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
|
|
16
10
|
import {
|
|
17
11
|
ContentCopyIconSmall,
|
|
18
12
|
DownloadIconSmall,
|
|
@@ -26,6 +20,7 @@ import {
|
|
|
26
20
|
LOADING_PANEL_STYLE,
|
|
27
21
|
} from "../../../../../../../Loading/loading";
|
|
28
22
|
import { GridTable } from "../../../../../../../Table/common/gridTable.styles";
|
|
23
|
+
import { TOOLTIP_PROPS } from "../../constants";
|
|
29
24
|
import {
|
|
30
25
|
SectionTitle,
|
|
31
26
|
TableContainer,
|
|
@@ -38,87 +33,64 @@ export interface FileManifestDownloadProps {
|
|
|
38
33
|
export const FileManifestDownload = ({
|
|
39
34
|
filters,
|
|
40
35
|
}: FileManifestDownloadProps): JSX.Element => {
|
|
41
|
-
const downloadRef = useRef<HTMLAnchorElement>(null);
|
|
42
36
|
const { disabled, message } = useDownloadStatus();
|
|
43
|
-
const { fileName, isIdle, isLoading, manifestURL } =
|
|
44
|
-
filters
|
|
45
|
-
disabled
|
|
46
|
-
);
|
|
47
|
-
const isInProgress = (isIdle || isLoading) && !disabled;
|
|
48
|
-
const isReady = Boolean(manifestURL) || disabled;
|
|
37
|
+
const { fileName, isIdle, isLoading, manifestURL, requestManifest } =
|
|
38
|
+
useFileManifestDownload(filters);
|
|
49
39
|
|
|
50
40
|
// Prompt user for login before download and copy, if required.
|
|
51
41
|
const { requireLogin } = useLoginGuard();
|
|
52
42
|
|
|
53
|
-
// Copies file manifest.
|
|
54
|
-
const copyManifestURL = (url?: string): void => {
|
|
55
|
-
if (!url) return;
|
|
56
|
-
copy(url);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Downloads file manifest.
|
|
60
|
-
const downloadManifestURL = (): void => {
|
|
61
|
-
downloadRef.current?.click();
|
|
62
|
-
};
|
|
63
|
-
|
|
64
43
|
return (
|
|
65
44
|
<FluidPaper>
|
|
66
45
|
<GridPaper>
|
|
67
46
|
<SectionTitle>File Manifest</SectionTitle>
|
|
68
47
|
<TableContainer>
|
|
69
48
|
<Loading
|
|
70
|
-
loading={
|
|
49
|
+
loading={isLoading}
|
|
71
50
|
panelStyle={LOADING_PANEL_STYLE.INHERIT}
|
|
72
51
|
/>
|
|
73
|
-
<GridTable gridTemplateColumns=
|
|
52
|
+
<GridTable gridTemplateColumns="auto 1fr">
|
|
74
53
|
<TableBody>
|
|
75
54
|
<TableRow>
|
|
76
|
-
{
|
|
77
|
-
<TableCell
|
|
78
|
-
|
|
55
|
+
{isIdle || isLoading ? (
|
|
56
|
+
<TableCell>
|
|
57
|
+
<Tooltip {...TOOLTIP_PROPS} title={message}>
|
|
58
|
+
<span>
|
|
59
|
+
<Button
|
|
60
|
+
{...BUTTON_PROPS.PRIMARY_CONTAINED}
|
|
61
|
+
disabled={disabled || isLoading}
|
|
62
|
+
onClick={() => requireLogin(requestManifest)}
|
|
63
|
+
>
|
|
64
|
+
Request link
|
|
65
|
+
</Button>
|
|
66
|
+
</span>
|
|
67
|
+
</Tooltip>
|
|
68
|
+
</TableCell>
|
|
69
|
+
) : (
|
|
79
70
|
<>
|
|
71
|
+
{manifestURL && (
|
|
72
|
+
<TableCell>
|
|
73
|
+
<ButtonGroup
|
|
74
|
+
Buttons={[
|
|
75
|
+
<Button key="download" download href={manifestURL}>
|
|
76
|
+
<DownloadIconSmall />
|
|
77
|
+
</Button>,
|
|
78
|
+
<Button
|
|
79
|
+
key="copy"
|
|
80
|
+
onClick={() => copy(manifestURL)}
|
|
81
|
+
>
|
|
82
|
+
<ContentCopyIconSmall />
|
|
83
|
+
</Button>,
|
|
84
|
+
]}
|
|
85
|
+
/>
|
|
86
|
+
</TableCell>
|
|
87
|
+
)}
|
|
80
88
|
<TableCell>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
ref={downloadRef}
|
|
85
|
-
sx={{ display: "none" }}
|
|
86
|
-
/>
|
|
87
|
-
<Tooltip arrow title={message}>
|
|
88
|
-
<span>
|
|
89
|
-
<ButtonGroup
|
|
90
|
-
Buttons={[
|
|
91
|
-
<ButtonGroupButton
|
|
92
|
-
key="download"
|
|
93
|
-
action="Download file manifest"
|
|
94
|
-
disabled={disabled}
|
|
95
|
-
label={<DownloadIconSmall />}
|
|
96
|
-
onClick={() =>
|
|
97
|
-
requireLogin(downloadManifestURL)
|
|
98
|
-
}
|
|
99
|
-
/>,
|
|
100
|
-
<ButtonGroupButton
|
|
101
|
-
key="copy"
|
|
102
|
-
action="Copy file manifest"
|
|
103
|
-
disabled={disabled}
|
|
104
|
-
label={<ContentCopyIconSmall />}
|
|
105
|
-
onClick={() =>
|
|
106
|
-
requireLogin((): void =>
|
|
107
|
-
copyManifestURL(manifestURL)
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
/>,
|
|
111
|
-
]}
|
|
112
|
-
/>
|
|
113
|
-
</span>
|
|
114
|
-
</Tooltip>
|
|
89
|
+
{manifestURL
|
|
90
|
+
? fileName
|
|
91
|
+
: "The manifest is not available for this project."}
|
|
115
92
|
</TableCell>
|
|
116
|
-
<TableCell>{fileName}</TableCell>
|
|
117
93
|
</>
|
|
118
|
-
) : (
|
|
119
|
-
<TableCell>
|
|
120
|
-
The manifest is not available for this project.
|
|
121
|
-
</TableCell>
|
|
122
94
|
)}
|
|
123
95
|
</TableRow>
|
|
124
96
|
</TableBody>
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ButtonBase,
|
|
3
|
-
TableBody,
|
|
4
|
-
TableCell,
|
|
5
|
-
TableRow,
|
|
6
|
-
Tooltip,
|
|
7
|
-
} from "@mui/material";
|
|
1
|
+
import { Button, TableBody, TableCell, TableRow, Tooltip } from "@mui/material";
|
|
8
2
|
import copy from "copy-to-clipboard";
|
|
9
|
-
import React
|
|
3
|
+
import React from "react";
|
|
10
4
|
import { Filters } from "../../../../../../../../common/entities";
|
|
11
5
|
import { useDownloadStatus } from "../../../../../../../../hooks/useDownloadStatus";
|
|
12
6
|
import { useFileManifestSpreadsheet } from "../../../../../../../../hooks/useFileManifest/useFileManifestSpreadsheet";
|
|
13
|
-
import {
|
|
7
|
+
import { BUTTON_PROPS } from "../../../../../../../common/Button/constants";
|
|
14
8
|
import { ButtonGroup } from "../../../../../../../common/ButtonGroup/buttonGroup";
|
|
15
|
-
import { ButtonGroupButton } from "../../../../../../../common/ButtonGroup/components/ButtonGroupButton/buttonGroupButton";
|
|
16
9
|
import {
|
|
17
10
|
ContentCopyIconSmall,
|
|
18
11
|
DownloadIconSmall,
|
|
@@ -26,6 +19,7 @@ import {
|
|
|
26
19
|
LOADING_PANEL_STYLE,
|
|
27
20
|
} from "../../../../../../../Loading/loading";
|
|
28
21
|
import { GridTable } from "../../../../../../../Table/common/gridTable.styles";
|
|
22
|
+
import { TOOLTIP_PROPS } from "../../constants";
|
|
29
23
|
import {
|
|
30
24
|
SectionTitle,
|
|
31
25
|
TableContainer,
|
|
@@ -38,30 +32,14 @@ export interface FileManifestSpreadsheetProps {
|
|
|
38
32
|
export const FileManifestSpreadsheet = ({
|
|
39
33
|
filters,
|
|
40
34
|
}: FileManifestSpreadsheetProps): JSX.Element => {
|
|
41
|
-
const downloadRef = useRef<HTMLAnchorElement>(null);
|
|
42
35
|
const { disabled, message } = useDownloadStatus();
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// Copies metadata spreadsheet.
|
|
51
|
-
const copyMetadataURL = (url?: string): void => {
|
|
52
|
-
if (!url) return;
|
|
53
|
-
copy(url);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Downloads metadata spreadsheet.
|
|
57
|
-
const downloadMetadataURL = (): void => {
|
|
58
|
-
downloadRef.current?.click();
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// Requests metadata spreadsheet.
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
run();
|
|
64
|
-
}, [fileUrl, run]);
|
|
36
|
+
const {
|
|
37
|
+
fileName,
|
|
38
|
+
isIdle = false,
|
|
39
|
+
isLoading = false,
|
|
40
|
+
requestManifest,
|
|
41
|
+
spreadsheetUrl,
|
|
42
|
+
} = useFileManifestSpreadsheet(filters) || {};
|
|
65
43
|
|
|
66
44
|
return (
|
|
67
45
|
<FluidPaper>
|
|
@@ -69,55 +47,55 @@ export const FileManifestSpreadsheet = ({
|
|
|
69
47
|
<SectionTitle>Metadata</SectionTitle>
|
|
70
48
|
<TableContainer>
|
|
71
49
|
<Loading
|
|
72
|
-
loading={
|
|
50
|
+
loading={isLoading}
|
|
73
51
|
panelStyle={LOADING_PANEL_STYLE.INHERIT}
|
|
74
52
|
/>
|
|
75
|
-
<GridTable gridTemplateColumns=
|
|
53
|
+
<GridTable gridTemplateColumns="auto 1fr">
|
|
76
54
|
<TableBody>
|
|
77
55
|
<TableRow>
|
|
78
|
-
{
|
|
79
|
-
<TableCell
|
|
80
|
-
|
|
56
|
+
{isIdle || isLoading ? (
|
|
57
|
+
<TableCell>
|
|
58
|
+
<Tooltip {...TOOLTIP_PROPS} title={message}>
|
|
59
|
+
<span>
|
|
60
|
+
<Button
|
|
61
|
+
{...BUTTON_PROPS.PRIMARY_CONTAINED}
|
|
62
|
+
disabled={disabled || isLoading}
|
|
63
|
+
onClick={() => requestManifest?.()}
|
|
64
|
+
>
|
|
65
|
+
Request link
|
|
66
|
+
</Button>
|
|
67
|
+
</span>
|
|
68
|
+
</Tooltip>
|
|
69
|
+
</TableCell>
|
|
70
|
+
) : (
|
|
81
71
|
<>
|
|
72
|
+
{spreadsheetUrl && (
|
|
73
|
+
<TableCell>
|
|
74
|
+
<ButtonGroup
|
|
75
|
+
Buttons={[
|
|
76
|
+
<Button
|
|
77
|
+
key="download"
|
|
78
|
+
download
|
|
79
|
+
href={spreadsheetUrl}
|
|
80
|
+
>
|
|
81
|
+
<DownloadIconSmall />
|
|
82
|
+
</Button>,
|
|
83
|
+
<Button
|
|
84
|
+
key="copy"
|
|
85
|
+
onClick={() => copy(spreadsheetUrl)}
|
|
86
|
+
>
|
|
87
|
+
<ContentCopyIconSmall />
|
|
88
|
+
</Button>,
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
</TableCell>
|
|
92
|
+
)}
|
|
82
93
|
<TableCell>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
href={spreadsheetURL ?? ""}
|
|
87
|
-
ref={downloadRef}
|
|
88
|
-
sx={{ display: "none" }}
|
|
89
|
-
/>
|
|
90
|
-
<Tooltip arrow title={message}>
|
|
91
|
-
<span>
|
|
92
|
-
<ButtonGroup
|
|
93
|
-
Buttons={[
|
|
94
|
-
<ButtonGroupButton
|
|
95
|
-
key="download"
|
|
96
|
-
action="Download metadata spreadsheet"
|
|
97
|
-
disabled={disabled}
|
|
98
|
-
label={<DownloadIconSmall />}
|
|
99
|
-
onClick={downloadMetadataURL}
|
|
100
|
-
/>,
|
|
101
|
-
<ButtonGroupButton
|
|
102
|
-
key="copy"
|
|
103
|
-
action="Copy metadata spreadsheet"
|
|
104
|
-
disabled={disabled}
|
|
105
|
-
label={<ContentCopyIconSmall />}
|
|
106
|
-
onClick={(): void =>
|
|
107
|
-
copyMetadataURL(spreadsheetURL)
|
|
108
|
-
}
|
|
109
|
-
/>,
|
|
110
|
-
]}
|
|
111
|
-
/>
|
|
112
|
-
</span>
|
|
113
|
-
</Tooltip>
|
|
94
|
+
{spreadsheetUrl
|
|
95
|
+
? fileName
|
|
96
|
+
: "The metadata is not available for this project."}
|
|
114
97
|
</TableCell>
|
|
115
|
-
<TableCell>{fileName}</TableCell>
|
|
116
98
|
</>
|
|
117
|
-
) : (
|
|
118
|
-
<TableCell>
|
|
119
|
-
The metadata is not available for this project.
|
|
120
|
-
</TableCell>
|
|
121
99
|
)}
|
|
122
100
|
</TableRow>
|
|
123
101
|
</TableBody>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TooltipProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const TOOLTIP_PROPS: Partial<TooltipProps> = {
|
|
4
|
+
arrow: true,
|
|
5
|
+
slotProps: {
|
|
6
|
+
popper: {
|
|
7
|
+
modifiers: [
|
|
8
|
+
{
|
|
9
|
+
name: "offset",
|
|
10
|
+
options: {
|
|
11
|
+
offset: [0, -4],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "preventOverflow",
|
|
16
|
+
options: { padding: 8 },
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
tooltip: {
|
|
21
|
+
sx: { maxWidth: "none" },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Chip } from "@mui/material";
|
|
3
|
+
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
4
|
+
|
|
5
|
+
export const StyledChip = styled(Chip)`
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
box-shadow: 0 0 0 2px ${PALETTE.COMMON_WHITE};
|
|
8
|
+
height: auto;
|
|
9
|
+
justify-self: flex-start;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
|
|
12
|
+
.MuiChip-label {
|
|
13
|
+
padding: 2px 8px;
|
|
14
|
+
white-space: normal;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CellContext, RowData } from "@tanstack/react-table";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CHIP_PROPS } from "../../../../../../styles/common/mui/chip";
|
|
4
|
+
import { BaseComponentProps } from "../../../../../types";
|
|
5
|
+
import { StyledChip } from "./codeCell.styles";
|
|
6
|
+
|
|
7
|
+
export const CodeCell = <T extends RowData, TValue extends string = string>({
|
|
8
|
+
className,
|
|
9
|
+
getValue,
|
|
10
|
+
}: BaseComponentProps & CellContext<T, TValue>): JSX.Element | null => {
|
|
11
|
+
const value = getValue();
|
|
12
|
+
if (!value) return null;
|
|
13
|
+
return (
|
|
14
|
+
<StyledChip
|
|
15
|
+
className={className}
|
|
16
|
+
color={CHIP_PROPS.COLOR.DEFAULT}
|
|
17
|
+
label={value}
|
|
18
|
+
size={CHIP_PROPS.SIZE.SMALL}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
1
|
import { MANIFEST_DOWNLOAD_FORMAT } from "../../apis/azul/common/entities";
|
|
3
2
|
import { Filters } from "../../common/entities";
|
|
4
3
|
import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT } from "../../components/Export/common/entities";
|
|
@@ -15,18 +14,15 @@ export interface ManifestDownload {
|
|
|
15
14
|
isIdle: boolean;
|
|
16
15
|
isLoading: boolean;
|
|
17
16
|
manifestURL?: string;
|
|
17
|
+
requestManifest: () => void;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Returns file manifest download url and file name.
|
|
22
22
|
* @param filters - Filters.
|
|
23
|
-
* @param disabled - Disabled.
|
|
24
23
|
* @returns file manifest download url and file name.
|
|
25
24
|
*/
|
|
26
|
-
export const useFileManifestDownload = (
|
|
27
|
-
filters: Filters,
|
|
28
|
-
disabled: boolean
|
|
29
|
-
): ManifestDownload => {
|
|
25
|
+
export const useFileManifestDownload = (filters: Filters): ManifestDownload => {
|
|
30
26
|
// Retrieve the endpoint URL from configured data source.
|
|
31
27
|
const config = useConfig();
|
|
32
28
|
const endpointUrl = config.config.dataSource.url;
|
|
@@ -39,24 +35,21 @@ export const useFileManifestDownload = (
|
|
|
39
35
|
filters,
|
|
40
36
|
MANIFEST_DOWNLOAD_FORMAT.COMPACT
|
|
41
37
|
);
|
|
42
|
-
const {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const {
|
|
39
|
+
data,
|
|
40
|
+
isIdle,
|
|
41
|
+
isLoading,
|
|
42
|
+
run: requestManifest,
|
|
43
|
+
} = useRequestFileLocation(requestUrl, requestMethod);
|
|
46
44
|
const manifestURL = getManifestDownloadURL(data);
|
|
47
45
|
const fileName = getManifestDownloadFileName(data);
|
|
48
46
|
|
|
49
|
-
// Requests file manifest.
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
if (disabled) return;
|
|
52
|
-
run();
|
|
53
|
-
}, [disabled, requestUrl, run]);
|
|
54
|
-
|
|
55
47
|
return {
|
|
56
48
|
fileName,
|
|
57
49
|
isIdle,
|
|
58
50
|
isLoading,
|
|
59
51
|
manifestURL,
|
|
52
|
+
requestManifest,
|
|
60
53
|
};
|
|
61
54
|
};
|
|
62
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useMemo } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
2
2
|
import {
|
|
3
3
|
APIEndpoints,
|
|
4
4
|
AzulEntitiesResponse,
|
|
@@ -9,24 +9,25 @@ import { fetchQueryParams } from "../../utils/fetchQueryParams";
|
|
|
9
9
|
import { useAsync } from "../useAsync";
|
|
10
10
|
import { useCatalog } from "../useCatalog";
|
|
11
11
|
import { useFetchRequestURL } from "../useFetchRequestURL";
|
|
12
|
+
import { useRequestFileLocation } from "../useRequestFileLocation";
|
|
12
13
|
|
|
13
14
|
export interface ManifestSpreadsheet {
|
|
14
|
-
exists?: boolean;
|
|
15
|
-
fileFormat?: string;
|
|
16
15
|
fileName?: string;
|
|
17
16
|
fileUrl?: string;
|
|
17
|
+
isIdle?: boolean;
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
requestManifest?: () => void;
|
|
20
|
+
spreadsheetUrl?: string;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Returns file manifest spreadsheet.
|
|
22
25
|
* @param filters - Filters.
|
|
23
|
-
* @param disabled - Disabled.
|
|
24
26
|
* @returns file manifest spreadsheet.
|
|
25
27
|
*/
|
|
26
28
|
export const useFileManifestSpreadsheet = (
|
|
27
|
-
filters: Filters
|
|
28
|
-
|
|
29
|
-
): ManifestSpreadsheet | undefined => {
|
|
29
|
+
filters: Filters
|
|
30
|
+
): Omit<ManifestSpreadsheet, "fileUrl"> => {
|
|
30
31
|
// Determine catalog.
|
|
31
32
|
const catalog = useCatalog() as string; // catalog should be defined.
|
|
32
33
|
// Build request params.
|
|
@@ -34,20 +35,39 @@ export const useFileManifestSpreadsheet = (
|
|
|
34
35
|
// Build request URL.
|
|
35
36
|
const requestURL = useFetchRequestURL(APIEndpoints.FILES, requestParams);
|
|
36
37
|
// Fetch files to determine if file exists.
|
|
37
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
data: files,
|
|
40
|
+
isIdle,
|
|
41
|
+
isLoading: isFilesLoading,
|
|
42
|
+
run: requestFiles,
|
|
43
|
+
} = useAsync<AzulEntitiesResponse>();
|
|
44
|
+
|
|
38
45
|
// Grab manifest spreadsheet.
|
|
39
|
-
const
|
|
40
|
-
() => getManifestSpreadsheet(
|
|
41
|
-
[
|
|
46
|
+
const { fileName, fileUrl } = useMemo(
|
|
47
|
+
() => getManifestSpreadsheet(files?.hits),
|
|
48
|
+
[files]
|
|
42
49
|
);
|
|
43
50
|
|
|
51
|
+
// Fetch file manifest.
|
|
52
|
+
const { data, isLoading, run } = useRequestFileLocation(fileUrl);
|
|
53
|
+
|
|
44
54
|
// Fetch response from files endpoint.
|
|
55
|
+
const requestManifest = useCallback(() => {
|
|
56
|
+
requestFiles(fetchEntitiesFromURL(requestURL, undefined));
|
|
57
|
+
}, [requestFiles, requestURL]);
|
|
58
|
+
|
|
59
|
+
// Fetch file manifest.
|
|
45
60
|
useEffect(() => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [disabled, requestURL, run]);
|
|
61
|
+
run();
|
|
62
|
+
}, [fileUrl, run]);
|
|
49
63
|
|
|
50
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
fileName,
|
|
66
|
+
isIdle,
|
|
67
|
+
isLoading: isFilesLoading || isLoading,
|
|
68
|
+
requestManifest,
|
|
69
|
+
spreadsheetUrl: data?.location,
|
|
70
|
+
};
|
|
51
71
|
};
|
|
52
72
|
|
|
53
73
|
/**
|
|
@@ -74,21 +94,16 @@ function buildFetchFileUrl(fileUrl?: string): string | undefined {
|
|
|
74
94
|
*/
|
|
75
95
|
function getManifestSpreadsheet(
|
|
76
96
|
files?: AzulEntitiesResponse["hits"]
|
|
77
|
-
): ManifestSpreadsheet |
|
|
78
|
-
if (!files) {
|
|
79
|
-
|
|
80
|
-
}
|
|
97
|
+
): Pick<ManifestSpreadsheet, "fileName" | "fileUrl"> {
|
|
98
|
+
if (!files) return { fileName: undefined, fileUrl: undefined };
|
|
99
|
+
|
|
81
100
|
// Handle case where file does not exist.
|
|
82
|
-
if (files.length === 0) {
|
|
83
|
-
|
|
84
|
-
exists: false,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
101
|
+
if (files.length === 0) return { fileName: undefined, fileUrl: undefined };
|
|
102
|
+
|
|
87
103
|
// Project manifest spreadsheet exists.
|
|
88
104
|
const file = files[0];
|
|
105
|
+
|
|
89
106
|
return {
|
|
90
|
-
exists: true,
|
|
91
|
-
fileFormat: file.files[0]?.format,
|
|
92
107
|
fileName: file.files[0]?.name,
|
|
93
108
|
fileUrl: buildFetchFileUrl(file.files[0]?.url),
|
|
94
109
|
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
-
import { Attribute } from "../../../../../common/entities";
|
|
3
|
-
import { COLUMN_IDENTIFIER } from "./columnIdentifier";
|
|
4
|
-
import { AttributeValue } from "./types";
|
|
5
|
-
export declare const COLUMN_DEF: Record<keyof typeof COLUMN_IDENTIFIER, ColumnDef<Attribute, AttributeValue>>;
|
|
6
|
-
export declare const COLUMN_DEFS: ColumnDef<Attribute, AttributeValue>[];
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { BasicCell } from "../components/BasicCell/basicCell";
|
|
2
|
-
import { COLUMN_IDENTIFIER } from "./columnIdentifier";
|
|
3
|
-
const COLUMN_DEF_DESCRIPTION = {
|
|
4
|
-
accessorFn: (row) => row.description,
|
|
5
|
-
cell: (props) => BasicCell({ ...props }),
|
|
6
|
-
header: "Description",
|
|
7
|
-
id: COLUMN_IDENTIFIER.DESCRIPTION,
|
|
8
|
-
meta: { width: { max: "2fr", min: "480px" } },
|
|
9
|
-
};
|
|
10
|
-
const COLUMN_DEF_KEY = {
|
|
11
|
-
accessorFn: (row) => row.key,
|
|
12
|
-
cell: (props) => BasicCell({ ...props }),
|
|
13
|
-
header: "Key",
|
|
14
|
-
id: COLUMN_IDENTIFIER.KEY,
|
|
15
|
-
meta: { width: { max: "1fr", min: "180px" } },
|
|
16
|
-
};
|
|
17
|
-
const COLUMN_DEF_LABEL = {
|
|
18
|
-
accessorFn: (row) => row.label,
|
|
19
|
-
cell: (props) => BasicCell({ ...props }),
|
|
20
|
-
header: "Label",
|
|
21
|
-
id: COLUMN_IDENTIFIER.LABEL,
|
|
22
|
-
meta: { width: { max: "1fr", min: "200px" } },
|
|
23
|
-
};
|
|
24
|
-
export const COLUMN_DEF = {
|
|
25
|
-
DESCRIPTION: COLUMN_DEF_DESCRIPTION,
|
|
26
|
-
KEY: COLUMN_DEF_KEY,
|
|
27
|
-
LABEL: COLUMN_DEF_LABEL,
|
|
28
|
-
};
|
|
29
|
-
export const COLUMN_DEFS = [
|
|
30
|
-
COLUMN_DEF.LABEL,
|
|
31
|
-
COLUMN_DEF.KEY,
|
|
32
|
-
COLUMN_DEF.DESCRIPTION,
|
|
33
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Table } from "@tanstack/react-table";
|
|
3
|
-
import { ROW_DIRECTION } from "../../../../../Table/common/entities";
|
|
4
|
-
export interface TableBodyProps<T> {
|
|
5
|
-
rowDirection: ROW_DIRECTION;
|
|
6
|
-
tableInstance: Table<T>;
|
|
7
|
-
}
|
|
8
|
-
export declare const TableHead: <T extends object>({ rowDirection, tableInstance, }: TableBodyProps<T>) => JSX.Element;
|