From bf8b8d96018a7e3e40bd29a614886eeaff2c870c Mon Sep 17 00:00:00 2001 From: kevinlog Date: Fri, 25 Jun 2021 13:44:55 -0400 Subject: [PATCH] Add Windows and macOs option to dropdown --- .../exceptions/add_exception_modal/index.tsx | 20 +++++++++++-------- .../components/exceptions/translations.ts | 7 +++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx index 288206034a9a0..44ce37db2e754 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/add_exception_modal/index.tsx @@ -303,10 +303,10 @@ export const AddExceptionModal = memo(function AddExceptionModal({ return alertData !== undefined; }, [alertData]); - const [selectedOs, setSelectedOs] = useState(); + const [selectedOs, setSelectedOs] = useState(); const osTypesSelection = useMemo((): OsTypeArray => { - return hasAlertData ? retrieveAlertOsTypes(alertData) : selectedOs ? [selectedOs] : []; + return hasAlertData ? retrieveAlertOsTypes(alertData) : selectedOs ? [...selectedOs] : []; }, [hasAlertData, alertData, selectedOs]); const enrichExceptionItems = useCallback((): Array< @@ -359,21 +359,25 @@ export const AddExceptionModal = memo(function AddExceptionModal({ return false; }, [maybeRule]); - const OsOptions: Array> = useMemo((): Array< - EuiComboBoxOptionOption + const OsOptions: Array> = useMemo((): Array< + EuiComboBoxOptionOption > => { return [ { label: sharedI18n.OPERATING_SYSTEM_WINDOWS, - value: 'windows', + value: ['windows'], }, { label: sharedI18n.OPERATING_SYSTEM_MAC, - value: 'macos', + value: ['macos'], }, { label: sharedI18n.OPERATING_SYSTEM_LINUX, - value: 'linux', + value: ['linux'], + }, + { + label: sharedI18n.OPERATING_SYSTEM_WINDOWS_AND_MAC, + value: ['windows', 'macos'], }, ]; }, []); @@ -385,7 +389,7 @@ export const AddExceptionModal = memo(function AddExceptionModal({ [setSelectedOs] ); - const selectedOStoOptions = useMemo((): Array> => { + const selectedOStoOptions = useMemo((): Array> => { return OsOptions.filter((option) => { return selectedOs === option.value; }); diff --git a/x-pack/plugins/security_solution/public/common/components/exceptions/translations.ts b/x-pack/plugins/security_solution/public/common/components/exceptions/translations.ts index f3b697d12af60..0b398b8f1b0ad 100644 --- a/x-pack/plugins/security_solution/public/common/components/exceptions/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/exceptions/translations.ts @@ -274,6 +274,13 @@ export const OPERATING_SYSTEM_MAC = i18n.translate( } ); +export const OPERATING_SYSTEM_WINDOWS_AND_MAC = i18n.translate( + 'xpack.securitySolution.exceptions.operatingSystemMac', + { + defaultMessage: 'Windows and macOS', + } +); + export const OPERATING_SYSTEM_LINUX = i18n.translate( 'xpack.securitySolution.exceptions.operatingSystemLinux', {