Skip to content

Commit d686662

Browse files
Merge pull request #438 from bcgsc/release/v6.28.0
Release/v6.28.0
2 parents b81af1b + 3e02934 commit d686662

File tree

15 files changed

+187
-50
lines changed

15 files changed

+187
-50
lines changed

app/common.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ type TmburType = {
255255
comments: string;
256256
genomeSnvTmb: number;
257257
genomeIndelTmb: number;
258+
adjustedTmb: number | null;
259+
adjustedTmbComment: string | null;
260+
tmbHidden: boolean;
258261
kbCategory: string | null;
259262
kbMatches: KbMatchType[];
260263
msiScore: number;

app/components/DataTable/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ const DataTable = ({
325325
colApi.setColumnsVisible(hiddenColumns, false);
326326
}
327327

328-
if (rowData.length >= MAX_VISIBLE_ROWS && !isPrint && !isFullLength) {
328+
if (rowData.length >= MAX_VISIBLE_ROWS && !isPrint && isFullLength) {
329329
gridDiv.current.style.height = MAX_TABLE_HEIGHT;
330330
gridApi?.setDomLayout('normal');
331331
}
@@ -560,11 +560,11 @@ const DataTable = ({
560560
paginationAutoPageSize={isFullLength}
561561
paginationPageSize={MAX_VISIBLE_ROWS}
562562
autoSizePadding={1}
563-
deltaRowDataMode={canReorder}
563+
immutableData={canReorder}
564564
getRowNodeId={(data) => data.ident}
565565
onRowDragEnd={canReorder ? onRowDragEnd : null}
566566
editType="fullRow"
567-
enableCellTextSelection
567+
enableCellTextSelection={!showReorder}
568568
onFilterChanged={handleFilterAndSortChanged}
569569
onSortChanged={handleFilterAndSortChanged}
570570
noRowsOverlayComponent="NoRowsOverlay"

app/components/PrintTable/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.table {
44
border-collapse: collapse;
55
margin: 8px;
6+
font-family: Arial, Helvetica, sans-serif;
67

78
&--full-width {
89
width: 100%;

app/components/SignatureCard/SignatureCard.stories.tsx

Lines changed: 5 additions & 3 deletions
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.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@
66
&__text-field {
77
margin: 12px 0;
88
}
9+
10+
&__check-box {
11+
color: gray;
12+
padding-top: 2px;
13+
}
914
}

app/components/TumourSummaryEdit/index.tsx

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010
Button,
1111
Chip,
1212
Autocomplete,
13+
FormControlLabel,
14+
Checkbox,
1315
} from '@mui/material';
16+
import { Visibility, VisibilityOff } from '@mui/icons-material';
17+
import { pink } from '@mui/material/colors';
1418
import cloneDeep from 'lodash/cloneDeep';
1519
import api, { ApiCallSet } from '@/services/api';
1620
import ConfirmContext from '@/context/ConfirmContext';
@@ -103,6 +107,9 @@ const TumourSummaryEdit = ({
103107
setNewTmburMutData({
104108
genomeSnvTmb: tmburMutBur.genomeSnvTmb,
105109
genomeIndelTmb: tmburMutBur.genomeIndelTmb,
110+
adjustedTmb: tmburMutBur.adjustedTmb,
111+
adjustedTmbComment: tmburMutBur.adjustedTmbComment,
112+
tmbHidden: tmburMutBur.tmbHidden,
106113
});
107114
}
108115
}, [tmburMutBur]);
@@ -133,8 +140,29 @@ const TumourSummaryEdit = ({
133140
setTmburMutDirty(true);
134141
}, []);
135142

143+
const handleAdjustedTmbCommentChange = useCallback(({ target: { value, name } }) => {
144+
setNewTmburMutData((tmb) => ({
145+
...tmb,
146+
[name]: value,
147+
}));
148+
setTmburMutDirty(true);
149+
}, []);
150+
151+
const handleAdjustedTmbVisibleChange = useCallback(({ target: { checked, name } }) => {
152+
setNewTmburMutData((tmb) => ({
153+
...tmb,
154+
[name]: checked,
155+
}));
156+
setTmburMutDirty(true);
157+
}, []);
158+
136159
const handleClose = useCallback(async (isSaved) => {
137160
let callSet = null;
161+
if (!!newTmburMutData.adjustedTmb && !newTmburMutData.adjustedTmbComment) {
162+
snackbar.warning('Please add a comment on the adjusted TMB');
163+
isSaved = false;
164+
onClose(false);
165+
}
138166
if (isSaved) {
139167
setIsApiCalling(true);
140168
const apiCalls = [];
@@ -236,7 +264,6 @@ const TumourSummaryEdit = ({
236264
);
237265
} catch (callSetError) {
238266
snackbar.error(`Error updating Tumour Summary: ${callSetError?.message}`);
239-
console.error(callSetError);
240267
} finally {
241268
setIsApiCalling(false);
242269
}
@@ -463,8 +490,49 @@ const TumourSummaryEdit = ({
463490
fullWidth
464491
type="number"
465492
/>
493+
<TextField
494+
className="tumour-dialog__text-field"
495+
label="Adjusted TMB"
496+
value={newTmburMutData?.adjustedTmb ?? null}
497+
name="adjustedTmb"
498+
onChange={handleTmburChange}
499+
variant="outlined"
500+
fullWidth
501+
type="number"
502+
/>
503+
<TextField
504+
className="tumour-dialog__text-field"
505+
label="Adjusted TMB Comment"
506+
value={newTmburMutData?.adjustedTmbComment ?? ''}
507+
name="adjustedTmbComment"
508+
disabled={!newTmburMutData?.adjustedTmb && !newTmburMutData?.adjustedTmbComment}
509+
required={!!newTmburMutData?.adjustedTmb}
510+
onChange={handleAdjustedTmbCommentChange}
511+
variant="outlined"
512+
fullWidth
513+
type="text"
514+
/>
515+
<FormControlLabel
516+
className="tumour-dialog__check-box"
517+
control={(
518+
<Checkbox
519+
icon={<Visibility />}
520+
checkedIcon={<VisibilityOff />}
521+
checked={newTmburMutData?.tmbHidden}
522+
name="tmbHidden"
523+
onChange={handleAdjustedTmbVisibleChange}
524+
sx={{
525+
color: 'default',
526+
'&.Mui-checked': {
527+
color: pink[800],
528+
},
529+
}}
530+
/>
531+
)}
532+
label="Show/Hide TMB Score"
533+
/>
466534
</>
467-
), [newTmburMutData?.genomeSnvTmb, newTmburMutData?.genomeIndelTmb, handleTmburChange]);
535+
), [newTmburMutData?.genomeSnvTmb, newTmburMutData?.genomeIndelTmb, newTmburMutData?.adjustedTmb, newTmburMutData?.adjustedTmbComment, newTmburMutData?.tmbHidden, handleTmburChange, handleAdjustedTmbCommentChange, handleAdjustedTmbVisibleChange]);
468536

469537
return (
470538
<Dialog open={isOpen}>

app/views/PrintView/index.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,29 @@ 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+
let serverName;
178+
switch (process.env.NODE_ENV) {
179+
case 'development':
180+
serverName = '_iprdev';
181+
break;
182+
case 'staging':
183+
serverName = '_iprstaging';
184+
break;
185+
default:
186+
serverName = '';
187+
break;
188+
}
189+
const formattedDate = `${year}-${month}-${day}_${hours}h${minutes}m${seconds}s`;
177190

178-
const formattedDate = `${year}-${month}-${day}-${hours}:${minutes}:${seconds}-${timeZone.replace(/\//g, '_')}`;
179-
180-
document.title = `${report.patientId}_${report.template.name}_${formattedDate}`;
191+
document.title = `${report.patientId}${serverName}_${templateName}_report_${formattedDate}`;
181192
window.print();
182193
setIsPrintDialogShown(true);
183194
};
@@ -228,7 +239,11 @@ const Print = ({
228239
return null;
229240
}, [report, theme, template, printVersion]);
230241

231-
const reportContextValue = useMemo(() => ({ report, setReport }), [report, setReport]);
242+
const reportContextValue = useMemo(() => ({
243+
canEdit: false,
244+
report,
245+
setReport,
246+
}), [report, setReport]);
232247

233248
return (
234249
<ReportContext.Provider value={reportContextValue}>

app/views/ReportView/components/AnalystComments/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
&--print {
2222
padding: 0;
23+
font-family: Arial, Helvetica, sans-serif;
2324

2425
&__user-text {
2526
padding: 8px 32px;

app/views/ReportView/components/Appendices/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.appendices {
22
margin: 20px auto;
33
padding: 0 20px;
4+
font-family: Arial, Helvetica, sans-serif;
45

56
&__config {
67
padding: 16px;

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

Lines changed: 16 additions & 9 deletions
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,
@@ -318,7 +321,7 @@ const GenomicSummary = ({
318321
},
319322
{
320323
term: 'Mutation Burden',
321-
value: primaryBurden && primaryBurden.totalMutationsPerMb !== null ? `${primaryBurden.totalMutationsPerMb} mut/Mb` : null,
324+
value: primaryBurden && primaryBurden.totalMutationsPerMb !== null && (!tmburMutBur?.adjustedTmb || tmburMutBur.tmbHidden === true) ? `${primaryBurden.totalMutationsPerMb} Mut/Mb` : null,
322325
},
323326
{
324327
term: `SV Burden (${primaryComparator ? primaryComparator.name : 'primary'})`,
@@ -343,10 +346,16 @@ const GenomicSummary = ({
343346
: null,
344347
},
345348
{
346-
term: 'Genome TMB (mut/mb)', // float
349+
term:
350+
tmburMutBur?.adjustedTmb ? 'Adjusted TMB (Mut/Mb)' : 'Genome TMB (Mut/Mb)', // float
347351
// Forced to do this due to javascript floating point issues
348352
value:
349-
tmburMutBur ? (tmburMutBur.genomeSnvTmb + tmburMutBur.genomeIndelTmb).toFixed(2) : null,
353+
tmburMutBur && !tmburMutBur.tmbHidden ? tmburMutBur.adjustedTmb?.toFixed(2) ?? (tmburMutBur.genomeSnvTmb + tmburMutBur.genomeIndelTmb).toFixed(2) : null,
354+
},
355+
{
356+
term: 'Adjusted TMB Comment',
357+
value:
358+
tmburMutBur?.adjustedTmbComment && !tmburMutBur.tmbHidden ? tmburMutBur.adjustedTmbComment : null,
350359
},
351360
]);
352361
}
@@ -368,7 +377,6 @@ const GenomicSummary = ({
368377
snackbar.success('Entry deleted');
369378
}
370379
} catch (err) {
371-
console.error(err);
372380
snackbar.error('Entry NOT deleted due to an error');
373381
}
374382
}, [report, isSigned, showConfirmDialog]);
@@ -384,7 +392,6 @@ const GenomicSummary = ({
384392
setVariants((prevVal) => ([...prevVal, categorizedVariantEntry]));
385393
snackbar.success('Entry added');
386394
} catch (err) {
387-
console.error(err);
388395
snackbar.error('Entry NOT added due to an error');
389396
}
390397
}, [report]);
@@ -610,7 +617,7 @@ const GenomicSummary = ({
610617
{dataSection}
611618
</div>
612619
);
613-
}, [canEdit, classNamePrefix, handleTumourSummaryEditClose, microbial, primaryBurden, tmburMutBur, report, showTumourSummaryEdit, tumourSummary, printVersion]);
620+
}, [canEdit, classNamePrefix, handleTumourSummaryEditClose, microbial, tCellCd8, primaryBurden, tmburMutBur, report, showTumourSummaryEdit, tumourSummary, printVersion]);
614621

615622
const alterationsSection = useMemo(() => {
616623
let titleSection = (

0 commit comments

Comments
 (0)