diff --git a/apps/portal/src/components/selection/SelectionPage.tsx b/apps/portal/src/components/selection/SelectionPage.tsx index 07dd89692c1a95728d8219ff3100490c7a4bb205..5d680ccb0b798d07f6c05275dfebac47bc775104 100644 --- a/apps/portal/src/components/selection/SelectionPage.tsx +++ b/apps/portal/src/components/selection/SelectionPage.tsx @@ -14,6 +14,10 @@ export default function SelectionPage() { const hideReprocess = !config.ui.features.reprocessing; return ( - <SelectionPanelForType type={'dataset'} hideReprocess={hideReprocess} /> + <SelectionPanelForType + type={'dataset'} + hideReprocess={hideReprocess} + datasetViewerType="generic" // This forces the viewer type independently of their remote configuration + /> ); } diff --git a/apps/portal/src/components/selection/SelectionPanelForType.tsx b/apps/portal/src/components/selection/SelectionPanelForType.tsx index eb676650d71b953e7de5a27d47db7ce8bac96b7a..507d54942fdd55e4ca02aaf4d832fdb8d737ffd1 100644 --- a/apps/portal/src/components/selection/SelectionPanelForType.tsx +++ b/apps/portal/src/components/selection/SelectionPanelForType.tsx @@ -5,6 +5,7 @@ import { useUser, SelectEntityType, useSelection, + DatasetViewerType, } from '@edata-portal/core'; import { useEndpointURL, @@ -20,19 +21,26 @@ export function SelectionPanelForType({ linkToSelectionPage, hideDownload, hideMintDOI, + datasetViewerType, }: { type: SelectEntityType; hideReprocess?: boolean; linkToSelectionPage?: boolean; hideDownload?: boolean; hideMintDOI?: boolean; + datasetViewerType?: DatasetViewerType; // This forces the viewer type independently of their remote configuration }) { const { value: selection, clearSelection } = useSelection(type); const content = !selection.length ? ( <NoData /> ) : type === 'dataset' ? ( - <DatasetList groupBy="dataset" datasetIds={selection} showInvestigation /> + <DatasetList + groupBy="dataset" + datasetIds={selection} + showInvestigation + datasetViewerType={datasetViewerType} + /> ) : ( <DatasetList groupBy="sample" sampleIds={selection} showInvestigation /> ); diff --git a/apps/portal/src/components/viewers/DatasetViewer.tsx b/apps/portal/src/components/viewers/DatasetViewer.tsx index 83b5baa1a89b0af5a31fe48db8239b5e9fd1062f..5a47c56cb7963d460c7084d1b78629d6847c5638 100644 --- a/apps/portal/src/components/viewers/DatasetViewer.tsx +++ b/apps/portal/src/components/viewers/DatasetViewer.tsx @@ -113,6 +113,11 @@ export function DatasetViewer({ const viewerForType = viewer?.render[type]; + // This forces the display of the viewer despite its remote configuration + if (type === 'generic') { + return <GenericDatasetDetailsViewer dataset={dataset} {...props} />; + } + if (viewerForType?.type === 'remote') { return ( <RemoteComponent diff --git a/package.json b/package.json index dd41387704dc07be267dc8a934f0a13186aa2f2c..7bb0f35cdf0eedf1d3a038efd6718903136a1fe1 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "lint:tsc": "pnpm --filter @edata-portal/core lint:tsc && pnpm --filter @edata-portal/h5 lint:tsc && pnpm -r --parallel --filter './apps/**' lint:tsc", "lint:prettier": "pnpm -r --parallel lint:prettier", "fix:eslint": "pnpm -r --parallel fix:eslint", - "fix:prettier": "pnpm -r --parallel fix:prettier" + "fix:prettier": "pnpm -r --parallel fix:prettier", + "validate": "pnpm lint:eslint && pnpm lint:tsc && pnpm lint:prettier" }, "dependencies": { "eslint": "^8.57.0", diff --git a/packages/core/src/components/dataset/generic/DatasetList.tsx b/packages/core/src/components/dataset/generic/DatasetList.tsx index b7289ecdc0a1d55087d452443e48e2f675486f67..aedcb4e97cf57b6cf8701041d3f48c60b94c0ede 100644 --- a/packages/core/src/components/dataset/generic/DatasetList.tsx +++ b/packages/core/src/components/dataset/generic/DatasetList.tsx @@ -10,7 +10,7 @@ import { } from '@edata-portal/icat-plus-api'; import { useQueryClient } from '@tanstack/react-query'; import { Loading, NoData } from 'components/utils'; -import { useViewers } from 'context'; +import { DatasetViewerType, useViewers } from 'context'; import { formatDateToDay } from 'helpers'; import { PaginationMenu, useEndpointPagination, useParam } from 'hooks'; import React, { @@ -29,6 +29,7 @@ export function DatasetList( investigationId?: string; showInvestigation?: boolean; parameterFilter?: string; + datasetViewerType?: DatasetViewerType; } & ( | { groupBy: 'dataset'; @@ -54,7 +55,13 @@ export function DatasetList( switch (args.groupBy) { case 'dataset': if (args.datasets) { - return <DatasetObjectList datasets={args.datasets} {...args} />; + return ( + <DatasetObjectList + datasetViewerType={args.datasetViewerType} + datasets={args.datasets} + {...args} + /> + ); } return ( <Suspense fallback={<Loading />}> @@ -259,6 +266,7 @@ function LoadDatasetListByDataset({ search, sampleId, showInvestigation, + datasetViewerType, }: { instrumentName?: string; investigationId?: string; @@ -268,6 +276,7 @@ function LoadDatasetListByDataset({ search?: string; sampleId?: string; showInvestigation?: boolean; + datasetViewerType?: DatasetViewerType; }) { const datasets = useEndpointPagination({ endpoint: DATASET_LIST_ENDPOINT, @@ -295,6 +304,7 @@ function LoadDatasetListByDataset({ <DatasetObjectList datasets={datasets.data} showInvestigation={showInvestigation} + datasetViewerType={datasetViewerType} /> </Row> @@ -306,9 +316,11 @@ function LoadDatasetListByDataset({ function DatasetObjectList({ datasets, showInvestigation = false, + datasetViewerType = 'details', }: { datasets: Dataset[]; showInvestigation?: boolean; + datasetViewerType?: DatasetViewerType; }) { const viewers = useViewers(); @@ -336,7 +348,7 @@ function DatasetObjectList({ /> )} <Row key={dataset.id} className="mb-4"> - <Col>{viewers.viewDataset(dataset, 'details')}</Col> + <Col>{viewers.viewDataset(dataset, datasetViewerType)}</Col> </Row> </React.Fragment> ); diff --git a/packages/core/src/context/viewers.tsx b/packages/core/src/context/viewers.tsx index f16928efed34931b3a72a7437ab87b2f5fee93ff..dfdac2f3c6899dfccbe06b3e3e10699be4921382 100644 --- a/packages/core/src/context/viewers.tsx +++ b/packages/core/src/context/viewers.tsx @@ -10,6 +10,7 @@ export const DATASET_VIEWER_TYPES = [ 'details', 'snapshot', 'tableCell', + 'generic', ] as const; export type DatasetViewerType = (typeof DATASET_VIEWER_TYPES)[number];