From 08279f35cfa807c10ba1f340382f137930167b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 10 Oct 2022 16:21:46 +0200 Subject: [PATCH] Ignore progress if no progress (#14024) --- gallery/src/pages/more-info/update.ts | 7 +++++++ src/common/entity/compute_state_display.ts | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gallery/src/pages/more-info/update.ts b/gallery/src/pages/more-info/update.ts index 872a7b2e41..ce4fa4f6f7 100644 --- a/gallery/src/pages/more-info/update.ts +++ b/gallery/src/pages/more-info/update.ts @@ -139,6 +139,13 @@ const ENTITIES = [ title: undefined, friendly_name: "Installing without title", }), + getEntity("update", "update21", "on", { + ...base_attributes, + in_progress: true, + friendly_name: "Update with in_progress true and UPDATE_SUPPORT_PROGRESS", + supported_features: + base_attributes.supported_features + UPDATE_SUPPORT_PROGRESS, + }), ]; @customElement("demo-more-info-update") diff --git a/src/common/entity/compute_state_display.ts b/src/common/entity/compute_state_display.ts index de3acbabe8..80792dca79 100644 --- a/src/common/entity/compute_state_display.ts +++ b/src/common/entity/compute_state_display.ts @@ -169,7 +169,8 @@ export const computeStateDisplayFromEntityAttributes = ( // When update is not available and there is no latest_version show "Unavailable" return state === "on" ? updateIsInstallingFromAttributes(attributes) - ? supportsFeatureFromAttributes(attributes, UPDATE_SUPPORT_PROGRESS) + ? supportsFeatureFromAttributes(attributes, UPDATE_SUPPORT_PROGRESS) && + typeof attributes.in_progress === "number" ? localize("ui.card.update.installing_with_progress", { progress: attributes.in_progress, })