Fix unreleased bug in host summary UI (#16999)

This commit is contained in:
Sarah Gillespie 2024-02-20 12:47:37 -06:00 committed by GitHub
parent 71255557da
commit eaa5c8bf56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 5 deletions

View file

@ -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 (
<div className="info-flex__item info-flex__item--title">
<span className="info-flex__header">Disk encryption</span>

View file

@ -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 });