Skip to content

Commit

Permalink
[ML] Fix "Exclude jobs or groups" control (elastic#111525) (elastic#1…
Browse files Browse the repository at this point in the history
…11544)

Co-authored-by: Dima Arnautov <dmitrii.arnautov@elastic.co>
  • Loading branch information
kibanamachine and darnautov committed Sep 8, 2021
1 parent 066624f commit 92a9a6c
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<MlAnomalyDetectionJobsHealthRuleParams>;

Expand Down Expand Up @@ -79,6 +80,19 @@ const AnomalyDetectionJobsHealthRuleTrigger: FC<MlAnomalyAlertTriggerProps> = ({
}),
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! })),
},
]);
});
},
Expand Down

0 comments on commit 92a9a6c

Please sign in to comment.