Skip to content

Commit

Permalink
feat: CQDG-623 add hasFamily to DownloadFileManifestModal family chec… (
Browse files Browse the repository at this point in the history
#245)

* feat: CQDG-623 add hasFamily to DownloadFileManifestModal family checkbox

* feat: CQDG-623 hasFamily has default true
  • Loading branch information
atoulous authored Feb 27, 2024
1 parent 2b2d442 commit 542bf98
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/components/reports/DownloadFileManifestModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ interface IDownloadFileManifestProps {
type?: 'default' | 'primary';
isDisabled?: boolean;
hasTooManyFiles?: boolean;
hasFamily?: boolean;
}

const DownloadFileManifestModal = ({
sqon,
type = 'default',
isDisabled,
hasTooManyFiles,
hasFamily = true,
}: IDownloadFileManifestProps) => {
const dispatch = useDispatch();

Expand Down Expand Up @@ -66,9 +68,11 @@ const DownloadFileManifestModal = ({
>
<p>{intl.get('api.report.fileManifest.text')}</p>
<p className={styles.subText}>{intl.get('api.report.fileManifest.subText')}</p>
<Checkbox checked={isFamilyChecked} onChange={() => setIsFamilyChecked(!isFamilyChecked)}>
{intl.get('api.report.fileManifest.textCheckbox')}
</Checkbox>
{hasFamily && (
<Checkbox checked={isFamilyChecked} onChange={() => setIsFamilyChecked(!isFamilyChecked)}>
{intl.get('api.report.fileManifest.textCheckbox')}
</Checkbox>
)}
{hasTooManyFiles && <TooMuchFilesAlert />}
{!hasTooManyFiles && isModalVisible && <FilesTable sqon={sqon} />}
</Modal>
Expand Down
1 change: 1 addition & 0 deletions src/graphql/files/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const GET_FILES = gql`
edges {
node {
participant_id
family_id
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/views/FileEntity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,23 @@ const FileEntity = () => {
const defaultCols = getBiospecimensColumns();
const userCols = userInfo?.config.files?.tables?.biospecimens?.columns || [];
const userColumns = userColumnPreferencesOrDefault(userCols, defaultCols);
const hasFamily = data?.participants?.hits?.edges?.some((e) => e.node.family_id);

return (
<EntityPage loading={loading} data={data} links={links} pageId={pageId}>
<EntityTitle
text={data?.file_id}
icon={<FileTextOutlined className={styles.titleIcon} />}
loading={loading}
extra={data && <DownloadFileManifestModal sqon={getCurrentSqon()} type="primary" />}
extra={
data && (
<DownloadFileManifestModal
sqon={getCurrentSqon()}
type="primary"
hasFamily={hasFamily}
/>
)
}
/>
<EntityDescriptions
id={SectionId.SUMMARY}
Expand Down
7 changes: 6 additions & 1 deletion src/views/StudyEntity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const StudyEntity = () => {

const hasTooManyFiles = (study?.file_count || 0) > MAX_ITEMS_QUERY;
const isRestricted = study ? study.security === 'R' : true;
const hasFamily = !!study?.family_count;

enum SectionId {
SUMMARY = 'summary',
Expand Down Expand Up @@ -94,7 +95,11 @@ const StudyEntity = () => {
<Space>
{!isRestricted && study && <DownloadClinicalDataButton sqon={participantSqon} />}
{!isRestricted && study && (
<DownloadFileManifestModal sqon={fileSqon} hasTooManyFiles={hasTooManyFiles} />
<DownloadFileManifestModal
sqon={fileSqon}
hasTooManyFiles={hasTooManyFiles}
hasFamily={hasFamily}
/>
)}
{study && (
<DownloadRequestAccessModal
Expand Down

0 comments on commit 542bf98

Please sign in to comment.