diff --git a/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx b/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx index 3cb2a2d426a5..d8643c95ce92 100644 --- a/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx +++ b/x-pack/plugins/ml/public/alerting/jobs_health_rule/anomaly_detection_jobs_health_rule_trigger.tsx @@ -20,6 +20,7 @@ import { TestsSelectionControl } from './tests_selection_control'; import { isPopulatedObject } from '../../../common'; import { ALL_JOBS_SELECTION } from '../../../common/constants/alerts'; import { BetaBadge } from '../beta_badge'; +import { isDefined } from '../../../common/types/guards'; export type MlAnomalyAlertTriggerProps = AlertTypeParamsExpressionProps; @@ -79,6 +80,19 @@ const AnomalyDetectionJobsHealthRuleTrigger: FC = ({ }), options: jobs.map((v) => ({ label: v.job_id })), }, + { + label: i18n.translate('xpack.ml.jobSelector.groupOptionsLabel', { + defaultMessage: 'Groups', + }), + options: [ + ...new Set( + jobs + .map((v) => v.groups) + .flat() + .filter((v) => isDefined(v) && !alertParams.includeJobs.groupIds?.includes(v)) + ), + ].map((v) => ({ label: v! })), + }, ]); }); },