Skip to content

Commit 690d1bb

Browse files
Fran McDadeFran McDade
Fran McDade
authored and
Fran McDade
committed
feat: use verbatim.pfb manifest format for exports to terra in anvil (#4015)
1 parent 9865f56 commit 690d1bb

File tree

4 files changed

+51
-12
lines changed

4 files changed

+51
-12
lines changed

explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts

+40-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
LABEL,
3+
ManifestDownloadFormat,
34
MANIFEST_DOWNLOAD_FORMAT,
45
} from "@databiosphere/findable-ui/lib/apis/azul/common/entities";
56
import {
@@ -100,6 +101,7 @@ import * as C from "../../../../components";
100101
import * as MDX from "../../../../components/common/MDXContent/anvil-cmg";
101102
import { METADATA_KEY } from "../../../../components/Index/common/entities";
102103
import { getPluralizedMetadataLabel } from "../../../../components/Index/common/indexTransformer";
104+
import { FEATURE_FLAGS } from "../../../common/contants";
103105
import { Unused } from "../../../common/entities";
104106
import { SUMMARY_DISPLAY_TEXT } from "./summaryMapper/constants";
105107
import { mapExportSummary } from "./summaryMapper/summaryMapper";
@@ -430,8 +432,9 @@ export const buildExportEntityToTerra = (
430432
fileSummaryFacetName: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_FORMAT,
431433
filters,
432434
formFacet,
433-
manifestDownloadFormat: MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB,
434-
manifestDownloadFormats: [MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB],
435+
manifestDownloadFormat: getExportToTerraManifestDownloadFormat(viewContext),
436+
manifestDownloadFormats:
437+
getExportToTerraManifestDownloadFormats(viewContext),
435438
};
436439
};
437440

@@ -573,8 +576,9 @@ export const buildExportToTerra = (
573576
fileSummaryFacetName: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_FORMAT,
574577
filters: filterState,
575578
formFacet,
576-
manifestDownloadFormat: MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB,
577-
manifestDownloadFormats: [MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB],
579+
manifestDownloadFormat: getExportToTerraManifestDownloadFormat(viewContext),
580+
manifestDownloadFormats:
581+
getExportToTerraManifestDownloadFormats(viewContext),
578582
};
579583
};
580584

@@ -961,6 +965,38 @@ export function getExportSelectedDataSummary(
961965
]);
962966
}
963967

968+
/**
969+
* Returns export to terra manifest download format.
970+
* @param viewContext - View context.
971+
* @returns manifest download format.
972+
*/
973+
function getExportToTerraManifestDownloadFormat(
974+
viewContext: ViewContext
975+
): ManifestDownloadFormat | undefined {
976+
const { exploreState } = viewContext;
977+
const { featureFlagState } = exploreState;
978+
if (featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)) {
979+
return MANIFEST_DOWNLOAD_FORMAT.VERBATIM_PFB;
980+
}
981+
return MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB;
982+
}
983+
984+
/**
985+
* Returns export to terra manifest download formats.
986+
* @param viewContext - View context.
987+
* @returns manifest download formats.
988+
*/
989+
function getExportToTerraManifestDownloadFormats(
990+
viewContext: ViewContext
991+
): ManifestDownloadFormat[] {
992+
const { exploreState } = viewContext;
993+
const { featureFlagState } = exploreState;
994+
if (featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)) {
995+
return [MANIFEST_DOWNLOAD_FORMAT.VERBATIM_PFB];
996+
}
997+
return [MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB];
998+
}
999+
9641000
/**
9651001
* Returns the file summary facet, where facet terms are generated from the file summary.
9661002
* @param fileFacet - File facet.

explorer/app/viewModelBuilders/common/contants.ts

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ export const DATE_TIME_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
55
year: "numeric",
66
};
77
export const DATE_TIME_LOCALES = "en-US";
8+
export const FEATURE_FLAGS = {
9+
VERBATIM: "verbatim",
10+
};

explorer/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

explorer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts --trace retain-on-failure"
3737
},
3838
"dependencies": {
39-
"@databiosphere/findable-ui": "0.0.0",
39+
"@databiosphere/findable-ui": "1.0.0",
4040
"@emotion/react": "11.11.1",
4141
"@emotion/styled": "11.11.0",
4242
"@mdx-js/loader": "^3.0.1",

0 commit comments

Comments
 (0)