@databiosphere/findable-ui 16.0.0 → 17.0.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 +18 -0
- package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.d.ts +3 -2
- package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.js +6 -4
- package/lib/components/Export/components/ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm.d.ts +3 -2
- package/lib/components/Export/components/ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm.js +2 -12
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.d.ts +5 -2
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.js +2 -2
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.d.ts +3 -1
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.js +2 -2
- package/lib/components/Export/components/ExportToTerra/exportToTerra.d.ts +1 -1
- package/lib/components/Export/components/ExportToTerra/exportToTerra.js +9 -6
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.d.ts +3 -1
- package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.js +3 -4
- package/lib/components/Export/components/ManifestDownload/manifestDownload.d.ts +3 -2
- package/lib/components/Export/components/ManifestDownload/manifestDownload.js +6 -4
- package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +4 -3
- package/lib/hooks/types.d.ts +4 -0
- package/lib/hooks/types.js +5 -0
- package/lib/hooks/useFileManifest/common/entities.d.ts +0 -5
- package/lib/hooks/useFileManifest/common/entities.js +0 -6
- package/lib/hooks/useFileManifest/useFileManifest.d.ts +8 -5
- package/lib/hooks/useFileManifest/useFileManifest.js +29 -8
- package/lib/hooks/useFileManifest/useFileManifestDownload.js +10 -9
- package/lib/hooks/useFileManifest/useFileManifestFormat.d.ts +12 -0
- package/lib/hooks/useFileManifest/useFileManifestFormat.js +10 -0
- package/lib/hooks/useRequestFileLocation.d.ts +1 -4
- package/lib/hooks/useRequestFileLocation.js +1 -5
- package/lib/hooks/useRequestManifest/constants.d.ts +2 -0
- package/lib/hooks/useRequestManifest/constants.js +4 -0
- package/lib/hooks/useRequestManifest/types.d.ts +6 -0
- package/lib/hooks/useRequestManifest/types.js +1 -0
- package/lib/hooks/useRequestManifest/useRequestManifest.d.ts +10 -0
- package/lib/hooks/useRequestManifest/useRequestManifest.js +30 -0
- package/lib/hooks/useRequestManifest/utils.d.ts +65 -0
- package/lib/hooks/useRequestManifest/utils.js +118 -0
- package/lib/mocks/useRequestFileManifest.mocks.d.ts +11 -0
- package/lib/mocks/useRequestFileManifest.mocks.js +100 -0
- package/lib/providers/fileManifestState/constants.d.ts +0 -2
- package/lib/providers/fileManifestState/constants.js +0 -11
- package/lib/providers/fileManifestState.d.ts +3 -25
- package/lib/providers/fileManifestState.js +3 -36
- package/lib/views/ExportView/exportView.js +2 -2
- package/package.json +1 -1
- package/src/components/Export/components/DownloadCurlCommand/downloadCurlCommand.tsx +17 -10
- package/src/components/Export/components/ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm.tsx +7 -16
- package/src/components/Export/components/ExportToTerra/components/ExportToTerraForm/exportToTerraForm.tsx +8 -4
- package/src/components/Export/components/ExportToTerra/components/ExportToTerraNotStarted/exportToTerraNotStarted.tsx +4 -1
- package/src/components/Export/components/ExportToTerra/exportToTerra.tsx +13 -9
- package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.tsx +4 -9
- package/src/components/Export/components/ManifestDownload/manifestDownload.tsx +17 -11
- package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +6 -3
- package/src/hooks/types.ts +4 -0
- package/src/hooks/useFileManifest/common/entities.ts +0 -6
- package/src/hooks/useFileManifest/useFileManifest.ts +34 -13
- package/src/hooks/useFileManifest/useFileManifestDownload.ts +21 -16
- package/src/hooks/useFileManifest/useFileManifestFormat.ts +23 -0
- package/src/hooks/useRequestFileLocation.ts +1 -5
- package/src/hooks/useRequestManifest/constants.ts +6 -0
- package/src/hooks/useRequestManifest/types.ts +7 -0
- package/src/hooks/useRequestManifest/useRequestManifest.ts +49 -0
- package/src/hooks/useRequestManifest/utils.ts +153 -0
- package/src/mocks/useRequestFileManifest.mocks.ts +121 -0
- package/src/providers/fileManifestState/constants.ts +0 -15
- package/src/providers/fileManifestState.tsx +5 -77
- package/src/views/ExportView/exportView.tsx +2 -2
- package/tests/buildRequestFilters.test.ts +68 -0
- package/tests/buildRequestManifest.test.ts +103 -0
- package/tests/useRequestManifest.test.ts +193 -0
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +0 -15
- package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +0 -28
- 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 -11
- package/lib/hooks/useFileManifest/useRequestFileManifest.js +0 -40
- package/lib/providers/fileManifestState/actions.d.ts +0 -9
- package/lib/providers/fileManifestState/actions.js +0 -19
- package/lib/providers/fileManifestState/utils.d.ts +0 -34
- package/lib/providers/fileManifestState/utils.js +0 -80
- package/src/hooks/useFileManifest/common/buildFileManifestRequestURL.ts +0 -44
- package/src/hooks/useFileManifest/useFileManifestURL.ts +0 -12
- package/src/hooks/useFileManifest/useRequestFileManifest.ts +0 -51
- package/src/providers/fileManifestState/actions.ts +0 -34
- package/src/providers/fileManifestState/utils.ts +0 -108
- package/tests/fileManifestRequestFilters.test.ts +0 -160
- package/tests/updateFilesFacetsStatus.test.ts +0 -84
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [17.0.0](https://github.com/DataBiosphere/findable-ui/compare/v16.1.0...v17.0.0) (2024-12-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* exports via main button don't include orphans ([#287](https://github.com/DataBiosphere/findable-ui/issues/287)) (#288)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* exports via main button don't include orphans ([#287](https://github.com/DataBiosphere/findable-ui/issues/287)) ([#288](https://github.com/DataBiosphere/findable-ui/issues/288)) ([86e3e40](https://github.com/DataBiosphere/findable-ui/commit/86e3e4047cce84a90348719c9ca7b41a3a93e4c3))
|
|
13
|
+
|
|
14
|
+
## [16.1.0](https://github.com/DataBiosphere/findable-ui/compare/v16.0.0...v16.1.0) (2024-12-12)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* allow url objects for explore links to have a path before the entity name ([#291](https://github.com/DataBiosphere/findable-ui/issues/291)) ([#292](https://github.com/DataBiosphere/findable-ui/issues/292)) ([aa63b5a](https://github.com/DataBiosphere/findable-ui/commit/aa63b5a11c79efa91360aaa6a0395810dd9e5c05))
|
|
20
|
+
|
|
3
21
|
## [16.0.0](https://github.com/DataBiosphere/findable-ui/compare/v15.0.2...v16.0.0) (2024-11-25)
|
|
4
22
|
|
|
5
23
|
|
|
@@ -2,7 +2,7 @@ import { ElementType } from "react";
|
|
|
2
2
|
import { Filters } from "../../../../common/entities";
|
|
3
3
|
import { FileManifestType } from "../../../../hooks/useFileManifest/common/entities";
|
|
4
4
|
import { FileManifestState } from "../../../../providers/fileManifestState";
|
|
5
|
-
import { FormFacet } from "../../common/entities";
|
|
5
|
+
import { FormFacet, ManifestDownloadFormat } from "../../common/entities";
|
|
6
6
|
interface DownloadCurlCommandProps {
|
|
7
7
|
DownloadCurlForm: ElementType;
|
|
8
8
|
DownloadCurlStart: ElementType;
|
|
@@ -12,6 +12,7 @@ interface DownloadCurlCommandProps {
|
|
|
12
12
|
fileSummaryFacetName: string;
|
|
13
13
|
filters: Filters;
|
|
14
14
|
formFacet: FormFacet;
|
|
15
|
+
manifestDownloadFormat?: ManifestDownloadFormat;
|
|
15
16
|
}
|
|
16
|
-
export declare const DownloadCurlCommand: ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState,
|
|
17
|
+
export declare const DownloadCurlCommand: ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, }: DownloadCurlCommandProps) => JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -2,16 +2,18 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { MANIFEST_DOWNLOAD_FORMAT } from "../../../../apis/azul/common/entities";
|
|
3
3
|
import { useExploreState } from "../../../../hooks/useExploreState";
|
|
4
4
|
import { useFileManifest } from "../../../../hooks/useFileManifest/useFileManifest";
|
|
5
|
-
import {
|
|
5
|
+
import { useRequestFileLocation, } from "../../../../hooks/useRequestFileLocation";
|
|
6
|
+
import { useRequestManifest } from "../../../../hooks/useRequestManifest/useRequestManifest";
|
|
6
7
|
import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT, } from "../../common/entities";
|
|
7
8
|
import { trackBulkDownloadRequested } from "../../common/tracking";
|
|
8
9
|
import { DownloadCurlCommandNotStarted } from "./components/DownloadCurlCommandNotStarted/downloadCurlCommandNotStarted";
|
|
9
10
|
import { DownloadCurlCommandReady } from "./components/DownloadCurlCommandReady/downloadCurlCommandReady";
|
|
10
|
-
export const DownloadCurlCommand = ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState,
|
|
11
|
-
|
|
11
|
+
export const DownloadCurlCommand = ({ DownloadCurlForm, DownloadCurlStart, DownloadCurlSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat = MANIFEST_DOWNLOAD_FORMAT.CURL, }) => {
|
|
12
|
+
useFileManifest(filters, fileSummaryFacetName);
|
|
12
13
|
const [executionEnvironment, setExecutionEnvironment] = useState(BULK_DOWNLOAD_EXECUTION_ENVIRONMENT.BASH);
|
|
13
14
|
const { exploreState: { tabValue: entityList }, } = useExploreState();
|
|
14
|
-
const {
|
|
15
|
+
const { requestMethod, requestUrl } = useRequestManifest(manifestDownloadFormat, formFacet);
|
|
16
|
+
const { data, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
|
|
15
17
|
const curlCommand = getBulkDownloadCurlCommand(data, executionEnvironment);
|
|
16
18
|
return curlCommand ? (React.createElement(DownloadCurlCommandReady, { curlCommand: curlCommand, DownloadCurlSuccess: DownloadCurlSuccess })) : (React.createElement(DownloadCurlCommandNotStarted, { DownloadCurlForm: DownloadCurlForm, DownloadCurlStart: DownloadCurlStart, executionEnvironment: executionEnvironment, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, onRequestManifest: () => {
|
|
17
19
|
// Execute GTM tracking.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { FileManifestFormatState } from "../../../../../../hooks/useFileManifest/useFileManifestFormat";
|
|
1
2
|
import { ManifestDownloadFormat } from "../../../../common/entities";
|
|
2
3
|
export interface ExportManifestDownloadFormatFormProps {
|
|
3
|
-
|
|
4
|
+
fileManifestFormatState: FileManifestFormatState;
|
|
4
5
|
manifestDownloadFormats: ManifestDownloadFormat[];
|
|
5
6
|
}
|
|
6
|
-
export declare const ExportManifestDownloadFormatForm: ({
|
|
7
|
+
export declare const ExportManifestDownloadFormatForm: ({ fileManifestFormatState, manifestDownloadFormats, }: ExportManifestDownloadFormatFormProps) => JSX.Element;
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { FormControlLabel, FormLabel, Radio, RadioGroup } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { useFileManifestState } from "../../../../../../hooks/useFileManifestState";
|
|
4
|
-
import { FileManifestActionKind } from "../../../../../../providers/fileManifestState";
|
|
5
3
|
import { RadioCheckedIcon } from "../../../../../common/CustomIcon/components/RadioCheckedIcon/radioCheckedIcon";
|
|
6
4
|
import { RadioUncheckedIcon } from "../../../../../common/CustomIcon/components/RadioUncheckedIcon/radioUncheckedIcon";
|
|
7
5
|
import { FormControl } from "../../exportForm.styles";
|
|
8
|
-
export const ExportManifestDownloadFormatForm = ({
|
|
9
|
-
const { fileManifestDispatch } = useFileManifestState();
|
|
10
|
-
// Updates file manifest format state.
|
|
11
|
-
const onUpdateManifestFormat = (format) => {
|
|
12
|
-
fileManifestDispatch({
|
|
13
|
-
payload: format,
|
|
14
|
-
type: FileManifestActionKind.UpdateFileManifestFormat,
|
|
15
|
-
});
|
|
16
|
-
};
|
|
6
|
+
export const ExportManifestDownloadFormatForm = ({ fileManifestFormatState, manifestDownloadFormats, }) => {
|
|
17
7
|
return (React.createElement(FormControl, null,
|
|
18
8
|
React.createElement(FormLabel, null, "Download Format"),
|
|
19
|
-
React.createElement(RadioGroup, { value:
|
|
9
|
+
React.createElement(RadioGroup, { value: fileManifestFormatState.fileManifestFormat ?? "" }, manifestDownloadFormats.map((manifestFormat) => (React.createElement(FormControlLabel, { control: React.createElement(Radio, { checkedIcon: React.createElement(RadioCheckedIcon, null), icon: React.createElement(RadioUncheckedIcon, null), onChange: () => fileManifestFormatState.setFileManifestFormat(manifestFormat), size: "small", value: manifestFormat }), key: manifestFormat, label: manifestFormat }))))));
|
|
20
10
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { FileManifestFormatState } from "../../../../../../hooks/useFileManifest/useFileManifestFormat";
|
|
1
3
|
import { FormFacet, ManifestDownloadFormat } from "../../../../common/entities";
|
|
2
4
|
import { OnRequestManifestFn } from "../../../ExportForm/exportForm";
|
|
3
5
|
export interface ExportToTerraFormProps {
|
|
6
|
+
fileManifestFormatState: FileManifestFormatState;
|
|
4
7
|
formFacet: FormFacet;
|
|
5
8
|
isLoading: boolean;
|
|
6
|
-
manifestDownloadFormat?: ManifestDownloadFormat;
|
|
7
9
|
manifestDownloadFormats: ManifestDownloadFormat[];
|
|
8
10
|
onRequestManifest: OnRequestManifestFn;
|
|
11
|
+
setFileManifestFormat: Dispatch<SetStateAction<ManifestDownloadFormat | undefined>>;
|
|
9
12
|
}
|
|
10
|
-
export declare const ExportToTerraForm: ({ formFacet, isLoading,
|
|
13
|
+
export declare const ExportToTerraForm: ({ fileManifestFormatState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }: ExportToTerraFormProps) => JSX.Element;
|
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { ExportButton } from "../../../ExportForm/components/ExportButton/exportButton";
|
|
3
3
|
import { ExportManifestDownloadFormatForm } from "../../../ExportForm/components/ExportManifestDownloadFormatForm/exportManifestDownloadFormatForm";
|
|
4
4
|
import { ExportForm, } from "../../../ExportForm/exportForm";
|
|
5
|
-
export const ExportToTerraForm = ({ formFacet, isLoading,
|
|
5
|
+
export const ExportToTerraForm = ({ fileManifestFormatState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }) => {
|
|
6
6
|
return (React.createElement(ExportForm, { Button: renderButton, formFacet: formFacet, isLoading: isLoading, onRequestManifest: onRequestManifest },
|
|
7
|
-
React.createElement(ExportManifestDownloadFormatForm, {
|
|
7
|
+
React.createElement(ExportManifestDownloadFormatForm, { fileManifestFormatState: fileManifestFormatState, manifestDownloadFormats: manifestDownloadFormats })));
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Build the export button.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ElementType } from "react";
|
|
2
|
+
import { FileManifestFormatState } from "../../../../../../hooks/useFileManifest/useFileManifestFormat";
|
|
2
3
|
import { FileManifestState } from "../../../../../../providers/fileManifestState";
|
|
3
4
|
import { FormFacet, ManifestDownloadFormat } from "../../../../common/entities";
|
|
4
5
|
import { OnRequestManifestFn } from "../../../ExportForm/exportForm";
|
|
5
6
|
export interface ExportToTerraNotStartedProps {
|
|
6
7
|
ExportTerraForm: ElementType;
|
|
7
8
|
ExportToTerraStart: ElementType;
|
|
9
|
+
fileManifestFormatState: FileManifestFormatState;
|
|
8
10
|
fileManifestState: FileManifestState;
|
|
9
11
|
formFacet: FormFacet;
|
|
10
12
|
isLoading: boolean;
|
|
11
13
|
manifestDownloadFormats: ManifestDownloadFormat[];
|
|
12
14
|
onRequestManifest: OnRequestManifestFn;
|
|
13
15
|
}
|
|
14
|
-
export declare const ExportToTerraNotStarted: ({ ExportTerraForm, ExportToTerraStart, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }: ExportToTerraNotStartedProps) => JSX.Element;
|
|
16
|
+
export declare const ExportToTerraNotStarted: ({ ExportTerraForm, ExportToTerraStart, fileManifestFormatState, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }: ExportToTerraNotStartedProps) => JSX.Element;
|
|
@@ -3,12 +3,12 @@ import { PAPER_PANEL_STYLE } from "../../../../../common/Paper/paper";
|
|
|
3
3
|
import { FluidPaper } from "../../../../../common/Paper/paper.styles";
|
|
4
4
|
import { Loading } from "../../../../../Loading/loading";
|
|
5
5
|
import { Section, SectionContent } from "../../../../export.styles";
|
|
6
|
-
export const ExportToTerraNotStarted = ({ ExportTerraForm, ExportToTerraStart, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }) => {
|
|
6
|
+
export const ExportToTerraNotStarted = ({ ExportTerraForm, ExportToTerraStart, fileManifestFormatState, fileManifestState, formFacet, isLoading, manifestDownloadFormats, onRequestManifest, }) => {
|
|
7
7
|
return (React.createElement("div", null,
|
|
8
8
|
React.createElement(Loading, { loading: isLoading, panelStyle: PAPER_PANEL_STYLE.FLUID, text: "Your link will be ready shortly..." }),
|
|
9
9
|
React.createElement(FluidPaper, null,
|
|
10
10
|
React.createElement(Section, null,
|
|
11
11
|
React.createElement(SectionContent, null,
|
|
12
12
|
React.createElement(ExportToTerraStart, null)),
|
|
13
|
-
React.createElement(ExportTerraForm, { formFacet: formFacet, isLoading: fileManifestState.isLoading,
|
|
13
|
+
React.createElement(ExportTerraForm, { fileManifestFormatState: fileManifestFormatState, formFacet: formFacet, isLoading: fileManifestState.isLoading, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: onRequestManifest })))));
|
|
14
14
|
};
|
|
@@ -15,4 +15,4 @@ export interface ExportToTerraProps {
|
|
|
15
15
|
manifestDownloadFormat?: ManifestDownloadFormat;
|
|
16
16
|
manifestDownloadFormats: ManifestDownloadFormat[];
|
|
17
17
|
}
|
|
18
|
-
export declare const ExportToTerra: ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState,
|
|
18
|
+
export declare const ExportToTerra: ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, manifestDownloadFormats, }: ExportToTerraProps) => JSX.Element;
|
|
@@ -2,17 +2,20 @@ import React from "react";
|
|
|
2
2
|
import { useExploreState } from "../../../../hooks/useExploreState";
|
|
3
3
|
import { useExportToTerraResponseURL } from "../../../../hooks/useExportToTerraResponseURL";
|
|
4
4
|
import { useFileManifest } from "../../../../hooks/useFileManifest/useFileManifest";
|
|
5
|
-
import {
|
|
5
|
+
import { useFileManifestFormat } from "../../../../hooks/useFileManifest/useFileManifestFormat";
|
|
6
|
+
import { useRequestFileLocation } from "../../../../hooks/useRequestFileLocation";
|
|
7
|
+
import { useRequestManifest } from "../../../../hooks/useRequestManifest/useRequestManifest";
|
|
6
8
|
import { trackExportToTerraRequested } from "../../common/tracking";
|
|
7
9
|
import { ExportToTerraNotStarted } from "./components/ExportToTerraNotStarted/exportToTerraNotStarted";
|
|
8
10
|
import { ExportToTerraReady } from "./components/ExportToTerraReady/exportToTerraReady";
|
|
9
|
-
export const ExportToTerra = ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState,
|
|
11
|
+
export const ExportToTerra = ({ ExportForm, ExportToTerraStart, ExportToTerraSuccess, fileManifestState, fileSummaryFacetName, filters, formFacet, manifestDownloadFormat, manifestDownloadFormats, }) => {
|
|
10
12
|
const { exploreState: { tabValue: entityList }, } = useExploreState();
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
13
|
+
useFileManifest(filters, fileSummaryFacetName);
|
|
14
|
+
const fileManifestFormatState = useFileManifestFormat(manifestDownloadFormat);
|
|
15
|
+
const { requestMethod, requestParams, requestUrl } = useRequestManifest(fileManifestFormatState.fileManifestFormat, formFacet);
|
|
16
|
+
const { data, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
|
|
14
17
|
const exportURL = useExportToTerraResponseURL(requestParams, data);
|
|
15
|
-
return exportURL ? (React.createElement(ExportToTerraReady, { ExportToTerraSuccess: ExportToTerraSuccess, exportURL: exportURL })) : (React.createElement(ExportToTerraNotStarted, { ExportTerraForm: ExportForm, ExportToTerraStart: ExportToTerraStart, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: () => {
|
|
18
|
+
return exportURL ? (React.createElement(ExportToTerraReady, { ExportToTerraSuccess: ExportToTerraSuccess, exportURL: exportURL })) : (React.createElement(ExportToTerraNotStarted, { ExportTerraForm: ExportForm, ExportToTerraStart: ExportToTerraStart, fileManifestFormatState: fileManifestFormatState, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, manifestDownloadFormats: manifestDownloadFormats, onRequestManifest: () => {
|
|
16
19
|
// Execute GA tracking
|
|
17
20
|
trackExportToTerraRequested(entityList);
|
|
18
21
|
// Request manifest
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Filters } from "../../../../../../common/entities";
|
|
2
2
|
import { FileManifestType } from "../../../../../../hooks/useFileManifest/common/entities";
|
|
3
|
+
import { ManifestDownloadFormat } from "../../../../common/entities";
|
|
3
4
|
export interface ManifestDownloadEntityProps {
|
|
4
5
|
fileManifestType: FileManifestType;
|
|
5
6
|
filters: Filters;
|
|
7
|
+
manifestDownloadFormat?: ManifestDownloadFormat;
|
|
6
8
|
metadataFilters: Filters;
|
|
7
9
|
}
|
|
8
|
-
export declare const ManifestDownloadEntity: ({
|
|
10
|
+
export declare const ManifestDownloadEntity: ({ filters, metadataFilters, }: ManifestDownloadEntityProps) => JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { useRequestFileManifest } from "../../../../../../hooks/useFileManifest/useRequestFileManifest";
|
|
2
|
+
import { useFileManifest } from "../../../../../../hooks/useFileManifest/useFileManifest";
|
|
4
3
|
import { FileManifestDownload } from "./components/FileManifestDownload/fileManifestDownload";
|
|
5
4
|
import { FileManifestSpreadsheet } from "./components/FileManifestSpreadsheet/fileManifestSpreadsheet";
|
|
6
|
-
export const ManifestDownloadEntity = ({
|
|
7
|
-
|
|
5
|
+
export const ManifestDownloadEntity = ({ filters, metadataFilters, }) => {
|
|
6
|
+
useFileManifest(filters, undefined);
|
|
8
7
|
return (React.createElement(React.Fragment, null,
|
|
9
8
|
React.createElement(FileManifestSpreadsheet, { filters: metadataFilters }),
|
|
10
9
|
React.createElement(FileManifestDownload, { filters: filters })));
|
|
@@ -2,7 +2,7 @@ import { ElementType } from "react";
|
|
|
2
2
|
import { Filters } from "../../../../common/entities";
|
|
3
3
|
import { FileManifestType } from "../../../../hooks/useFileManifest/common/entities";
|
|
4
4
|
import { FileManifestState } from "../../../../providers/fileManifestState";
|
|
5
|
-
import { FormFacet } from "../../common/entities";
|
|
5
|
+
import { FormFacet, ManifestDownloadFormat } from "../../common/entities";
|
|
6
6
|
export interface ManifestDownloadProps {
|
|
7
7
|
fileManifestState: FileManifestState;
|
|
8
8
|
fileManifestType: FileManifestType;
|
|
@@ -10,7 +10,8 @@ export interface ManifestDownloadProps {
|
|
|
10
10
|
filters: Filters;
|
|
11
11
|
formFacet: FormFacet;
|
|
12
12
|
ManifestDownloadForm: ElementType;
|
|
13
|
+
manifestDownloadFormat?: ManifestDownloadFormat;
|
|
13
14
|
ManifestDownloadStart: ElementType;
|
|
14
15
|
ManifestDownloadSuccess: ElementType;
|
|
15
16
|
}
|
|
16
|
-
export declare const ManifestDownload: ({ fileManifestState,
|
|
17
|
+
export declare const ManifestDownload: ({ fileManifestState, fileSummaryFacetName, filters, formFacet, ManifestDownloadForm, manifestDownloadFormat, ManifestDownloadStart, ManifestDownloadSuccess, }: ManifestDownloadProps) => JSX.Element;
|
|
@@ -2,14 +2,16 @@ import React from "react";
|
|
|
2
2
|
import { MANIFEST_DOWNLOAD_FORMAT } from "../../../../apis/azul/common/entities";
|
|
3
3
|
import { useExploreState } from "../../../../hooks/useExploreState";
|
|
4
4
|
import { useFileManifest } from "../../../../hooks/useFileManifest/useFileManifest";
|
|
5
|
-
import {
|
|
5
|
+
import { useRequestFileLocation, } from "../../../../hooks/useRequestFileLocation";
|
|
6
|
+
import { useRequestManifest } from "../../../../hooks/useRequestManifest/useRequestManifest";
|
|
6
7
|
import { trackFileManifestRequested } from "../../common/tracking";
|
|
7
8
|
import { ManifestDownloadNotStarted } from "./components/ManifestDownloadNotStarted/manifestDownloadNotStarted";
|
|
8
9
|
import { ManifestDownloadReady } from "./components/ManifestDownloadReady/manifestDownloadReady";
|
|
9
|
-
export const ManifestDownload = ({ fileManifestState,
|
|
10
|
-
|
|
10
|
+
export const ManifestDownload = ({ fileManifestState, fileSummaryFacetName, filters, formFacet, ManifestDownloadForm, manifestDownloadFormat = MANIFEST_DOWNLOAD_FORMAT.COMPACT, ManifestDownloadStart, ManifestDownloadSuccess, }) => {
|
|
11
|
+
useFileManifest(filters, fileSummaryFacetName);
|
|
11
12
|
const { exploreState: { tabValue: entityList }, } = useExploreState();
|
|
12
|
-
const {
|
|
13
|
+
const { requestMethod, requestUrl } = useRequestManifest(manifestDownloadFormat, formFacet);
|
|
14
|
+
const { data, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
|
|
13
15
|
const manifestURL = getManifestDownloadURL(data);
|
|
14
16
|
return manifestURL ? (React.createElement(ManifestDownloadReady, { ManifestDownloadSuccess: ManifestDownloadSuccess, manifestURL: manifestURL })) : (React.createElement(ManifestDownloadNotStarted, { ManifestDownloadForm: ManifestDownloadForm, ManifestDownloadStart: ManifestDownloadStart, fileManifestState: fileManifestState, formFacet: formFacet, isLoading: isLoading, onRequestManifest: () => {
|
|
15
17
|
trackFileManifestRequested(entityList);
|
|
@@ -28,7 +28,7 @@ export const ExploreViewLink = ({ className, label, onClick, target = ANCHOR_TAR
|
|
|
28
28
|
* @returns entity list type.
|
|
29
29
|
*/
|
|
30
30
|
function getEntityListType(href) {
|
|
31
|
-
return href.substring(1);
|
|
31
|
+
return href.substring(href.lastIndexOf("/") + 1);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Returns the selected filters from the given query.
|
|
@@ -87,7 +87,7 @@ function isValidExploreURL(url, exploreState) {
|
|
|
87
87
|
return validHref && validQuery;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* Returns true if the given href is a configured key in the explore state's entityPageState.
|
|
90
|
+
* Returns true if the given href is a path ending with a configured key in the explore state's entityPageState.
|
|
91
91
|
* @param url - Explore link URL.
|
|
92
92
|
* @param exploreState - Explore state.
|
|
93
93
|
* @returns true if the given href is configured in the explore state.
|
|
@@ -95,7 +95,8 @@ function isValidExploreURL(url, exploreState) {
|
|
|
95
95
|
function isValidHref(url, exploreState) {
|
|
96
96
|
const { entityPageState } = exploreState;
|
|
97
97
|
const { href } = url;
|
|
98
|
-
return href.startsWith("/") &&
|
|
98
|
+
return (href.startsWith("/") &&
|
|
99
|
+
href.substring(href.lastIndexOf("/") + 1) in entityPageState);
|
|
99
100
|
}
|
|
100
101
|
/**
|
|
101
102
|
* Returns true if the given explore query is valid.
|
|
@@ -38,11 +38,6 @@ export declare enum FILE_MANIFEST_TYPE {
|
|
|
38
38
|
EXPORT_TO_TERRA = "EXPORT_TO_TERRA"
|
|
39
39
|
}
|
|
40
40
|
export type FileManifestType = FILE_MANIFEST_TYPE;
|
|
41
|
-
export declare enum FILES_FACETS_STATUS {
|
|
42
|
-
COMPLETED = "COMPLETED",
|
|
43
|
-
IN_PROGRESS = "IN_PROGRESS",
|
|
44
|
-
NOT_STARTED = "NOT_STARTED"
|
|
45
|
-
}
|
|
46
41
|
export type SelectedSearchTermsBySearchKey = Map<CategoryKey, Set<CategoryValueKey>>;
|
|
47
42
|
/**
|
|
48
43
|
* Model of an individual facet value. For example, the term "Homo Sapiens" contained in the facet "Species".
|
|
@@ -7,9 +7,3 @@ export var FILE_MANIFEST_TYPE;
|
|
|
7
7
|
FILE_MANIFEST_TYPE["ENTITY_EXPORT_TO_TERRA"] = "ENTITY_EXPORT_TO_TERRA";
|
|
8
8
|
FILE_MANIFEST_TYPE["EXPORT_TO_TERRA"] = "EXPORT_TO_TERRA";
|
|
9
9
|
})(FILE_MANIFEST_TYPE || (FILE_MANIFEST_TYPE = {}));
|
|
10
|
-
export var FILES_FACETS_STATUS;
|
|
11
|
-
(function (FILES_FACETS_STATUS) {
|
|
12
|
-
FILES_FACETS_STATUS["COMPLETED"] = "COMPLETED";
|
|
13
|
-
FILES_FACETS_STATUS["IN_PROGRESS"] = "IN_PROGRESS";
|
|
14
|
-
FILES_FACETS_STATUS["NOT_STARTED"] = "NOT_STARTED";
|
|
15
|
-
})(FILES_FACETS_STATUS || (FILES_FACETS_STATUS = {}));
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Filters } from "../../common/entities";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Initializes the file manifest with specified filters and a file summary facet name.
|
|
4
|
+
* This hook sets up the file manifest state by dispatching an action to fetch the manifest
|
|
5
|
+
* based on the provided initial filters and file summary facet name. It also ensures that
|
|
6
|
+
* the manifest state is cleared when the component is unmounted.
|
|
7
|
+
* @param initialFilters - The initial filters used to fetch the file manifest.
|
|
8
|
+
* @param fileSummaryFacetName - The name of the file summary facet to be used in the file manifest request.
|
|
6
9
|
*/
|
|
7
|
-
export declare const useFileManifest: (
|
|
10
|
+
export declare const useFileManifest: (initialFilters?: Filters | undefined, fileSummaryFacetName?: string) => void;
|
|
@@ -1,12 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { FileManifestActionKind } from "../../providers/fileManifestState";
|
|
1
3
|
import { useFileManifestState } from "../useFileManifestState";
|
|
2
|
-
import { METHOD, useRequestFileLocation, } from "../useRequestFileLocation";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Initializes the file manifest with specified filters and a file summary facet name.
|
|
6
|
+
* This hook sets up the file manifest state by dispatching an action to fetch the manifest
|
|
7
|
+
* based on the provided initial filters and file summary facet name. It also ensures that
|
|
8
|
+
* the manifest state is cleared when the component is unmounted.
|
|
9
|
+
* @param initialFilters - The initial filters used to fetch the file manifest.
|
|
10
|
+
* @param fileSummaryFacetName - The name of the file summary facet to be used in the file manifest request.
|
|
7
11
|
*/
|
|
8
|
-
export const useFileManifest = (
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
+
export const useFileManifest = (initialFilters = [], fileSummaryFacetName) => {
|
|
13
|
+
// Initial file manifest filter.
|
|
14
|
+
const [initFilters] = useState(() => initialFilters);
|
|
15
|
+
// File manifest state.
|
|
16
|
+
const { fileManifestDispatch } = useFileManifestState();
|
|
17
|
+
// Fetches file manifest with the given file manifest filters, format.
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
fileManifestDispatch({
|
|
20
|
+
payload: {
|
|
21
|
+
fileSummaryFacetName,
|
|
22
|
+
filters: initFilters,
|
|
23
|
+
},
|
|
24
|
+
type: FileManifestActionKind.FetchFileManifest,
|
|
25
|
+
});
|
|
26
|
+
return () => {
|
|
27
|
+
fileManifestDispatch({
|
|
28
|
+
payload: undefined,
|
|
29
|
+
type: FileManifestActionKind.ClearFileManifest,
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
}, [fileManifestDispatch, fileSummaryFacetName, initFilters]);
|
|
12
33
|
};
|
|
@@ -2,9 +2,9 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { MANIFEST_DOWNLOAD_FORMAT } from "../../apis/azul/common/entities";
|
|
3
3
|
import { BULK_DOWNLOAD_EXECUTION_ENVIRONMENT } from "../../components/Export/common/entities";
|
|
4
4
|
import { useCatalog } from "../useCatalog";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useConfig } from "../useConfig";
|
|
6
|
+
import { useRequestFileLocation, } from "../useRequestFileLocation";
|
|
7
|
+
import { buildRequestManifest } from "../useRequestManifest/utils";
|
|
8
8
|
/**
|
|
9
9
|
* Returns file manifest download url and file name.
|
|
10
10
|
* @param filters - Filters.
|
|
@@ -12,13 +12,14 @@ import { useFileManifestURL } from "./useFileManifestURL";
|
|
|
12
12
|
* @returns file manifest download url and file name.
|
|
13
13
|
*/
|
|
14
14
|
export const useFileManifestDownload = (filters, disabled) => {
|
|
15
|
-
//
|
|
16
|
-
const
|
|
15
|
+
// Retrieve the endpoint URL from configured data source.
|
|
16
|
+
const config = useConfig();
|
|
17
|
+
const endpointUrl = config.config.dataSource.url;
|
|
17
18
|
// Determine catalog.
|
|
18
19
|
const catalog = useCatalog(); // catalog should be defined.
|
|
19
|
-
// Build request URL.
|
|
20
|
-
const {
|
|
21
|
-
const { data, isIdle, isLoading, run } =
|
|
20
|
+
// Build request manifest request URL.
|
|
21
|
+
const { requestMethod, requestUrl } = buildRequestManifest(endpointUrl, catalog, filters, MANIFEST_DOWNLOAD_FORMAT.COMPACT);
|
|
22
|
+
const { data, isIdle, isLoading, run } = useRequestFileLocation(requestUrl, requestMethod);
|
|
22
23
|
const manifestURL = getManifestDownloadURL(data);
|
|
23
24
|
const fileName = getManifestDownloadFileName(data);
|
|
24
25
|
// Requests file manifest.
|
|
@@ -26,7 +27,7 @@ export const useFileManifestDownload = (filters, disabled) => {
|
|
|
26
27
|
if (disabled)
|
|
27
28
|
return;
|
|
28
29
|
run();
|
|
29
|
-
}, [disabled,
|
|
30
|
+
}, [disabled, requestUrl, run]);
|
|
30
31
|
return {
|
|
31
32
|
fileName,
|
|
32
33
|
isIdle,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { ManifestDownloadFormat } from "../../components/Export/common/entities";
|
|
3
|
+
export interface FileManifestFormatState {
|
|
4
|
+
fileManifestFormat: ManifestDownloadFormat | undefined;
|
|
5
|
+
setFileManifestFormat: Dispatch<SetStateAction<ManifestDownloadFormat | undefined>>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Facilitates the management of file manifest format state.
|
|
9
|
+
* @param manifestDownloadFormat - The initial manifest download format used to fetch the file manifest.
|
|
10
|
+
* @returns The file manifest format state and a function to set the file manifest format.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useFileManifestFormat: (manifestDownloadFormat?: ManifestDownloadFormat) => FileManifestFormatState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Facilitates the management of file manifest format state.
|
|
4
|
+
* @param manifestDownloadFormat - The initial manifest download format used to fetch the file manifest.
|
|
5
|
+
* @returns The file manifest format state and a function to set the file manifest format.
|
|
6
|
+
*/
|
|
7
|
+
export const useFileManifestFormat = (manifestDownloadFormat) => {
|
|
8
|
+
const [fileManifestFormat, setFileManifestFormat] = useState(manifestDownloadFormat);
|
|
9
|
+
return { fileManifestFormat, setFileManifestFormat };
|
|
10
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { METHOD } from "./types";
|
|
1
2
|
export interface FileLocation {
|
|
2
3
|
commandLine?: {
|
|
3
4
|
[key: string]: string;
|
|
@@ -14,10 +15,6 @@ export interface UseRequestFileLocationResult {
|
|
|
14
15
|
run: () => void;
|
|
15
16
|
}
|
|
16
17
|
export type Method = METHOD;
|
|
17
|
-
export declare enum METHOD {
|
|
18
|
-
GET = "GET",
|
|
19
|
-
PUT = "PUT"
|
|
20
|
-
}
|
|
21
18
|
/**
|
|
22
19
|
* Function to make a get request and map the result to camelCase
|
|
23
20
|
* @param url - url for the get request
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from "react";
|
|
2
2
|
import { FILE_LOCATION_PENDING, FILE_LOCATION_SUCCESSFULLY, } from "../apis/azul/common/constants";
|
|
3
|
+
import { METHOD } from "./types";
|
|
3
4
|
import { useAsync } from "./useAsync";
|
|
4
5
|
import { useAuthentication } from "./useAuthentication/useAuthentication";
|
|
5
|
-
export var METHOD;
|
|
6
|
-
(function (METHOD) {
|
|
7
|
-
METHOD["GET"] = "GET";
|
|
8
|
-
METHOD["PUT"] = "PUT";
|
|
9
|
-
})(METHOD || (METHOD = {}));
|
|
10
6
|
/**
|
|
11
7
|
* Returns fetch request options.
|
|
12
8
|
* @param accessToken - Access token.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ManifestDownloadFormat } from "../../apis/azul/common/entities";
|
|
2
|
+
import { FormFacet } from "../../components/Export/common/entities";
|
|
3
|
+
import { UseRequestManifest } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Returns file manifest request method, params and URL.
|
|
6
|
+
* @param fileManifestFormat - File manifest format.
|
|
7
|
+
* @param formFacet - Object containing form related facets.
|
|
8
|
+
* @returns file manifest request method, params and URL.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useRequestManifest: (fileManifestFormat: ManifestDownloadFormat | undefined, formFacet: FormFacet) => UseRequestManifest;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useCatalog } from "../useCatalog";
|
|
2
|
+
import { useConfig } from "../useConfig";
|
|
3
|
+
import { useFileManifestState } from "../useFileManifestState";
|
|
4
|
+
import { REQUEST_MANIFEST } from "./constants";
|
|
5
|
+
import { buildRequestFilters, buildRequestManifest, isCatalogReady, isFileManifestFormatReady, isFileManifestStateReady, isFormSelectionReady, } from "./utils";
|
|
6
|
+
/**
|
|
7
|
+
* Returns file manifest request method, params and URL.
|
|
8
|
+
* @param fileManifestFormat - File manifest format.
|
|
9
|
+
* @param formFacet - Object containing form related facets.
|
|
10
|
+
* @returns file manifest request method, params and URL.
|
|
11
|
+
*/
|
|
12
|
+
export const useRequestManifest = (fileManifestFormat, formFacet) => {
|
|
13
|
+
// Retrieve the endpoint URL from configured data source.
|
|
14
|
+
const config = useConfig();
|
|
15
|
+
const endpointUrl = config.config.dataSource.url;
|
|
16
|
+
// Determine catalog.
|
|
17
|
+
const catalog = useCatalog();
|
|
18
|
+
// Retrieve file manifest state.
|
|
19
|
+
const { fileManifestState } = useFileManifestState();
|
|
20
|
+
// Return file manifest request method etc. when conditions are met.
|
|
21
|
+
if (isCatalogReady(catalog) &&
|
|
22
|
+
isFileManifestFormatReady(fileManifestFormat) &&
|
|
23
|
+
isFileManifestStateReady(fileManifestState) &&
|
|
24
|
+
isFormSelectionReady(formFacet)) {
|
|
25
|
+
return buildRequestManifest(endpointUrl, catalog, // Catalog is defined.
|
|
26
|
+
buildRequestFilters(fileManifestState, formFacet), fileManifestFormat // Manifest format is defined.
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return REQUEST_MANIFEST;
|
|
30
|
+
};
|