Skip to content
Snippets Groups Projects
Commit 9f6765c0 authored by Alejandro De Maria Antolinos's avatar Alejandro De Maria Antolinos
Browse files

Merge branch '794-selected-datasets-should-be-displayed-as-within-an-investigation' into 'main'

Resolve "Selected datasets should be displayed as within an investigation"

Closes #754 and #794

See merge request !690
parents 64b68bab 6812ffa1
No related branches found
Tags 1.32.0
1 merge request!690Resolve "Selected datasets should be displayed as within an investigation"
Pipeline #221278 passed
......@@ -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
/>
);
}
......@@ -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 />
);
......
......@@ -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
......
......@@ -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",
......
......@@ -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>
);
......
......@@ -10,6 +10,7 @@ export const DATASET_VIEWER_TYPES = [
'details',
'snapshot',
'tableCell',
'generic',
] as const;
export type DatasetViewerType = (typeof DATASET_VIEWER_TYPES)[number];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment