mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 17:28:54 +00:00
deeaf9d036
Add new usePlatformSelector custom hook Add new usePlatformCompatibility custom hook Add new PlatformSelector global component Refactor PlatformCompatibility as global component Refactor sql_tools to TypeScript Improve type definitions for context/policy Align PolicyPage and QueryPage with platform compatibility changes
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import React from "react";
|
|
import Checkbox from "components/forms/fields/Checkbox";
|
|
|
|
interface IPlatformSelectorProps {
|
|
baseClass?: string;
|
|
checkDarwin: boolean;
|
|
checkWindows: boolean;
|
|
checkLinux: boolean;
|
|
setCheckDarwin: (val: boolean) => void;
|
|
setCheckWindows: (val: boolean) => void;
|
|
setCheckLinux: (val: boolean) => void;
|
|
}
|
|
|
|
export const PlatformSelector = ({
|
|
baseClass: parentClass,
|
|
checkDarwin,
|
|
checkWindows,
|
|
checkLinux,
|
|
setCheckDarwin,
|
|
setCheckWindows,
|
|
setCheckLinux,
|
|
}: IPlatformSelectorProps): JSX.Element => {
|
|
const baseClass = "platform-selector";
|
|
|
|
return (
|
|
<div className={`${parentClass}__${baseClass} ${baseClass}`}>
|
|
<span>
|
|
<b>Checks on:</b>
|
|
<span className={`${baseClass}__checkboxes`}>
|
|
<Checkbox
|
|
value={checkDarwin}
|
|
onChange={(value: boolean) => setCheckDarwin(value)}
|
|
wrapperClassName={`${baseClass}__platform-checkbox-wrapper`}
|
|
>
|
|
macOS
|
|
</Checkbox>
|
|
<Checkbox
|
|
value={checkWindows}
|
|
onChange={(value: boolean) => setCheckWindows(value)}
|
|
wrapperClassName={`${baseClass}__platform-checkbox-wrapper`}
|
|
>
|
|
Windows
|
|
</Checkbox>
|
|
<Checkbox
|
|
value={checkLinux}
|
|
onChange={(value: boolean) => setCheckLinux(value)}
|
|
wrapperClassName={`${baseClass}__platform-checkbox-wrapper`}
|
|
>
|
|
Linux
|
|
</Checkbox>
|
|
</span>
|
|
</span>
|
|
<p>Your policy will only be checked on the selected platform(s).</p>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default PlatformSelector;
|