Skip to content

Commit

Permalink
feat: removed verbatim ff #4350
Browse files Browse the repository at this point in the history
  • Loading branch information
MillenniumFalconMechanic committed Feb 7, 2025
1 parent e2653f5 commit c1fc9d1
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 105 deletions.

This file was deleted.

72 changes: 1 addition & 71 deletions app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ import {
import * as C from "../../../../components";
import * as MDX from "../../../../components/common/MDXContent/anvil-cmg";
import { Description } from "../../../../components/Detail/components/MDX/components/Description/description";
import { ExportMethod } from "../../../../components/Export/components/AnVILExplorer/ExportMethod/exportMethod";
import { ExportMethod } from "@databiosphere/findable-ui/lib/components/Export/components/ExportMethod/exportMethod";
import { METADATA_KEY } from "../../../../components/Index/common/entities";
import { getPluralizedMetadataLabel } from "../../../../components/Index/common/indexTransformer";
import { FEATURE_FLAGS } from "../../../common/contants";
import { Unused, Void } from "../../../common/entities";
import { SUMMARY_DISPLAY_TEXT } from "./summaryMapper/constants";
import { mapExportSummary } from "./summaryMapper/summaryMapper";
Expand Down Expand Up @@ -167,31 +166,6 @@ export const buildAlertDatasetManifestDownloadWarning = (
};
};

/**
* Build props for dataset-related export warning Alert component.
* @param _ - Unused.
* @param viewContext - View context.
* @returns model to be used as props for the Alert component.
*/
export const buildAlertDatasetTerraExportWarning = (
_: Unused,
viewContext: ViewContext<Unused>
): React.ComponentProps<typeof MDX.Alert> => {
const {
exploreState: { featureFlagState },
} = viewContext;
const content = featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)
? isUserAuthenticated(viewContext)
? "To export this dataset, please request access."
: "To export this dataset, please sign in and, if necessary, request access."
: "Export functionality is currently under development. Check back soon for updates.";
return {
...ALERT_PROPS.STANDARD_WARNING,
component: C.FluidPaper,
content,
};
};

/**
* Build props for list view access warning Alert component.
* @param _ - Unused.
Expand Down Expand Up @@ -1473,50 +1447,6 @@ export const renderWhenUnAuthenticated = (
};
};

/**
* Renders dataset export to Terra component when the given datasests response is accessible. Note,
* this can be removed once the verbatim feature flag is removed (use renderDatasetExport instead).
* @param datasetsResponse - Response model return from datasets API.
* @param viewContext - View context.
* @returns model to be used as props for the ConditionalComponent component.
* @deprecated
*/
export const renderDatasetTerraExport = (
datasetsResponse: DatasetsResponse,
viewContext: ViewContext<DatasetsResponse>
): React.ComponentProps<typeof C.ConditionalComponent> => {
const {
exploreState: { featureFlagState },
} = viewContext;
return {
isIn:
isDatasetAccessible(datasetsResponse) &&
Boolean(featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)),
};
};

/**
* Renders dataset export to Terra warning component when the given datasests response is accessible. Note,
* this can be removed once the verbatim feature flag is removed (use renderDatasetExportWarning instead).
* @param datasetsResponse - Response model return from datasets API.
* @param viewContext - View context.
* @returns model to be used as props for the ConditionalComponent component.
* @deprecated
*/
export const renderDatasetTerraExportWarning = (
datasetsResponse: DatasetsResponse,
viewContext: ViewContext<DatasetsResponse>
): React.ComponentProps<typeof C.ConditionalComponent> => {
const {
exploreState: { featureFlagState },
} = viewContext;
return {
isIn:
!isDatasetAccessible(datasetsResponse) ||
Boolean(!featureFlagState?.includes(FEATURE_FLAGS.VERBATIM)),
};
};

