fleet/frontend/components/TableContainer/DataTable/PlatformCell/PlatformCell.tsx
Lucas Manuel Rodriguez 8e9bc79a5e
Add support for Windows to conditional access policies (#41830)
Resolves #41476
([Figma](https://www.figma.com/design/Su6nBw3Oi3VtGrQaIcK1cU/-38041-Entra-conditional-access--Windows?node-id=0-1))

I added a changes file in the first PR, so no need to add one here.

<img width="1096" height="1119" alt="Screenshot 2026-03-17 at 12 36
36 PM"
src="https://github.com/user-attachments/assets/a18ded0c-a5d5-4b56-9bf8-944566603088"
/>

## Testing

- [X] Added/updated automated tests
- [X] QA'd all new/changed functionality manually
2026-03-17 16:30:21 -03:00

52 lines
1.3 KiB
TypeScript

import React from "react";
import Icon from "components/Icon";
import TextCell from "components/TableContainer/DataTable/TextCell";
import { QueryablePlatform } from "interfaces/platform";
interface IPlatformCellProps {
platforms: QueryablePlatform[];
}
const baseClass = "platform-cell";
const ICONS: Record<string, QueryablePlatform> = {
darwin: "darwin",
windows: "windows",
linux: "linux",
chrome: "chrome",
};
const DISPLAY_ORDER: QueryablePlatform[] = [
"darwin",
"windows",
"linux",
// Chrome is supported for queries, but unsupported for scheduled queries
// which are currently not supported in ChromeOS.
"chrome",
];
const PlatformCell = ({ platforms }: IPlatformCellProps): JSX.Element => {
let orderedList: QueryablePlatform[] = [];
if (!platforms.length) {
return <TextCell value="---" grey />;
}
orderedList = DISPLAY_ORDER.filter((platform) =>
platforms.includes(platform)
);
return (
<span className={`${baseClass}__wrapper`} data-testid="icons">
{orderedList.map((platform) => {
return ICONS[platform] ? (
<Icon
className={`${baseClass}__icon`}
name={ICONS[platform]}
size="small"
key={ICONS[platform]}
/>
) : null;
})}
</span>
);
};
export default PlatformCell;