Skip to content

Commit 65abb84

Browse files
Merge pull request #1713 from ral-facilities/release/v2.1.1
Release v2.1.1
2 parents e57790e + 23385b8 commit 65abb84

File tree

15 files changed

+313
-132
lines changed

15 files changed

+313
-132
lines changed

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [v2.1.1](https://github.com/ral-facilities/datagateway/tree/v2.1.1) (2025-03-18)
4+
5+
## What's Changed
6+
7+
### Features
8+
9+
* Fix initial download table timestamp showing as UNIX epoch by @louise-davies in https://github.com/ral-facilities/datagateway/pull/1708
10+
* Fix 500 errors in text filters when single quote is typed by @louise-davies in https://github.com/ral-facilities/datagateway/pull/1709
11+
* Fix slow size calculation of large carts by @louise-davies in https://github.com/ral-facilities/datagateway/pull/1707
12+
13+
### Dependencies
14+
15+
* Update dependency axios to v1.8.2 [SECURITY] by @renovate in https://github.com/ral-facilities/datagateway/pull/1705
16+
* Bump @babel/helpers from 7.20.13 to 7.26.10 by @dependabot in https://github.com/ral-facilities/datagateway/pull/1710
17+
* Bump @babel/runtime from 7.23.8 to 7.26.10 by @dependabot in https://github.com/ral-facilities/datagateway/pull/1711
18+
19+
**Full Changelog**: https://github.com/ral-facilities/datagateway/compare/v2.1.0...v2.1.1
20+
321
## [v2.1.0](https://github.com/ral-facilities/datagateway/tree/v2.1.0) (2025-03-10)
422

523
## What's Changed
@@ -36,7 +54,7 @@
3654

3755
* @akintomiwa made their first contribution in https://github.com/ral-facilities/datagateway/pull/1666
3856

39-
**Full Changelog**: https://github.com/ral-facilities/datagateway/compare/v2.0.0...snapshot-develop
57+
**Full Changelog**: https://github.com/ral-facilities/datagateway/compare/v2.0.0...v2.1.0
4058

4159
## [v2.0.0](https://github.com/ral-facilities/datagateway/tree/v2.0.0) (2024-07-24)
4260

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "datagateway",
33
"private": true,
4-
"version": "2.1.0",
4+
"version": "2.1.1",
55
"workspaces": [
66
"packages/*"
77
],

packages/datagateway-common/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datagateway-common",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"private": true,
55
"files": [
66
"lib"
@@ -12,7 +12,7 @@
1212
"@emotion/styled": "11.11.0",
1313
"@mui/x-date-pickers": "6.11.2",
1414
"@types/lodash.debounce": "4.0.6",
15-
"axios": "1.7.4",
15+
"axios": "1.8.3",
1616
"connected-react-router": "6.9.1",
1717
"date-fns": "2.30.0",
1818
"hex-to-rgba": "2.0.1",
@@ -23,7 +23,7 @@
2323
"prettier": "2.8.0",
2424
"react-draggable": "4.4.3",
2525
"react-i18next": "12.3.1",
26-
"react-query": "3.39.2",
26+
"react-query": "3.33.5",
2727
"react-redux": "8.1.3",
2828
"react-scripts": "5.0.0",
2929
"react-virtualized": "9.22.3",

packages/datagateway-common/src/api/index.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ describe('generic api functions', () => {
265265
it('parses all filter types to api params successfully', () => {
266266
const sortAndFilters: { sort: SortType; filters: FiltersType } = {
267267
filters: {
268-
name: { value: 'test', type: 'include' },
269-
title: { value: 'test', type: 'exclude' },
270-
doi: { value: 'test', type: 'exact' },
268+
name: { value: "test'", type: 'include' },
269+
title: { value: "test'", type: 'exclude' },
270+
doi: { value: "test'", type: 'exact' },
271271
startDate: {
272272
startDate: '2021-08-05',
273273
endDate: '2021-08-06',
@@ -280,9 +280,9 @@ describe('generic api functions', () => {
280280
const params = new URLSearchParams();
281281
params.append('order', JSON.stringify('name asc'));
282282
params.append('order', JSON.stringify('id asc'));
283-
params.append('where', JSON.stringify({ name: { ilike: 'test' } }));
284-
params.append('where', JSON.stringify({ title: { nilike: 'test' } }));
285-
params.append('where', JSON.stringify({ doi: { eq: 'test' } }));
283+
params.append('where', JSON.stringify({ name: { ilike: "test''" } }));
284+
params.append('where', JSON.stringify({ title: { nilike: "test''" } }));
285+
params.append('where', JSON.stringify({ doi: { eq: "test''" } }));
286286
params.append(
287287
'where',
288288
JSON.stringify({ startDate: { gte: '2021-08-05 00:00:00' } })

packages/datagateway-common/src/api/index.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,23 +250,45 @@ export const getApiParams = (
250250
}
251251
if ('type' in filter && filter.type) {
252252
// use switch statement to ensure TS can detect we cover all cases
253+
// also need to escape single quotes
253254
switch (filter.type) {
254255
case 'include':
255256
searchParams.append(
256257
'where',
257-
JSON.stringify({ [column]: { ilike: filter.value } })
258+
JSON.stringify({
259+
[column]: {
260+
ilike:
261+
typeof filter.value === 'string'
262+
? filter.value.replaceAll("'", "''")
263+
: filter.value,
264+
},
265+
})
258266
);
259267
break;
260268
case 'exclude':
261269
searchParams.append(
262270
'where',
263-
JSON.stringify({ [column]: { nilike: filter.value } })
271+
JSON.stringify({
272+
[column]: {
273+
nilike:
274+
typeof filter.value === 'string'
275+
? filter.value.replaceAll("'", "''")
276+
: filter.value,
277+
},
278+
})
264279
);
265280
break;
266281
case 'exact':
267282
searchParams.append(
268283
'where',
269-
JSON.stringify({ [column]: { eq: filter.value } })
284+
JSON.stringify({
285+
[column]: {
286+
eq:
287+
typeof filter.value === 'string'
288+
? filter.value.replaceAll("'", "''")
289+
: filter.value,
290+
},
291+
})
270292
);
271293
break;
272294
default:

packages/datagateway-dataview/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datagateway-dataview",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"private": true,
55
"dependencies": {
66
"@craco/craco": "7.1.0",
@@ -19,10 +19,10 @@
1919
"@types/react-router-dom": "5.3.3",
2020
"@types/react-virtualized": "9.21.10",
2121
"@types/redux-logger": "3.0.8",
22-
"axios": "1.7.4",
22+
"axios": "1.8.3",
2323
"connected-react-router": "6.9.1",
2424
"custom-event-polyfill": "1.0.7",
25-
"datagateway-common": "^2.1.0",
25+
"datagateway-common": "^2.1.1",
2626
"date-fns": "2.30.0",
2727
"eslint-config-prettier": "8.10.0",
2828
"eslint-plugin-cypress": "2.15.1",
@@ -40,7 +40,7 @@
4040
"react-app-polyfill": "3.0.0",
4141
"react-dom": "17.0.2",
4242
"react-i18next": "12.3.1",
43-
"react-query": "3.39.2",
43+
"react-query": "3.33.5",
4444
"react-redux": "8.1.3",
4545
"react-router-dom": "5.3.0",
4646
"react-scripts": "5.0.0",
@@ -126,6 +126,6 @@
126126
"jest-fail-on-console": "3.1.1",
127127
"lint-staged": "13.3.0",
128128
"serve": "14.2.0",
129-
"start-server-and-test": "2.0.0"
129+
"start-server-and-test": "~2.0.11"
130130
}
131131
}

packages/datagateway-download/package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datagateway-download",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"private": true,
55
"dependencies": {
66
"@craco/craco": "7.1.0",
@@ -16,13 +16,14 @@
1616
"@types/react-dom": "17.0.11",
1717
"@types/react-router-dom": "5.3.3",
1818
"@types/react-virtualized": "9.21.10",
19-
"axios": "1.7.4",
20-
"datagateway-common": "^2.1.0",
19+
"axios": "1.8.3",
20+
"datagateway-common": "^2.1.1",
2121
"date-fns": "2.30.0",
2222
"date-fns-tz": "2.0.0",
2323
"eslint-config-prettier": "8.10.0",
2424
"eslint-plugin-cypress": "2.15.1",
2525
"eslint-plugin-prettier": "4.2.1",
26+
"fastq": "^1.19.1",
2627
"history": "4.10.1",
2728
"i18next": "22.0.3",
2829
"i18next-browser-languagedetector": "7.2.0",
@@ -31,11 +32,13 @@
3132
"lodash.chunk": "4.2.0",
3233
"loglevel": "1.9.1",
3334
"p-limit": "3.1.0",
35+
"p-queue": "6.6.2",
36+
"p-throttle": "4.1.1",
3437
"prettier": "2.8.0",
3538
"react": "17.0.2",
3639
"react-dom": "17.0.2",
3740
"react-i18next": "12.3.1",
38-
"react-query": "3.39.2",
41+
"react-query": "3.33.5",
3942
"react-router-dom": "5.3.0",
4043
"react-scripts": "5.0.0",
4144
"react-virtualized": "9.22.3",
@@ -62,7 +65,7 @@
6265
"jest-fail-on-console": "3.1.1",
6366
"lint-staged": "13.3.0",
6467
"serve": "14.2.0",
65-
"start-server-and-test": "2.0.0"
68+
"start-server-and-test": "~2.0.11"
6669
},
6770
"scripts": {
6871
"start": "craco start",

packages/datagateway-download/src/downloadApiHooks.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,41 +257,34 @@ export const useSubmitCart = (
257257
);
258258
};
259259

260-
const fileSizeAndCountLimit = pLimit(20);
260+
const fileSizeAndCountLimit = pLimit(5);
261261

262262
export const useFileSizesAndCounts = (
263263
data: DownloadCartItem[] | undefined
264264
): UseQueryResult<FileSizeAndCount, AxiosError>[] => {
265265
const settings = React.useContext(DownloadSettingsContext);
266-
const { facilityName, apiUrl, downloadApiUrl } = settings;
266+
const { apiUrl } = settings;
267267
const retryICATErrors = useRetryICATErrors();
268268

269-
const queryConfigs: {
270-
queryKey: [string, number];
271-
staleTime: number;
272-
queryFn: () => Promise<FileSizeAndCount>;
273-
retry: (failureCount: number, error: AxiosError) => boolean;
274-
}[] = React.useMemo(() => {
269+
const queryConfigs = React.useMemo(() => {
275270
return data
276271
? data.map((cartItem) => {
277272
const { entityId, entityType } = cartItem;
278273
return {
279274
queryKey: ['fileSizeAndCount', entityId],
280275
queryFn: () =>
281276
fileSizeAndCountLimit(getFileSizeAndCount, entityId, entityType, {
282-
facilityName,
283277
apiUrl,
284-
downloadApiUrl,
285278
}),
286279
onError: (error: AxiosError) => {
287280
handleICATError(error, false);
288281
},
289282
retry: retryICATErrors,
290283
staleTime: Infinity,
291-
};
284+
} as UseQueryOptions<FileSizeAndCount, AxiosError, FileSizeAndCount>;
292285
})
293286
: [];
294-
}, [data, retryICATErrors, facilityName, apiUrl, downloadApiUrl]);
287+
}, [data, retryICATErrors, apiUrl]);
295288

296289
return useQueries(queryConfigs);
297290
};

packages/datagateway-download/src/downloadCart/downloadCartItemLink.component.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from 'react';
33
import type { DownloadCartItem } from 'datagateway-common';
44
import { useQuery } from 'react-query';
55
import { Link } from 'react-router-dom';
6+
import pLimit from 'p-limit';
67

78
type LinkBuilder = () => Promise<string | null>;
89

@@ -11,13 +12,16 @@ interface DownloadCartItemLinkProps {
1112
linkBuilder: LinkBuilder;
1213
}
1314

15+
const cartLinkLimit = pLimit(5);
16+
1417
function DownloadCartItemLink({
1518
cartItem,
1619
linkBuilder,
1720
}: DownloadCartItemLinkProps): JSX.Element {
18-
const { data: link } = useQuery(['cartItemLink', cartItem.id], () =>
19-
linkBuilder()
20-
);
21+
const { data: link } = useQuery(['cartItemLink', cartItem.id], {
22+
queryFn: () => cartLinkLimit(linkBuilder),
23+
staleTime: Infinity,
24+
});
2125

2226
return link ? (
2327
<MuiLink component={Link} to={link}>

packages/datagateway-download/src/downloadStatus/adminDownloadStatusTable.component.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe('Admin Download Status Table', () => {
246246
'Filter by downloadStatus.username'
247247
);
248248

249-
await user.type(usernameFilterInput, 'test user');
249+
await user.type(usernameFilterInput, "test user'");
250250

251251
// test exact filter
252252
await user.click(
@@ -265,7 +265,7 @@ describe('Admin Download Status Table', () => {
265265
downloadApiUrl: mockedSettings.downloadApiUrl,
266266
facilityName: mockedSettings.facilityName,
267267
},
268-
`WHERE download.facilityName = '${mockedSettings.facilityName}' AND download.userName = 'test user' ORDER BY download.id ASC LIMIT 0, 50`
268+
`WHERE download.facilityName = '${mockedSettings.facilityName}' AND download.userName = 'test user''' ORDER BY download.id ASC LIMIT 0, 50`
269269
);
270270

271271
await user.clear(usernameFilterInput);
@@ -296,7 +296,7 @@ describe('Admin Download Status Table', () => {
296296
'Filter by downloadStatus.status'
297297
);
298298

299-
await user.type(availabilityFilterInput, 'downloadStatus.complete');
299+
await user.type(availabilityFilterInput, "downloadStatus.complete'");
300300
await flushPromises();
301301

302302
// test include filter
@@ -305,7 +305,7 @@ describe('Admin Download Status Table', () => {
305305
downloadApiUrl: mockedSettings.downloadApiUrl,
306306
facilityName: mockedSettings.facilityName,
307307
},
308-
`WHERE download.facilityName = '${mockedSettings.facilityName}' AND UPPER(download.status) LIKE CONCAT('%', 'COMPLETE', '%') ORDER BY download.id ASC LIMIT 0, 50`
308+
`WHERE download.facilityName = '${mockedSettings.facilityName}' AND UPPER(download.status) LIKE CONCAT('%', 'COMPLETE''', '%') ORDER BY download.id ASC LIMIT 0, 50`
309309
);
310310

311311
// We simulate a change in the select from 'include' to 'exclude'.
@@ -326,7 +326,7 @@ describe('Admin Download Status Table', () => {
326326
downloadApiUrl: mockedSettings.downloadApiUrl,
327327
facilityName: mockedSettings.facilityName,
328328
},
329-
`WHERE download.facilityName = '${mockedSettings.facilityName}' AND UPPER(download.status) NOT LIKE CONCAT('%', 'COMPLETE', '%') ORDER BY download.id ASC LIMIT 0, 50`
329+
`WHERE download.facilityName = '${mockedSettings.facilityName}' AND UPPER(download.status) NOT LIKE CONCAT('%', 'COMPLETE''', '%') ORDER BY download.id ASC LIMIT 0, 50`
330330
);
331331

332332
await user.clear(availabilityFilterInput);

0 commit comments

Comments
 (0)