diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/alert_suppression_edit/components/alert_suppression_edit.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/alert_suppression_edit/components/alert_suppression_edit.tsx index 5c6099529e920..d7cea2a00ba65 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/alert_suppression_edit/components/alert_suppression_edit.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/alert_suppression_edit/components/alert_suppression_edit.tsx @@ -54,11 +54,9 @@ export const AlertSuppressionEdit = memo(function AlertSuppressionEdit({ ); - return disabled && disabledText ? ( - + return ( + {content} - ) : ( - content ); }); diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/multi_select_fields/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/multi_select_fields/index.tsx index 8a27d2f668094..4b5a764d1e600 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/multi_select_fields/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation_ui/components/multi_select_fields/index.tsx @@ -5,8 +5,9 @@ * 2.0. */ -import React, { useMemo } from 'react'; +import React, { useEffect, useMemo, useRef } from 'react'; import type { DataViewFieldBase } from '@kbn/es-query'; +import type { EuiComboBox } from '@elastic/eui'; import { ComboBoxField } from '@kbn/es-ui-shared-plugin/static/forms/components'; import type { FieldHook } from '../../../../shared_imports'; import { FIELD_PLACEHOLDER } from './translations'; @@ -30,6 +31,7 @@ export const MultiSelectAutocompleteComponent: React.FC { + const comboBoxRef = useRef>(); const fieldEuiFieldProps = useMemo( () => ({ fullWidth: true, @@ -39,10 +41,24 @@ export const MultiSelectAutocompleteComponent: React.FC { + if (isDisabled) { + comboBoxRef.current?.closeList(); + } + }, [isDisabled]); + return ( { + if (!ruleType || ruleType === previousRuleType) { + return; + } + form.updateFieldValues({ [THRESHOLD_ALERT_SUPPRESSION_ENABLED]: thresholdAlertSuppressionEnabled, [ALERT_SUPPRESSION_FIELDS_FIELD_NAME]: suppressionFields, @@ -68,6 +74,7 @@ export function usePersistentAlertSuppressionState({ }, [ form, ruleType, + previousRuleType, thresholdAlertSuppressionEnabled, suppressionFields, suppressionDurationType,