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

Expand info on matching dataset cards Fixes #377 #421

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
30 changes: 21 additions & 9 deletions src/components/ResultCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CardContent from '@mui/material/CardContent';
import Checkbox from '@mui/material/Checkbox';
import ButtonGroup from '@mui/material/ButtonGroup';
import Typography from '@mui/material/Typography';
import { Tooltip, Divider } from '@mui/material';
import { Tooltip } from '@mui/material';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import { modalities } from '../utils/constants';

Expand All @@ -21,6 +21,8 @@ const ResultCard = memo(
pipelines,
checked,
onCheckboxChange,
isDataLad,
isAggregate,
}: {
nodeName: string;
datasetName: string;
Expand All @@ -29,11 +31,11 @@ const ResultCard = memo(
datasetTotalSubjects: number;
numMatchingSubjects: number;
imageModals: string[];
pipelines: {
[key: string]: string[];
};
pipelines: { [key: string]: string[] };
checked: boolean;
onCheckboxChange: (id: string) => void;
isDataLad: boolean;
isAggregate: boolean;
}) => (
<Card data-cy={`card-${datasetUUID}`}>
<CardContent>
Expand Down Expand Up @@ -71,6 +73,11 @@ const ResultCard = memo(
<Typography variant="subtitle2">
{numMatchingSubjects} subjects match / {datasetTotalSubjects} total subjects
</Typography>

<Typography variant="body2" color="textSecondary">
{isDataLad ? 'DataLad dataset' : 'Not a DataLad dataset'} |{' '}
{isAggregate ? 'Aggregate dataset' : 'Not an aggregate dataset'}
</Typography>
</div>
</div>
<div className="justify-self-center">
Expand All @@ -88,15 +95,19 @@ const ResultCard = memo(
<Tooltip
data-cy={`card-${datasetUUID}-available-pipelines-tooltip`}
title={
<Typography variant="body1">
<div>
{Object.entries(pipelines)
.flatMap(([name, versions]) =>
versions.map((version) => `${name.split('/').slice(-1)[0]} ${version}`)
versions.map(
(version) => `${name.split('/').slice(-1)[0]} ${version}`
)
)
.map((pipeline) => (
<Divider>{pipeline}</Divider>
.map((pipeline, index) => (
<Typography key={index} variant="body2" sx={{ display: 'block' }}>
{pipeline}
</Typography>
))}
</Typography>
</div>
}
placement="top"
>
Expand Down Expand Up @@ -139,3 +150,4 @@ const ResultCard = memo(
);

export default ResultCard;

3 changes: 3 additions & 0 deletions src/components/ResultContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
response: QueryResponse | null;
}) {
const [download, setDownload] = useState<string[]>([]);

const selectAll: boolean = response
? response.responses.length === download.length &&
response.responses.every((r) => download.includes(r.dataset_uuid))
Expand Down Expand Up @@ -325,6 +326,8 @@
pipelines={item.available_pipelines}
checked={download.includes(item.dataset_uuid)}
onCheckboxChange={updateDownload}
isDataLad={item.is_data_lad} // Pass the isDataLad prop

Check failure on line 329 in src/components/ResultContainer.tsx

View workflow job for this annotation

GitHub Actions / e2e-test

Property 'is_data_lad' does not exist on type 'Result'.
isAggregate={item.is_aggregate} // Pass the isAggregate prop

Check failure on line 330 in src/components/ResultContainer.tsx

View workflow job for this annotation

GitHub Actions / e2e-test

Property 'is_aggregate' does not exist on type 'Result'.
/>
))}
</div>
Expand Down
Loading