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 (