/**
* Renders dataset export-related components (either the choose export method component,
* or specific export components) when the given dataset is accessble.
Expand Down
2 changes: 1 addition & 1 deletion app/viewModelBuilders/common/contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export const DATE_TIME_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
};
export const DATE_TIME_LOCALES = "en-US";
export const FEATURE_FLAGS = {
VERBATIM: "verbatim",
VERBATIM: "verbatim", // Deprecated
};
26 changes: 21 additions & 5 deletions e2e/anvil/anvil-dataset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import {
MUI_ALERT_ROOT,
MUI_BUTTON_GROUP_ROOT,
MUI_FORM_CONTROL_ROOT,
MUI_TABLE_CELL_ROOT,
MUI_TABLE_ROOT,
MUI_TABLE_ROW_ROOT,
Expand Down Expand Up @@ -151,11 +152,26 @@ describe("Dataset", () => {
// Confirm Terra export method is visible and click it.
await clickLink(page, BUTTON_TEXT_ANALYZE_IN_TERRA);

// Confirm the analyze in Terra page is loaded: check the "coming soon"
// message is displayed.
await expect(
page.locator(`${MUI_ALERT_ROOT}:has-text("under development")`)
).toBeVisible();
// Confirm the analyze in Terra page is loaded: check for form elements.
await expect(page.locator(MUI_FORM_CONTROL_ROOT).first()).toBeVisible();
});

test("displays analyze in Terra selected data", async ({ page }) => {
await goToDataset(page, CHIP_TEXT_ACCESS_GRANTED);

// Confirm export button is visible and click it.
await clickLink(page, BUTTON_TEXT_EXPORT);

// Wait for the summary request once the file manifest button is clicked.
const [request] = await Promise.all([
page.waitForRequest((request) =>
request.url().includes(API_ENDPOINT_SUMMARY)
),
clickLink(page, BUTTON_TEXT_ANALYZE_IN_TERRA),
]);

// Confirm summary request has dataset ID request param.
verifySummaryRequest(request);
});
});

Expand Down
1 change: 1 addition & 0 deletions e2e/features/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const MUI_ALERT_ROOT = ".MuiAlert-root";
export const MUI_BUTTON_GROUP_ROOT = ".MuiButtonGroup-root";
export const MUI_FORM_CONTROL_ROOT = ".MuiFormControl-root";
export const MUI_TABLE_CELL_ROOT = ".MuiTableCell-root";
export const MUI_TABLE_ROOT = ".MuiTable-root";
export const MUI_TABLE_ROW_ROOT = ".MuiTableRow-root";
6 changes: 3 additions & 3 deletions site-config/anvil-cmg/dev/detail/dataset/export/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ export const exportConfig: ExportConfig = {
children: [
{
component: MDX.Alert,
viewBuilder: V.buildAlertDatasetTerraExportWarning,
viewBuilder: V.buildAlertDatasetExportWarning,
} as ComponentConfig<typeof MDX.Alert, DatasetsResponse>,
],
component: C.BackPageContentSingleColumn,
} as ComponentConfig<typeof C.BackPageContentSingleColumn>,
],
component: C.ConditionalComponent,
viewBuilder: V.renderDatasetTerraExportWarning,
viewBuilder: V.renderDatasetExportWarning,
} as ComponentConfig<typeof C.ConditionalComponent, DatasetsResponse>,
/* ------ */
/* Dataset is accessible; render Terra export method */
Expand All @@ -63,7 +63,7 @@ export const exportConfig: ExportConfig = {
...exportSideColumn,
],
component: C.ConditionalComponent,
viewBuilder: V.renderDatasetTerraExport,
viewBuilder: V.renderDatasetExport,
} as ComponentConfig<typeof C.ConditionalComponent, DatasetsResponse>,
],
route: ROUTE_EXPORT_TO_TERRA,
Expand Down
5 changes: 2 additions & 3 deletions site-config/anvil-cmg/dev/export/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ExportConfig,
} from "@databiosphere/findable-ui/lib/config/entities";
import * as C from "../../../../app/components";
import { ExportMethod } from "../../../../app/components/Export/components/AnVILExplorer/ExportMethod/exportMethod";
import * as V from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders";
import { ROUTE_EXPORT_TO_TERRA, ROUTE_MANIFEST_DOWNLOAD } from "./constants";
import { mainColumn as exportMainColumn } from "./exportMainColumn";
Expand Down Expand Up @@ -73,9 +72,9 @@ export const exportConfig: ExportConfig = {
{
children: [
{
component: ExportMethod,
component: C.ExportMethod,
viewBuilder: V.buildExportMethodTerra,
} as ComponentConfig<typeof ExportMethod>,
} as ComponentConfig<typeof C.ExportMethod>,
{
component: C.ExportMethod,
viewBuilder: V.buildExportMethodManifestDownload,
Expand Down

0 comments on commit c1fc9d1

Please sign in to comment.