[Metrics UI] Invalidate non-count alerts which have no metrics (#62837)
This commit is contained in:
parent
1c718d6760
commit
cbe479b8bd
|
@ -23,6 +23,7 @@ export function validateMetricThreshold({
|
|||
timeWindowSize: string[];
|
||||
threshold0: string[];
|
||||
threshold1: string[];
|
||||
metric: string[];
|
||||
};
|
||||
} = {};
|
||||
validationResult.errors = errors;
|
||||
|
@ -41,6 +42,7 @@ export function validateMetricThreshold({
|
|||
timeWindowSize: [],
|
||||
threshold0: [],
|
||||
threshold1: [],
|
||||
metric: [],
|
||||
};
|
||||
if (!c.aggType) {
|
||||
errors[id].aggField.push(
|
||||
|
@ -73,6 +75,14 @@ export function validateMetricThreshold({
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (!c.metric && c.aggType !== 'count') {
|
||||
errors[id].metric.push(
|
||||
i18n.translate('xpack.infra.metrics.alertFlyout.error.metricRequired', {
|
||||
defaultMessage: 'Metric is required.',
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return validationResult;
|
||||
|
|
Loading…
Reference in a new issue