[ML] Fix "Exclude jobs or groups" control (#111525)
This commit is contained in:
parent
eb9a0fcc17
commit
d1f2e37902
|
@ -20,6 +20,7 @@ import { TestsSelectionControl } from './tests_selection_control';
|
||||||
import { isPopulatedObject } from '../../../common';
|
import { isPopulatedObject } from '../../../common';
|
||||||
import { ALL_JOBS_SELECTION } from '../../../common/constants/alerts';
|
import { ALL_JOBS_SELECTION } from '../../../common/constants/alerts';
|
||||||
import { BetaBadge } from '../beta_badge';
|
import { BetaBadge } from '../beta_badge';
|
||||||
|
import { isDefined } from '../../../common/types/guards';
|
||||||
|
|
||||||
export type MlAnomalyAlertTriggerProps = AlertTypeParamsExpressionProps<MlAnomalyDetectionJobsHealthRuleParams>;
|
export type MlAnomalyAlertTriggerProps = AlertTypeParamsExpressionProps<MlAnomalyDetectionJobsHealthRuleParams>;
|
||||||
|
|
||||||
|
@ -79,6 +80,19 @@ const AnomalyDetectionJobsHealthRuleTrigger: FC<MlAnomalyAlertTriggerProps> = ({
|
||||||
}),
|
}),
|
||||||
options: jobs.map((v) => ({ label: v.job_id })),
|
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! })),
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue