import React from "react"; import ReactTooltip from "react-tooltip"; import { uniqueId } from "lodash"; import Icon from "components/Icon"; import TextCell from "components/TableContainer/DataTable/TextCell"; import { ProfileOperationType } from "interfaces/mdm"; import { COLORS } from "styles/var/colors"; import { isMdmProfileStatus, OsSettingsTableStatusValue, } from "../OSSettingsTableConfig"; import TooltipContent from "./components/Tooltip/TooltipContent"; import { isDiskEncryptionProfile, PROFILE_DISPLAY_CONFIG, ProfileDisplayOption, WINDOWS_DISK_ENCRYPTION_DISPLAY_CONFIG, } from "./helpers"; const baseClass = "os-settings-status-cell"; interface IOSSettingStatusCellProps { status: OsSettingsTableStatusValue; operationType: ProfileOperationType | null; profileName: string; } const OSSettingStatusCell = ({ status, operationType, profileName = "", }: IOSSettingStatusCellProps) => { let displayOption: ProfileDisplayOption = null; // windows hosts do not have an operation type at the moment and their display options are // different than mac hosts. if (!operationType && isMdmProfileStatus(status)) { displayOption = WINDOWS_DISK_ENCRYPTION_DISPLAY_CONFIG[status]; } if (operationType) { displayOption = PROFILE_DISPLAY_CONFIG[operationType]?.[status]; } const isDeviceUser = window.location.pathname .toLowerCase() .includes("/device/"); if (displayOption) { const { statusText, iconName, tooltip } = displayOption; const tooltipId = uniqueId(); return ( {tooltip ? ( <> {statusText} {status !== "action_required" ? ( ) : ( )} ) : ( statusText )} ); } // graceful error - this state should not be reached based on the API spec return ; }; export default OSSettingStatusCell;