Skip to content

Commit f600c27

Browse files
committed
Add specific handling for queued downloads in DownloadProgressIndicator
1 parent 438a5e2 commit f600c27

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

packages/datagateway-download/public/res/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"progress": "Progress",
3939
"calculating_progress": "Calculating...",
4040
"progress_unavailable": "Unknown",
41-
"progress_complete": ""
41+
"progress_complete": "",
42+
"progress_queued": "Queued"
4243
},
4344
"downloadConfirmDialog": {
4445
"close_arialabel": "Close download confirmation dialog",

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,21 @@ describe('DownloadProgressIndicator', () => {
173173
expect(screen.getByText('0%')).toBeInTheDocument();
174174
});
175175

176+
it('should show queued when download is paused and has no preparedId', async () => {
177+
renderComponent({
178+
download: {
179+
...mockDownload,
180+
status: 'PAUSED',
181+
preparedId: undefined,
182+
},
183+
});
184+
185+
expect(
186+
await screen.findByText('downloadStatus.progress_queued')
187+
).toBeInTheDocument();
188+
expect(getPercentageComplete).not.toHaveBeenCalled();
189+
});
190+
176191
it('should show progress of the given download item', async () => {
177192
(
178193
getPercentageComplete as jest.MockedFunction<typeof getPercentageComplete>

packages/datagateway-download/src/downloadStatus/downloadProgressIndicator.component.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ function DownloadProgressIndicator({
4444
// if the download is being prepared, show 0%
4545
if (download.status === 'PREPARING') return <ProgressBar progress={0} />;
4646

47+
// if the download is paused with no preparedId, show that it is queued
48+
if (
49+
download.status === 'PAUSED' &&
50+
typeof download.preparedId === 'undefined'
51+
)
52+
return <>{t('downloadStatus.progress_queued')}</>;
53+
4754
// display a label indicating progress unavailable when
4855
// progress is not returned or the download status doesn't match.
4956
if (typeof progress === 'undefined')

0 commit comments

Comments
 (0)