Skip to content

Commit 97790d7

Browse files
Merge branch 'develop' into feat/DEVSU-2201-SV-burden-editable
2 parents 4985015 + 3e735dd commit 97790d7

File tree

27 files changed

+543
-210
lines changed

27 files changed

+543
-210
lines changed

.eslintrc.js

+37-31
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
11
module.exports = {
2-
"extends": [
3-
"airbnb",
4-
"airbnb-typescript",
5-
"airbnb/hooks",
6-
"plugin:@typescript-eslint/recommended"
2+
extends: [
3+
'airbnb',
4+
'airbnb-typescript',
5+
'airbnb/hooks',
6+
'plugin:@typescript-eslint/recommended',
77
],
8-
"env": {
9-
"browser": true,
10-
"es6": true,
11-
"node": true
8+
env: {
9+
browser: true,
10+
es6: true,
11+
node: true,
1212
},
13-
"parser": "@typescript-eslint/parser",
14-
"parserOptions": {
15-
"project": "./tsconfig.json"
13+
parser: '@typescript-eslint/parser',
14+
parserOptions: {
15+
project: './tsconfig.json',
1616
},
17-
"rules": {
18-
"react/function-component-definition": "off",
19-
"import/extensions": "off",
20-
"react/jsx-props-no-spreading": "off",
21-
"react/require-default-props": "off",
22-
"import/prefer-default-export": "warn",
23-
"max-len": "off",
24-
"no-param-reassign": "warn",
25-
"no-underscore-dangle": ["warn", { "allow": ["_env_"] }],
26-
"no-restricted-syntax": [
27-
"error",
28-
"ForInStatement",
29-
"LabeledStatement",
30-
"WithStatement"
17+
rules: {
18+
'react/function-component-definition': 'off',
19+
'import/extensions': 'off',
20+
'react/jsx-props-no-spreading': 'off',
21+
'react/require-default-props': 'off',
22+
'import/prefer-default-export': 'warn',
23+
'max-len': 'off',
24+
'no-param-reassign': 'warn',
25+
'no-underscore-dangle': ['warn', { allow: ['_env_'] }],
26+
'no-restricted-syntax': [
27+
'error',
28+
'ForInStatement',
29+
'LabeledStatement',
30+
'WithStatement',
3131
],
32-
"prefer-destructuring": ["error", { "object": true, "array": true }],
32+
'prefer-destructuring': ['error', { object: true, array: true }],
3333
},
34-
"settings": {
35-
"import/resolver": {
36-
typescript: {}
34+
settings: {
35+
'import/resolver': {
36+
typescript: {},
3737
},
3838
},
39-
}
39+
overrides: [
40+
{
41+
extends: ['plugin:@typescript-eslint/disable-type-checked'],
42+
files: ['./*.js'],
43+
},
44+
],
45+
};
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create JIRA ticket on release PR creation
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
branches:
7+
- master
8+
9+
jobs:
10+
create_ticket:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 20
21+
22+
- name: Run script
23+
run: node ./create-jira-ticket.js
24+
env:
25+
JIRA_PROJECT_NAME: ${{ vars.JIRA_PROJECT_NAME }}
26+
JIRA_ISSUE_TYPE: ${{ vars.JIRA_ISSUE_TYPE }}
27+
JIRA_BASE_URL: ${{ vars.JIRA_BASE_URL }}
28+
JIRA_PORT: ${{ vars.JIRA_PORT }}
29+
JIRA_API_TOKEN: ${{ secrets.JACLI_JIRA_TOKEN }}
30+
PR_TITLE: ${{ github.event.pull_request.title }}
31+
PR_DESCRIPTION: ${{ github.event.pull_request.body }}

app/components/AuthenticatedRoute/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* eslint-disable react/display-name */
22
import { PropTypes } from 'prop-types';
3-
import React, { useContext, useMemo } from 'react';
3+
import React, { useMemo } from 'react';
44
import {
55
Redirect,
66
Route,
77
} from 'react-router-dom';
88

9-
import SecurityContext from '@/context/SecurityContext';
9+
import useSecurity from '@/hooks/useSecurity';
1010
import useResource from '@/hooks/useResource';
1111
import { isAuthorized } from '@/services/management/auth';
1212

@@ -16,7 +16,7 @@ import { isAuthorized } from '@/services/management/auth';
1616
const AuthenticatedRoute = ({
1717
component: Component, adminRequired, showNav, onToggleNav, ...rest
1818
}) => {
19-
const { authorizationToken } = useContext(SecurityContext);
19+
const { authorizationToken } = useSecurity();
2020
const { adminAccess } = useResource();
2121
const authOk = isAuthorized(authorizationToken);
2222

app/components/IPRWYSIWYGEditor/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const IPRWYSIWYGEditor = ({
186186

187187
const handleOnSave = useCallback(() => {
188188
if (editor) {
189-
onClose(editor.getHTML());
189+
onClose(editor.isEmpty ? '' : editor.getHTML());
190190
}
191191
}, [editor, onClose]);
192192

app/components/NavBar/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import MenuIcon from '@mui/icons-material/Menu';
1212
import PersonIcon from '@mui/icons-material/Person';
1313

1414
import { logout } from '@/services/management/auth';
15-
import SecurityContext from '@/context/SecurityContext';
15+
import useSecurity from '@/hooks/useSecurity';
1616
import SidebarContext from '@/context/SidebarContext';
1717
import FeedbackDialog from './components/FeedbackDialog';
1818

1919
import './index.scss';
2020

2121
const NavBar = (): JSX.Element => {
22-
const { userDetails } = useContext(SecurityContext);
22+
const { userDetails } = useSecurity();
2323
const { sidebarMaximized, setSidebarMaximized } = useContext(SidebarContext);
2424

2525
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>();

app/components/TumourSummaryEdit/index.tsx

+54-41
Original file line numberDiff line numberDiff line change
@@ -140,25 +140,26 @@ const TumourSummaryEdit = ({
140140

141141
if (reportDirty && newReportData) {
142142
apiCalls.push(api.put(`/reports/${report.ident}`, newReportData, {}));
143-
} else {
144-
apiCalls.push({ request: () => null });
145143
}
146144

147145
if (mutationBurdenDirty && newMutationBurdenData) {
148146
if (mutationBurden?.ident) {
149147
apiCalls.push(api.put(`/reports/${report.ident}/mutation-burden/${mutationBurden.ident}`, newMutationBurdenData, {}));
150148
} else {
151-
// Default role of new mutation burden data for reports with no existing analysis per ClinInfo team
152-
apiCalls.push(api.post(`/reports/${report.ident}/mutation-burden`, { ...newMutationBurdenData, role: 'primary' }, {}));
149+
apiCalls.push(api.post(
150+
`/reports/${report.ident}/mutation-burden`,
151+
{ ...newMutationBurdenData, role: 'primary' },
152+
{},
153+
));
153154
}
154-
} else {
155-
apiCalls.push({ request: () => null });
156155
}
157156

158-
if (tmburMutDirty && newTmburMutData && tmburMutBur?.ident) {
159-
apiCalls.push(api.put(`/reports/${report.ident}/tmbur-mutation-burden`, newTmburMutData, {}));
160-
} else {
161-
apiCalls.push({ request: () => null });
157+
if (tmburMutDirty && newTmburMutData) {
158+
if (tmburMutBur?.ident) {
159+
apiCalls.push(api.put(`/reports/${report.ident}/tmbur-mutation-burden`, newTmburMutData, {}));
160+
} else {
161+
apiCalls.push(api.post(`/reports/${report.ident}/tmbur-mutation-burden`, newTmburMutData, {}));
162+
}
162163
}
163164

164165
callSet = new ApiCallSet(apiCalls);
@@ -168,19 +169,33 @@ const TumourSummaryEdit = ({
168169
setIsApiCalling(false);
169170
} else {
170171
try {
171-
const resp = await callSet.request();
172-
const tmburMutResp = resp.pop();
173-
const primaryBurdenResp = resp.pop();
174-
const reportResp = resp.pop();
172+
await callSet.request();
173+
174+
let microbialResp = null;
175+
let tmburMutResp = null;
176+
let mutationBurdenResp = null;
177+
let reportResp = null;
175178

176179
// Too complicated between delete/update/new, might as well grab updated micb species for report again
177-
const microbialResp = await api.get(`/reports/${report.ident}/summary/microbial`).request();
180+
if (microbialDirty) {
181+
microbialResp = await api.get(`/reports/${report.ident}/summary/microbial`).request();
182+
}
183+
if (tmburMutDirty) {
184+
tmburMutResp = await api.get(`/reports/${report.ident}/tmbur-mutation-burden`).request();
185+
}
186+
if (mutationBurdenDirty) {
187+
mutationBurdenResp = await api.get(`/reports/${report.ident}/mutation-burden/`).request();
188+
}
189+
if (reportDirty) {
190+
reportResp = await api.get(`/reports/${report.ident}`).request();
191+
}
192+
178193
snackbar.success('Successfully updated Tumour Summary');
179194
onClose(
180195
true,
181196
microbialDirty ? microbialResp : null,
182197
reportDirty ? reportResp : null,
183-
mutationBurdenDirty ? primaryBurdenResp : null,
198+
mutationBurdenDirty ? mutationBurdenResp.find((mb) => mb.role === 'primary') : null,
184199
tmburMutDirty ? tmburMutResp : null,
185200
);
186201
} catch (callSetError) {
@@ -365,31 +380,29 @@ const TumourSummaryEdit = ({
365380
}, [newMutationBurdenData, handleMutationBurdenChange]);
366381

367382
const tmburMutBurSection = useMemo(() => {
368-
return (
369-
<>
370-
<TextField
371-
className="tumour-dialog__text-field"
372-
label="genomeSnvTmb"
373-
value={newTmburMutData?.genomeSnvTmb ?? null}
374-
name="genomeSnvTmb"
375-
onChange={handleTmburChange}
376-
variant="outlined"
377-
fullWidth
378-
type="number"
379-
/>
380-
<TextField
381-
className="tumour-dialog__text-field"
382-
label="genomeIndelTmb"
383-
value={newTmburMutData?.genomeIndelTmb ?? null}
384-
name="genomeIndelTmb"
385-
onChange={handleTmburChange}
386-
variant="outlined"
387-
fullWidth
388-
type="number"
389-
/>
390-
</>
391-
);
392-
}, [newTmburMutData, handleTmburChange]);
383+
<>
384+
<TextField
385+
className="tumour-dialog__text-field"
386+
label="genomeSnvTmb"
387+
value={newTmburMutData?.genomeSnvTmb ?? 0}
388+
name="genomeSnvTmb"
389+
onChange={handleTmburChange}
390+
variant="outlined"
391+
fullWidth
392+
type="number"
393+
/>
394+
<TextField
395+
className="tumour-dialog__text-field"
396+
label="genomeIndelTmb"
397+
value={newTmburMutData?.genomeIndelTmb ?? 0}
398+
name="genomeIndelTmb"
399+
onChange={handleTmburChange}
400+
variant="outlined"
401+
fullWidth
402+
type="number"
403+
/>
404+
</>;
405+
}, [newTmburMutData?.genomeSnvTmb, newTmburMutData?.genomeIndelTmb, handleTmburChange]);
393406

394407
return (
395408
<Dialog open={isOpen}>

app/context/ReportContext/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type ReportType = {
5555
kbDiseaseMatch: string;
5656
m1m2Score: number;
5757
captiv8Score: number;
58+
appendix?: string;
5859
} & RecordDefaults;
5960

6061
type ReportContextType = {

0 commit comments

Comments
 (0)