Skip to content

Commit 5e857c1

Browse files
authored
Merge branch 'develop' into feat/DEVSU-2179-report-specific-appendix
2 parents 4ae2146 + 165244d commit 5e857c1

File tree

6 files changed

+183
-96
lines changed

6 files changed

+183
-96
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/TumourSummaryEdit/index.tsx

+66-60
Original file line numberDiff line numberDiff line change
@@ -137,24 +137,26 @@ const TumourSummaryEdit = ({
137137

138138
if (reportDirty && newReportData) {
139139
apiCalls.push(api.put(`/reports/${report.ident}`, newReportData, {}));
140-
} else {
141-
apiCalls.push({ request: () => null });
142140
}
143141

144142
if (mutationBurdenDirty && newMutationBurdenData) {
145143
if (mutationBurden?.ident) {
146144
apiCalls.push(api.put(`/reports/${report.ident}/mutation-burden/${mutationBurden.ident}`, newMutationBurdenData, {}));
147145
} else {
148-
apiCalls.push(api.post(`/reports/${report.ident}/mutation-burden`, newMutationBurdenData, {}));
146+
apiCalls.push(api.post(
147+
`/reports/${report.ident}/mutation-burden`,
148+
{ ...newMutationBurdenData, role: 'primary' },
149+
{},
150+
));
149151
}
150-
} else {
151-
apiCalls.push({ request: () => null });
152152
}
153153

154-
if (tmburMutDirty && newTmburMutData && tmburMutBur?.ident) {
155-
apiCalls.push(api.put(`/reports/${report.ident}/tmbur-mutation-burden`, newTmburMutData, {}));
156-
} else {
157-
apiCalls.push({ request: () => null });
154+
if (tmburMutDirty && newTmburMutData) {
155+
if (tmburMutBur?.ident) {
156+
apiCalls.push(api.put(`/reports/${report.ident}/tmbur-mutation-burden`, newTmburMutData, {}));
157+
} else {
158+
apiCalls.push(api.post(`/reports/${report.ident}/tmbur-mutation-burden`, newTmburMutData, {}));
159+
}
158160
}
159161

160162
callSet = new ApiCallSet(apiCalls);
@@ -164,19 +166,33 @@ const TumourSummaryEdit = ({
164166
setIsApiCalling(false);
165167
} else {
166168
try {
167-
const resp = await callSet.request();
168-
const tmburMutResp = resp.pop();
169-
const primaryBurdenResp = resp.pop();
170-
const reportResp = resp.pop();
169+
await callSet.request();
170+
171+
let microbialResp = null;
172+
let tmburMutResp = null;
173+
let mutationBurdenResp = null;
174+
let reportResp = null;
171175

172176
// Too complicated between delete/update/new, might as well grab updated micb species for report again
173-
const microbialResp = await api.get(`/reports/${report.ident}/summary/microbial`).request();
177+
if (microbialDirty) {
178+
microbialResp = await api.get(`/reports/${report.ident}/summary/microbial`).request();
179+
}
180+
if (tmburMutDirty) {
181+
tmburMutResp = await api.get(`/reports/${report.ident}/tmbur-mutation-burden`).request();
182+
}
183+
if (mutationBurdenDirty) {
184+
mutationBurdenResp = await api.get(`/reports/${report.ident}/mutation-burden/`).request();
185+
}
186+
if (reportDirty) {
187+
reportResp = await api.get(`/reports/${report.ident}`).request();
188+
}
189+
174190
snackbar.success('Successfully updated Tumour Summary');
175191
onClose(
176192
true,
177193
microbialDirty ? microbialResp : null,
178194
reportDirty ? reportResp : null,
179-
mutationBurdenDirty ? primaryBurdenResp : null,
195+
mutationBurdenDirty ? mutationBurdenResp.find((mb) => mb.role === 'primary') : null,
180196
tmburMutDirty ? tmburMutResp : null,
181197
);
182198
} catch (callSetError) {
@@ -323,53 +339,43 @@ const TumourSummaryEdit = ({
323339
return null;
324340
}, [handleClicked, handleDelete, handleKeyDown, newMicrobialData]);
325341

326-
const mutBurDataSection = useMemo(() => {
327-
if (newMutationBurdenData) {
328-
return (
329-
<TextField
330-
className="tumour-dialog__text-field"
331-
label="Mutation Burden (Mut/Mb)"
332-
value={newMutationBurdenData.totalMutationsPerMb}
333-
name="totalMutationsPerMb"
334-
onChange={handleMutationBurdenChange}
335-
variant="outlined"
336-
fullWidth
337-
type="number"
338-
/>
339-
);
340-
}
341-
return null;
342-
}, [newMutationBurdenData, handleMutationBurdenChange]);
342+
const mutBurDataSection = (
343+
<TextField
344+
className="tumour-dialog__text-field"
345+
label="Mutation Burden (Mut/Mb)"
346+
value={newMutationBurdenData?.totalMutationsPerMb ?? 0}
347+
name="totalMutationsPerMb"
348+
onChange={handleMutationBurdenChange}
349+
variant="outlined"
350+
fullWidth
351+
type="number"
352+
/>
353+
);
343354

344355
const tmburMutBurSection = useMemo(() => {
345-
if (newTmburMutData) {
346-
return (
347-
<>
348-
<TextField
349-
className="tumour-dialog__text-field"
350-
label="genomeSnvTmb"
351-
value={newTmburMutData.genomeSnvTmb}
352-
name="genomeSnvTmb"
353-
onChange={handleTmburChange}
354-
variant="outlined"
355-
fullWidth
356-
type="number"
357-
/>
358-
<TextField
359-
className="tumour-dialog__text-field"
360-
label="genomeIndelTmb"
361-
value={newTmburMutData.genomeIndelTmb}
362-
name="genomeIndelTmb"
363-
onChange={handleTmburChange}
364-
variant="outlined"
365-
fullWidth
366-
type="number"
367-
/>
368-
</>
369-
);
370-
}
371-
return null;
372-
}, [newTmburMutData, handleTmburChange]);
356+
<>
357+
<TextField
358+
className="tumour-dialog__text-field"
359+
label="genomeSnvTmb"
360+
value={newTmburMutData?.genomeSnvTmb ?? 0}
361+
name="genomeSnvTmb"
362+
onChange={handleTmburChange}
363+
variant="outlined"
364+
fullWidth
365+
type="number"
366+
/>
367+
<TextField
368+
className="tumour-dialog__text-field"
369+
label="genomeIndelTmb"
370+
value={newTmburMutData?.genomeIndelTmb ?? 0}
371+
name="genomeIndelTmb"
372+
onChange={handleTmburChange}
373+
variant="outlined"
374+
fullWidth
375+
type="number"
376+
/>
377+
</>;
378+
}, [newTmburMutData?.genomeSnvTmb, newTmburMutData?.genomeIndelTmb, handleTmburChange]);
373379

374380
return (
375381
<Dialog open={isOpen}>

app/hooks/useConfirmDialog.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import AlertDialog from '@/components/AlertDialog';
22
import ReportContext from '@/context/ReportContext';
3-
import api from '@/services/api';
43
import React, { useCallback, useContext } from 'react';
54
import ReactDOM from 'react-dom';
65
import snackbar from '@/services/SnackbarUtils';

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,12 @@ const GenomicSummary = ({
444444
isSaved: boolean,
445445
newMicrobialData: MicrobialType[],
446446
newReportData: ReportType,
447-
newMutationBurdenData: MutationBurdenType,
447+
newPrimaryBurdenData: MutationBurdenType,
448448
newTmBurMutBurData: TmburType,
449449
) => {
450450
setShowTumourSummaryEdit(false);
451451

452-
if (!isSaved || (!newMicrobialData && !newReportData && !newMutationBurdenData && !newTmBurMutBurData)) {
452+
if (!isSaved || (!newMicrobialData && !newReportData && !newPrimaryBurdenData && !newTmBurMutBurData)) {
453453
return;
454454
}
455455

@@ -461,8 +461,8 @@ const GenomicSummary = ({
461461
setReport(newReportData);
462462
}
463463

464-
if (newMutationBurdenData) {
465-
setPrimaryBurden(newMutationBurdenData);
464+
if (newPrimaryBurdenData) {
465+
setPrimaryBurden(newPrimaryBurdenData);
466466
}
467467

468468
if (newTmBurMutBurData) {

create-jira-ticket.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
const https = require('https');
3+
4+
function createJiraTicket() {
5+
const options = {
6+
method: 'POST',
7+
host: process.env.JIRA_BASE_URL,
8+
port: process.env.JIRA_PORT,
9+
path: '/jira/rest/api/2/issue/',
10+
headers: {
11+
Authorization: `Bearer ${process.env.JIRA_API_TOKEN}`,
12+
Accept: 'application/json',
13+
'Content-Type': 'application/json',
14+
},
15+
};
16+
17+
const issueData = JSON.stringify({
18+
fields: {
19+
project: {
20+
key: process.env.JIRA_PROJECT_NAME,
21+
},
22+
summary: process.env.PR_TITLE,
23+
description: process.env.PR_DESCRIPTION,
24+
issuetype: {
25+
name: process.env.JIRA_ISSUE_TYPE,
26+
},
27+
},
28+
});
29+
30+
const req = https.request(options, (res) => {
31+
res.setEncoding('utf8');
32+
res.on('data', (body) => {
33+
console.log('Body:', body);
34+
});
35+
});
36+
37+
req.on('error', (e) => {
38+
console.error('problem with request:', e.message);
39+
});
40+
41+
req.write(issueData);
42+
req.end();
43+
}
44+
45+
createJiraTicket();

0 commit comments

Comments
 (0)