Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use verbatim.pfb manifest format for exports to terra in anvil (#4015) #4020

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
LABEL,
ManifestDownloadFormat,
MANIFEST_DOWNLOAD_FORMAT,
} from "@databiosphere/findable-ui/lib/apis/azul/common/entities";
import {
Expand Down Expand Up @@ -100,6 +101,7 @@ import * as C from "../../../../components";
import * as MDX from "../../../../components/common/MDXContent/anvil-cmg";
import { METADATA_KEY } from "../../../../components/Index/common/entities";
import { getPluralizedMetadataLabel } from "../../../../components/Index/common/indexTransformer";
import { FEATURE_FLAGS } from "../../../common/contants";
import { Unused } from "../../../common/entities";
import { SUMMARY_DISPLAY_TEXT } from "./summaryMapper/constants";
import { mapExportSummary } from "./summaryMapper/summaryMapper";
Expand Down Expand Up @@ -430,8 +432,9 @@ export const buildExportEntityToTerra = (
fileSummaryFacetName: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_FORMAT,
filters,
formFacet,
manifestDownloadFormat: MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB,
manifestDownloadFormats: [MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB],
manifestDownloadFormat: getExportToTerraManifestDownloadFormat(viewContext),
manifestDownloadFormats:
getExportToTerraManifestDownloadFormats(viewContext),
};
};

Expand Down Expand Up @@ -573,8 +576,9 @@ export const buildExportToTerra = (
fileSummaryFacetName: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_FORMAT,
filters: filterState,
formFacet,
manifestDownloadFormat: MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB,
manifestDownloadFormats: [MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB],
manifestDownloadFormat: getExportToTerraManifestDownloadFormat(viewContext),
manifestDownloadFormats:
getExportToTerraManifestDownloadFormats(viewContext),
};
};

Expand Down Expand Up @@ -961,6 +965,38 @@ export function getExportSelectedDataSummary(
]);
}

/**
* Returns export to terra manifest download format.
* @param viewContext - View context.
* @returns manifest download format.
*/
function getExportToTerraManifestDownloadFormat(
viewContext: ViewContext
): ManifestDownloadFormat | undefined {
const { exploreState } = viewContext;
const { featureFlagState } = exploreState;
if (featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)) {
return MANIFEST_DOWNLOAD_FORMAT.VERBATIM_PFB;
}
return MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB;
}

/**
* Returns export to terra manifest download formats.
* @param viewContext - View context.
* @returns manifest download formats.
*/
function getExportToTerraManifestDownloadFormats(
viewContext: ViewContext
): ManifestDownloadFormat[] {
const { exploreState } = viewContext;
const { featureFlagState } = exploreState;
if (featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)) {
return [MANIFEST_DOWNLOAD_FORMAT.VERBATIM_PFB];
}
return [MANIFEST_DOWNLOAD_FORMAT.TERRA_PFB];
}

/**
* Returns the file summary facet, where facet terms are generated from the file summary.
* @param fileFacet - File facet.
Expand Down
3 changes: 3 additions & 0 deletions explorer/app/viewModelBuilders/common/contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ export const DATE_TIME_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
year: "numeric",
};
export const DATE_TIME_LOCALES = "en-US";
export const FEATURE_FLAGS = {
VERBATIM: "verbatim",
};
14 changes: 7 additions & 7 deletions explorer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts --trace retain-on-failure"
},
"dependencies": {
"@databiosphere/findable-ui": "0.0.0",
"@databiosphere/findable-ui": "1.0.0",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@mdx-js/loader": "^3.0.1",
Expand Down
Loading