Skip to content

Commit 39ad34b

Browse files
authored
Merge pull request #419 from bcgsc/release/v6.26.0
v6.26.0
2 parents fc2e58b + 73ff292 commit 39ad34b

File tree

33 files changed

+765
-252
lines changed

33 files changed

+765
-252
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/ReportAutocomplete/index.tsx

+34-8
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import {
66
Button,
77
} from '@mui/material';
88
import { ReportType } from '@/context/ReportContext';
9-
import api from '../../services/api';
109

1110
import './index.scss';
11+
import { useDebounce } from 'use-debounce';
12+
import { useSnackbar } from 'notistack';
13+
import api from '../../services/api';
1214

1315
type ReportAutocompleteProps = {
1416
defaultValue?: ReportType;
@@ -24,20 +26,44 @@ const ReportAutocomplete = ({
2426
const [options, setOptions] = useState([]);
2527
const [loading, setLoading] = useState(false);
2628
const [value, setValue] = useState<ReportType>(null);
29+
const [text, setText] = useState<string>(defaultValue?.patientId || '');
30+
const [debouncedText] = useDebounce(text, 500);
31+
const snackbar = useSnackbar();
2732

2833
useEffect(() => {
2934
if (defaultValue) {
3035
setValue(defaultValue);
3136
}
3237
}, [defaultValue]);
3338

34-
const handleInputChange = async ({ target: { value: queryValue } }) => {
35-
setLoading(true);
36-
const autocompleted = await api.get(`/reports?searchText=${queryValue}`, {}).request();
39+
useEffect(() => {
40+
setText((prevVal) => {
41+
if (!value?.patientId) { return ''; }
42+
if (prevVal !== value?.patientId) { return value?.patientId; }
43+
return prevVal;
44+
});
45+
}, [value?.patientId]);
46+
47+
useEffect(() => {
48+
const getData = async () => {
49+
try {
50+
setLoading(true);
51+
const reportsResp = await api.get(`/reports?searchText=${debouncedText}`).request();
52+
setOptions(reportsResp.reports);
53+
} catch (e) {
54+
snackbar.enqueueSnackbar('Error getting report autocomplete data');
55+
} finally {
56+
setLoading(false);
57+
}
58+
};
59+
if (debouncedText) {
60+
getData();
61+
}
62+
}, [snackbar, debouncedText]);
3763

38-
setOptions(autocompleted.reports);
39-
setLoading(false);
40-
};
64+
const handleTextChange = useCallback(({ target: { value: nextText } }) => {
65+
setText((prevText) => (prevText === nextText ? prevText : nextText));
66+
}, []);
4167

4268
const handleSubmit = useCallback(async () => {
4369
onSubmit(value);
@@ -58,7 +84,7 @@ const ReportAutocomplete = ({
5884
label={label || 'Report'}
5985
variant="outlined"
6086
margin="normal"
61-
onChange={handleInputChange}
87+
onChange={handleTextChange}
6288
InputProps={{
6389
...params.InputProps,
6490
endAdornment: (

0 commit comments

Comments
 (0)