[Detection Engine] Prevent ML job status warning from being displayed for non-ML rule types (#189003)

Followup to https://github.com/elastic/kibana/pull/188267. A demo
instance with these changes can be found
[here](https://rylnd-pr-189003-fix-sticky-ml-warning.kbndev.co/app/security/rules/create).

When not all ML jobs are started, we display a message conveying that
the list of suppression fields might not be complete. In the case of a
non-ML rule, this warning isn't helpful and should be hidden. It also
only shows the warning if one more more ML jobs have been selected.
This commit is contained in:
Ryland Herrick 2024-07-25 14:07:45 -05:00 committed by GitHub
parent 42c5d918d3
commit 7aec3f775c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,6 +209,9 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
mlSuppressionFields,
} = useMLRuleConfig({ machineLearningJobId });
const isMlSuppressionIncomplete =
isMlRule(ruleType) && machineLearningJobId?.length > 0 && !allJobsStarted;
const esqlQueryRef = useRef<DefineStepRule['queryBar'] | undefined>(undefined);
const isAlertSuppressionLicenseValid = license.isAtLeast(MINIMUM_LICENSE_FOR_SUPPRESSION);
@ -1087,7 +1090,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
disabledText: suppressionGroupByDisabledText,
}}
/>
{!allJobsStarted && (
{isMlSuppressionIncomplete && (
<EuiText size="xs" color="warning">
{i18n.MACHINE_LEARNING_SUPPRESSION_INCOMPLETE_LABEL}
</EuiText>