mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
TooltipWrapper tipContent – strings –> JSX; small reorganization (#15126)
### Update some missed TooltipWrapper content from string to JSX, reorganize some code --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
3bc538cdc6
commit
8dc2076a70
2 changed files with 43 additions and 36 deletions
|
|
@ -15,11 +15,7 @@ import Icon from "components/Icon/Icon";
|
|||
import DiskSpaceGraph from "components/DiskSpaceGraph";
|
||||
import { HumanTimeDiffWithFleetLaunchCutoff } from "components/HumanTimeDiffWithDateTip";
|
||||
import PremiumFeatureIconWithTooltip from "components/PremiumFeatureIconWithTooltip";
|
||||
import {
|
||||
getHostDiskEncryptionTooltipMessage,
|
||||
humanHostMemory,
|
||||
wrapFleetHelper,
|
||||
} from "utilities/helpers";
|
||||
import { humanHostMemory, wrapFleetHelper } from "utilities/helpers";
|
||||
import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants";
|
||||
import StatusIndicator from "components/StatusIndicator";
|
||||
|
||||
|
|
@ -54,6 +50,48 @@ interface IHostSummaryProps {
|
|||
osSettings?: IOSSettings;
|
||||
}
|
||||
|
||||
const MAC_WINDOWS_DISK_ENCRYPTION_MESSAGES = {
|
||||
darwin: {
|
||||
enabled: (
|
||||
<>
|
||||
The disk is encrypted. The user must enter their
|
||||
<br /> password when they start their computer.
|
||||
</>
|
||||
),
|
||||
disabled: (
|
||||
<>
|
||||
The disk might be encrypted, but FileVault is off. The
|
||||
<br /> disk can be accessed without entering a password.
|
||||
</>
|
||||
),
|
||||
},
|
||||
windows: {
|
||||
enabled: (
|
||||
<>
|
||||
The disk is encrypted. If recently turned on,
|
||||
<br /> encryption could take awhile.
|
||||
</>
|
||||
),
|
||||
disabled: "The disk is unencrypted.",
|
||||
},
|
||||
};
|
||||
|
||||
const getHostDiskEncryptionTooltipMessage = (
|
||||
platform: "darwin" | "windows" | "chrome", // TODO: improve this type
|
||||
diskEncryptionEnabled = false
|
||||
) => {
|
||||
if (platform === "chrome") {
|
||||
return "Fleet does not check for disk encryption on Chromebooks, as they are encrypted by default.";
|
||||
}
|
||||
|
||||
if (!["windows", "darwin"].includes(platform)) {
|
||||
return "Disk encryption is enabled.";
|
||||
}
|
||||
return MAC_WINDOWS_DISK_ENCRYPTION_MESSAGES[platform][
|
||||
diskEncryptionEnabled ? "enabled" : "disabled"
|
||||
];
|
||||
};
|
||||
|
||||
const HostSummary = ({
|
||||
titleData,
|
||||
bootstrapPackageData,
|
||||
|
|
|
|||
|
|
@ -642,36 +642,6 @@ export const internationalTimeFormat = (date: number | Date): string => {
|
|||
);
|
||||
};
|
||||
|
||||
const MAC_WINDOWS_DISK_ENCRYPTION_MESSAGES = {
|
||||
darwin: {
|
||||
enabled:
|
||||
"The disk is encrypted. The user must enter their<br/> password when they start their computer.",
|
||||
disabled:
|
||||
"The disk might be encrypted, but FileVault is off. The<br/> disk can be accessed without entering a password.",
|
||||
},
|
||||
windows: {
|
||||
enabled:
|
||||
"The disk is encrypted. If recently turned on,<br/> encryption could take awhile.",
|
||||
disabled: "The disk is unencrypted.",
|
||||
},
|
||||
};
|
||||
|
||||
export const getHostDiskEncryptionTooltipMessage = (
|
||||
platform: "darwin" | "windows" | "chrome", // TODO: improve this type
|
||||
diskEncryptionEnabled = false
|
||||
) => {
|
||||
if (platform === "chrome") {
|
||||
return "Fleet does not check for disk encryption on Chromebooks, as they are encrypted by default.";
|
||||
}
|
||||
|
||||
if (!["windows", "darwin"].includes(platform)) {
|
||||
return "Disk encryption is enabled.";
|
||||
}
|
||||
return MAC_WINDOWS_DISK_ENCRYPTION_MESSAGES[platform][
|
||||
diskEncryptionEnabled ? "enabled" : "disabled"
|
||||
];
|
||||
};
|
||||
|
||||
export const hostTeamName = (teamName: string | null): string => {
|
||||
if (!teamName) {
|
||||
return "No team";
|
||||
|
|
@ -915,7 +885,6 @@ export default {
|
|||
humanLastSeen,
|
||||
internationalTimeFormat,
|
||||
internallyTruncateText,
|
||||
getHostDiskEncryptionTooltipMessage,
|
||||
hostTeamName,
|
||||
humanQueryLastRun,
|
||||
inMilliseconds,
|
||||
|
|
|
|||
Loading…
Reference in a new issue