From fe277517c14a8341be0f4ce76d072d361e574589 Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Wed, 15 Oct 2025 04:51:13 +0000 Subject: [PATCH] Fix update status rendering --- .../devices.$id.settings.general.update.tsx | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/ui/src/routes/devices.$id.settings.general.update.tsx b/ui/src/routes/devices.$id.settings.general.update.tsx index 5269d5eb..7e3f6633 100644 --- a/ui/src/routes/devices.$id.settings.general.update.tsx +++ b/ui/src/routes/devices.$id.settings.general.update.tsx @@ -189,8 +189,6 @@ function UpdatingDeviceState({ otaState: UpdateState["otaState"]; onMinimizeUpgradeDialog: () => void; }) { - const formatProgress = (progress: number) => `${Math.round(progress)}%`; - const calculateOverallProgress = (type: "system" | "app") => { const downloadProgress = Math.round((otaState[`${type}DownloadProgress`] || 0) * 100); const updateProgress = Math.round((otaState[`${type}UpdateProgress`] || 0) * 100); @@ -258,6 +256,11 @@ function UpdatingDeviceState({ ); }; + const systemOverallProgress = calculateOverallProgress("system"); + const systemUpdateStatus = getUpdateStatus("system"); + const appOverallProgress = calculateOverallProgress("app"); + const appUpdateStatus = getUpdateStatus("app"); + return (
@@ -293,7 +296,7 @@ function UpdatingDeviceState({

{m.general_update_system_update_title()}

- {calculateOverallProgress("system") < 100 ? ( + {systemOverallProgress < 100 ? ( ) : ( @@ -302,16 +305,14 @@ function UpdatingDeviceState({
- {getUpdateStatus("system")}{" "} - {calculateOverallProgress("system") < 100 ? ( - {formatProgress(calculateOverallProgress("system"))} - ) : null} + {systemUpdateStatus}{" "} + {systemOverallProgress < 100 + ? ({`${systemOverallProgress}%`}) + : null}
)} @@ -325,7 +326,7 @@ function UpdatingDeviceState({

{m.general_update_app_update_title()}

- {calculateOverallProgress("app") < 100 ? ( + {appOverallProgress < 100 ? ( ) : ( @@ -334,16 +335,14 @@ function UpdatingDeviceState({
- {getUpdateStatus("app")}{" "} - {calculateOverallProgress("system") < 100 ? ( - {formatProgress(calculateOverallProgress("app"))} - ) : null} + {appUpdateStatus}{" "} + {appOverallProgress < 100 + ? ({`${appOverallProgress}%`}) + : null}
@@ -411,13 +410,13 @@ function UpdateAvailableState({

{versionInfo?.systemUpdateAvailable ? ( <> - {m.general_update_system_type()}: {versionInfo?.remote?.systemVersion} + {m.general_update_system_type()}: {versionInfo?.remote?.systemVersion}
) : null} {versionInfo?.appUpdateAvailable ? ( <> - {m.general_update_application_type()}: {versionInfo?.remote?.appVersion} + {m.general_update_application_type()}: {versionInfo?.remote?.appVersion} ) : null}