Skip to content

Commit f1e9217

Browse files
committed
feat/DEVSU-2192-print-report-name-updates
- DEVSU-2191 - DEVSU-2192 - DEVSU-2210 - Revise default file name for printed report (remove time zone, add 'report' after report name, and change 'probe' to 'targeted_gene') - General code clean up for Genonic and Rapid report views
1 parent 55a5f72 commit f1e9217

File tree

6 files changed

+26
-22
lines changed

6 files changed

+26
-22
lines changed

app/components/SignatureCard/SignatureCard.stories.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useMemo } from 'react';
22
import { action } from '@storybook/addon-actions';
3-
import { Story } from '@storybook/react/types-6-0';
3+
import { StoryFn } from '@storybook/react';
44

55
import ReportContext from '@/context/ReportContext';
66
import SignatureCard, { SignatureCardProps } from '.';
@@ -24,7 +24,7 @@ const Template = (args) => {
2424
);
2525
};
2626

27-
export const Unsigned: Story<SignatureCardProps> = Template.bind({});
27+
export const Unsigned: StoryFn<SignatureCardProps> = Template.bind({});
2828

2929
Unsigned.args = {
3030
title: 'Author',
@@ -36,7 +36,7 @@ Unsigned.args = {
3636

3737
const signedAt = '2021-12-02T22:05:15.326Z';
3838

39-
export const Signed: Story<SignatureCardProps> = Template.bind({});
39+
export const Signed: StoryFn<SignatureCardProps> = Template.bind({});
4040

4141
Signed.args = {
4242
title: 'Author',
@@ -59,6 +59,8 @@ Signed.args = {
5959
reviewerSignature: null,
6060
reviewerSignedAt: null,
6161
updatedAt: signedAt,
62+
creatorSignature: null,
63+
creatorSignedAt: signedAt,
6264
},
6365
type: 'author',
6466
isPrint: false,

app/components/TumourSummaryEdit/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ const TumourSummaryEdit = ({
236236
);
237237
} catch (callSetError) {
238238
snackbar.error(`Error updating Tumour Summary: ${callSetError?.message}`);
239-
console.error(callSetError);
240239
} finally {
241240
setIsApiCalling(false);
242241
}

app/views/PrintView/index.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,21 @@ const Print = ({
166166
const showPrint = async () => {
167167
const paged = new Previewer();
168168
await paged.preview(document.getElementById('root'), ['index.css'], document.body);
169+
const templateName = report.template.name === 'probe' ? 'targeted_gene' : report.template.name;
169170
const currentDate = new Date();
170171
const year = currentDate.getFullYear();
171172
const month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
172173
const day = currentDate.getDate().toString().padStart(2, '0');
173174
const hours = currentDate.getHours().toString().padStart(2, '0');
174175
const minutes = currentDate.getMinutes().toString().padStart(2, '0');
175176
const seconds = currentDate.getSeconds().toString().padStart(2, '0');
176-
const { timeZone } = new Intl.DateTimeFormat().resolvedOptions();
177+
// const serverName = process.env.NODE_ENV === 'production' ? '' : process.env.NODE_ENV === 'development' ? '_iprdev' : '_iprstaging';
177178

178-
const formattedDate = `${year}-${month}-${day}-${hours}:${minutes}:${seconds}-${timeZone.replace(/\//g, '_')}`;
179+
const formattedDate = `${year}-${month}-${day}_${hours}h${minutes}m${seconds}s`;
180+
181+
// document.title = `${report.patientId}${serverName}_${report.template.name}_report_${formattedDate}`;
182+
document.title = `${report.patientId}_${templateName}_report_${formattedDate}`;
179183

180-
document.title = `${report.patientId}_${report.template.name}_${formattedDate}`;
181184
window.print();
182185
setIsPrintDialogShown(true);
183186
};
@@ -228,7 +231,11 @@ const Print = ({
228231
return null;
229232
}, [report, theme, template, printVersion]);
230233

231-
const reportContextValue = useMemo(() => ({ report, setReport }), [report, setReport]);
234+
const reportContextValue = useMemo(() => ({
235+
canEdit: false,
236+
report,
237+
setReport,
238+
}), [report, setReport]);
232239

233240
return (
234241
<ReportContext.Provider value={reportContextValue}>

app/views/ReportView/components/GenomicSummary/index.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import sortBy from 'lodash/sortBy';
1313

1414
import api, { ApiCallSet } from '@/services/api';
1515
import { formatDate } from '@/utils/date';
16-
import useReport from '@/hooks/useReport';
1716
import ConfirmContext from '@/context/ConfirmContext';
1817
import ReadOnlyTextField from '@/components/ReadOnlyTextField';
1918
import DemoDescription from '@/components/DemoDescription';
@@ -27,8 +26,8 @@ import TumourSummaryEdit from '@/components/TumourSummaryEdit';
2726
import {
2827
TumourSummaryType, MicrobialType, ImmuneType, MutationBurdenType, TmburType, MsiType,
2928
} from '@/common';
30-
import { SummaryProps } from '@/commonComponents';
3129
import SummaryPrintTable from '@/components/SummaryPrintTable';
30+
import useReport from '@/hooks/useReport';
3231

3332
import VariantChips from './components/VariantChips';
3433
import VariantCounts from './components/VariantCounts';
@@ -72,7 +71,11 @@ const customTypeSort = (variant) => {
7271
return 3;
7372
};
7473

75-
type GenomicSummaryProps = Omit<SummaryProps, 'templateName'> & WithLoadingInjectedProps;
74+
type GenomicSummaryProps = {
75+
loadedDispatch?: ({ type }: { type: string }) => void;
76+
isPrint: boolean;
77+
printVersion?: 'stable' | 'beta' | null;
78+
} & WithLoadingInjectedProps;
7679

7780
const GenomicSummary = ({
7881
isPrint = false,
@@ -368,7 +371,6 @@ const GenomicSummary = ({
368371
snackbar.success('Entry deleted');
369372
}
370373
} catch (err) {
371-
console.error(err);
372374
snackbar.error('Entry NOT deleted due to an error');
373375
}
374376
}, [report, isSigned, showConfirmDialog]);
@@ -384,7 +386,6 @@ const GenomicSummary = ({
384386
setVariants((prevVal) => ([...prevVal, categorizedVariantEntry]));
385387
snackbar.success('Entry added');
386388
} catch (err) {
387-
console.error(err);
388389
snackbar.error('Entry NOT added due to an error');
389390
}
390391
}, [report]);
@@ -610,7 +611,7 @@ const GenomicSummary = ({
610611
{dataSection}
611612
</div>
612613
);
613-
}, [canEdit, classNamePrefix, handleTumourSummaryEditClose, microbial, primaryBurden, tmburMutBur, report, showTumourSummaryEdit, tumourSummary, printVersion]);
614+
}, [canEdit, classNamePrefix, handleTumourSummaryEditClose, microbial, tCellCd8, primaryBurden, tmburMutBur, report, showTumourSummaryEdit, tumourSummary, printVersion]);
614615

615616
const alterationsSection = useMemo(() => {
616617
let titleSection = (

app/views/ReportView/components/MutationBurden/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const TMBUR_FIELD_TO_LABEL = {
101101
totalGenomeIndels: 'Total genome Indels',
102102
genomeSnvTmb: 'Genome SNV TMB (mut/mb)',
103103
genomeIndelTmb: 'Genome Indel TMB (mut/mb)',
104-
genomeTmb: 'Genome TMB (mut/mb) ',
104+
genomeTmb: 'Genome TMB (mut/mb)',
105105
cdsBasesIn1To22AndXAndY: 'CDS bases in 1-22,X,Y',
106106
cdsSnvs: 'CDS SNVs',
107107
cdsIndels: 'CDS Indels',

app/views/ReportView/components/RapidSummary/index.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
Grid,
88
} from '@mui/material';
99
import EditIcon from '@mui/icons-material/Edit';
10-
import cloneDeep from 'lodash/cloneDeep';
1110

1211
import api, { ApiCallSet } from '@/services/api';
1312
import snackbar from '@/services/SnackbarUtils';
@@ -30,7 +29,6 @@ import DescriptionList from '@/components/DescriptionList';
3029
import {
3130
KbMatchType, TumourSummaryType, ImmuneType, MutationBurdenType, MicrobialType, TmburType,
3231
} from '@/common';
33-
import useConfirmDialog from '@/hooks/useConfirmDialog';
3432
import { Box } from '@mui/system';
3533
import {
3634
therapeuticAssociationColDefs, cancerRelevanceColDefs, sampleColumnDefs, getGenomicEvent,
@@ -134,9 +132,9 @@ const RapidSummary = ({
134132
setIsLoading,
135133
}: RapidSummaryProps): JSX.Element => {
136134
const { report, setReport } = useContext(ReportContext);
137-
const { isSigned, setIsSigned } = useContext(ConfirmContext);
135+
const { setIsSigned } = useContext(ConfirmContext);
138136
const { canEdit } = useReport();
139-
const { showConfirmDialog } = useConfirmDialog();
137+
// const { showConfirmDialog } = useConfirmDialog();
140138

141139
const [signatures, setSignatures] = useState<SignatureType | null>();
142140
const [therapeuticAssociationResults, setTherapeuticAssociationResults] = useState<RapidVariantType[] | null>();
@@ -281,7 +279,6 @@ const RapidSummary = ({
281279
]);
282280
} catch (err) {
283281
snackbar.error(`Unknown error: ${err}`);
284-
console.error(err);
285282
} finally {
286283
setIsLoading(false);
287284
if (loadedDispatch) {
@@ -368,8 +365,6 @@ const RapidSummary = ({
368365
}, [microbial, primaryBurden, tmburMutBur, report.m1m2Score, report.sampleInfo, report.tumourContent, tCellCd8?.percentile, tCellCd8?.score, report.captiv8Score]);
369366

370367
const handlePatientEditClose = useCallback((
371-
// TODO: Argument not being used, leading to OnClose flag on line 744 having too few arguments
372-
isSaved: boolean,
373368
newPatientData: PatientInformationType,
374369
newReportData: ReportType,
375370
) => {

0 commit comments

Comments
 (0)