From c1b5e58ebd7a1c01c985f75c9a84ac22f7f090f0 Mon Sep 17 00:00:00 2001 From: 20k-ultra <3946250+20k-ultra@users.noreply.github.com> Date: Thu, 7 Apr 2022 21:21:44 -0400 Subject: [PATCH] Correctly evaluate downloadProgress when computing current state Change-type: patch Closes: #1918 Signed-off-by: 20k-ultra <3946250+20k-ultra@users.noreply.github.com> --- src/compose/application-manager.ts | 4 +++- test/src/compose/application-manager.spec.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/compose/application-manager.ts b/src/compose/application-manager.ts index 920bed29..0cc00e0c 100644 --- a/src/compose/application-manager.ts +++ b/src/compose/application-manager.ts @@ -1041,7 +1041,9 @@ export async function getState() { commit, serviceName, status: status as string, - ...(downloadProgress && { download_progress: downloadProgress }), + ...(Number.isInteger(downloadProgress) && { + download_progress: downloadProgress, + }), }), ); diff --git a/test/src/compose/application-manager.spec.ts b/test/src/compose/application-manager.spec.ts index 79bc6441..015f7703 100644 --- a/test/src/compose/application-manager.spec.ts +++ b/test/src/compose/application-manager.spec.ts @@ -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, + }, }, }, },