diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware.ts b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware.ts index 250a5b25230f..36649d22f730 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/store/policy_details/middleware.ts @@ -36,6 +36,13 @@ export const policyDetailsMiddlewareFactory: ImmutableMiddlewareFactory { const selected = policyDetailsConfig && policyDetailsConfig.windows.malware.mode; const userNotificationSelected = policyDetailsConfig && policyDetailsConfig.windows.popup.malware.enabled; + const userNotificationMessage = + policyDetailsConfig && policyDetailsConfig.windows.popup.malware.message; const radios: Immutable { [policyDetailsConfig, dispatch] ); + const handleCustomUserNotification = useCallback( + (event) => { + if (policyDetailsConfig) { + const newPayload = cloneDeep(policyDetailsConfig); + for (const os of OSes) { + newPayload[os].popup[protection].message = event.target.value.trim(); + } + dispatch({ + type: 'userChangedPolicyConfig', + payload: { policyConfig: newPayload }, + }); + } + }, + [policyDetailsConfig, dispatch] + ); + const radioButtons = useMemo(() => { return ( <> - -
+ +
-
+
@@ -202,13 +221,13 @@ export const MalwareProtections = React.memo(() => { })} - -
+ +
-
+
@@ -220,9 +239,40 @@ export const MalwareProtections = React.memo(() => { defaultMessage: 'Notify User', })} /> + {userNotificationSelected && ( + <> + + +

+ +

+
+ + + + )} ); - }, [radios, handleUserNotificationCheckbox, userNotificationSelected]); + }, [ + radios, + handleUserNotificationCheckbox, + userNotificationSelected, + userNotificationMessage, + handleCustomUserNotification, + ]); const protectionSwitch = useMemo(() => { return ( diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts index 6af9ac2650e8..15c26a1b9374 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts @@ -199,7 +199,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { popup: { malware: { enabled: true, - message: '', + message: 'Elastic Security { action } { filename }', }, }, }, @@ -218,7 +218,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { popup: { malware: { enabled: true, - message: '', + message: 'Elastic Security { action } { filename }', }, }, },