From eaa5c8bf56f07a27bcb450f57641eeb528c62632 Mon Sep 17 00:00:00 2001 From: Sarah Gillespie <73313222+gillespi314@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:47:37 -0600 Subject: [PATCH] Fix unreleased bug in host summary UI (#16999) --- .../details/cards/HostSummary/HostSummary.tsx | 20 +++++++++++++++---- frontend/utilities/helpers.tsx | 6 +++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx b/frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx index 30846e7cc9..952ad53270 100644 --- a/frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx +++ b/frontend/pages/hosts/details/cards/HostSummary/HostSummary.tsx @@ -271,12 +271,24 @@ const HostSummary = ({ platform, diskEncryptionEnabled ); + let statusText; - if (platform === "chrome") { - statusText = "Always on"; - } else { - statusText = diskEncryptionEnabled ? "On" : "Off"; + switch (true) { + case platform === "chrome": + statusText = "Always on"; + break; + case diskEncryptionEnabled === true: + statusText = "On"; + break; + case diskEncryptionEnabled === false: + statusText = "Off"; + break; + default: + // something unexpected happened on the way to this component, display whatever we got or + // "Unknown" to draw attention to the issue. + statusText = diskEncryptionEnabled || "Unknown"; } + return (
Disk encryption diff --git a/frontend/utilities/helpers.tsx b/frontend/utilities/helpers.tsx index 8d2aa6a331..f433cc97e6 100644 --- a/frontend/utilities/helpers.tsx +++ b/frontend/utilities/helpers.tsx @@ -783,7 +783,11 @@ export const normalizeEmptyValues = ( return reduce( hostData, (result, value, key) => { - if ((Number.isFinite(value) && value !== 0) || !isEmpty(value)) { + if ( + (Number.isFinite(value) && value !== 0) || + !isEmpty(value) || + typeof value === "boolean" + ) { Object.assign(result, { [key]: value }); } else { Object.assign(result, { [key]: DEFAULT_EMPTY_CELL_VALUE });