Correctly evaluate downloadProgress when computing current state

Change-type: patch
Closes: #1918
Signed-off-by: 20k-ultra <3946250+20k-ultra@users.noreply.github.com>
This commit is contained in:
20k-ultra 2022-04-07 21:21:44 -04:00
parent fa9074ce76
commit c1b5e58ebd
2 changed files with 16 additions and 1 deletions

View File

@ -1041,7 +1041,9 @@ export async function getState() {
commit,
serviceName,
status: status as string,
...(downloadProgress && { download_progress: downloadProgress }),
...(Number.isInteger(downloadProgress) && {
download_progress: downloadProgress,
}),
}),
);

View File

@ -1373,6 +1373,14 @@ describe('compose/application-manager', () => {
serviceName: 'ubuntu',
status: 'Downloaded',
},
{
name: 'node:latest',
commit: 'latestrelease',
appUuid: 'myapp',
serviceName: 'node',
status: 'Downloading',
downloadProgress: 0,
},
{
name: 'alpine:latest',
commit: 'latestrelease',
@ -1427,6 +1435,11 @@ describe('compose/application-manager', () => {
status: 'Downloading',
download_progress: 50,
},
node: {
image: 'node:latest',
status: 'Downloading',
download_progress: 0,
},
},
},
},