diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/linux.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/linux.tsx index ca2215d3d0a59..9d2ce03c20462 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/linux.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/linux.tsx @@ -8,19 +8,18 @@ import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiTitle, EuiText, EuiSpacer } from '@elastic/eui'; -import { ImmutableArray } from '../../../../../../../common/types'; -import { getIn, setIn } from '../../../../models/policy_details_config'; import { EventsCheckbox } from './checkbox'; import { OS, UIPolicyConfig } from '../../../../types'; import { usePolicyDetailsSelector } from '../../policy_hooks'; import { selectedLinuxEvents, totalLinuxEvents } from '../../../../store/policy_details/selectors'; import { ConfigForm } from '../config_form'; +import { getIn, setIn } from '../../../../models/policy_details_config'; export const LinuxEvents = React.memo(() => { const selected = usePolicyDetailsSelector(selectedLinuxEvents); const total = usePolicyDetailsSelector(totalLinuxEvents); - const checkboxes: ImmutableArray<{ + const checkboxes: Array<{ name: string; os: 'linux'; protectionField: keyof UIPolicyConfig['linux']['events']; @@ -51,7 +50,7 @@ export const LinuxEvents = React.memo(() => { [] ); - const renderCheckboxes = useMemo(() => { + const renderCheckboxes = () => { return ( <> @@ -77,9 +76,9 @@ export const LinuxEvents = React.memo(() => { })} ); - }, [checkboxes]); + }; - const collectionsEnabled = useMemo(() => { + const collectionsEnabled = () => { return ( { /> ); - }, [selected, total]); + }; return ( [i18n.translate('xpack.endpoint.policy.details.linux', { defaultMessage: 'Linux' })], - [] - )} - id="linuxEventsForm" - rightCorner={collectionsEnabled} - children={renderCheckboxes} + supportedOss={[ + i18n.translate('xpack.endpoint.policy.details.linux', { defaultMessage: 'Linux' }), + ]} + id="linuxEventingForm" + rightCorner={collectionsEnabled()} + children={renderCheckboxes()} /> ); }); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/mac.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/mac.tsx index 5024d02603d77..3b69c21d2b150 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/mac.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/mac.tsx @@ -8,19 +8,18 @@ import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiTitle, EuiText, EuiSpacer } from '@elastic/eui'; -import { ImmutableArray } from '../../../../../../../common/types'; -import { getIn, setIn } from '../../../../models/policy_details_config'; import { EventsCheckbox } from './checkbox'; import { OS, UIPolicyConfig } from '../../../../types'; import { usePolicyDetailsSelector } from '../../policy_hooks'; import { selectedMacEvents, totalMacEvents } from '../../../../store/policy_details/selectors'; import { ConfigForm } from '../config_form'; +import { getIn, setIn } from '../../../../models/policy_details_config'; export const MacEvents = React.memo(() => { const selected = usePolicyDetailsSelector(selectedMacEvents); const total = usePolicyDetailsSelector(totalMacEvents); - const checkboxes: ImmutableArray<{ + const checkboxes: Array<{ name: string; os: 'mac'; protectionField: keyof UIPolicyConfig['mac']['events']; @@ -51,7 +50,7 @@ export const MacEvents = React.memo(() => { [] ); - const renderCheckboxes = useMemo(() => { + const renderCheckboxes = () => { return ( <> @@ -77,9 +76,9 @@ export const MacEvents = React.memo(() => { })} ); - }, [checkboxes]); + }; - const collectionsEnabled = useMemo(() => { + const collectionsEnabled = () => { return ( { /> ); - }, [selected, total]); + }; return ( [i18n.translate('xpack.endpoint.policy.details.mac', { defaultMessage: 'Mac' })], - [] - )} - id="macEventsForm" - rightCorner={collectionsEnabled} - children={renderCheckboxes} + supportedOss={[ + i18n.translate('xpack.endpoint.policy.details.mac', { defaultMessage: 'Mac' }), + ]} + id="macEventingForm" + rightCorner={collectionsEnabled()} + children={renderCheckboxes()} /> ); }); diff --git a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/windows.tsx b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/windows.tsx index 5b347ec387f48..da675dc1e2393 100644 --- a/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/windows.tsx +++ b/x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_forms/events/windows.tsx @@ -8,8 +8,6 @@ import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiTitle, EuiText, EuiSpacer } from '@elastic/eui'; -import { ImmutableArray } from '../../../../../../../common/types'; -import { setIn, getIn } from '../../../../models/policy_details_config'; import { EventsCheckbox } from './checkbox'; import { OS, UIPolicyConfig } from '../../../../types'; import { usePolicyDetailsSelector } from '../../policy_hooks'; @@ -18,12 +16,13 @@ import { totalWindowsEvents, } from '../../../../store/policy_details/selectors'; import { ConfigForm } from '../config_form'; +import { setIn, getIn } from '../../../../models/policy_details_config'; export const WindowsEvents = React.memo(() => { const selected = usePolicyDetailsSelector(selectedWindowsEvents); const total = usePolicyDetailsSelector(totalWindowsEvents); - const checkboxes: ImmutableArray<{ + const checkboxes: Array<{ name: string; os: 'windows'; protectionField: keyof UIPolicyConfig['windows']['events']; @@ -133,7 +132,7 @@ export const WindowsEvents = React.memo(() => { ], [] )} - id="windowsEventsForm" + id="windowsEventingForm" rightCorner={collectionsEnabled} children={renderCheckboxes} />