Skip to content

Commit

Permalink
[Metrics UI] Invalidate non-count alerts which have no metrics (#62837)…
Browse files Browse the repository at this point in the history
… (#62993)
  • Loading branch information
Zacqary authored Apr 9, 2020
1 parent 3fb7bf3 commit 69fc518
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function validateMetricThreshold({
timeWindowSize: string[];
threshold0: string[];
threshold1: string[];
metric: string[];
};
} = {};
validationResult.errors = errors;
Expand All @@ -41,6 +42,7 @@ export function validateMetricThreshold({
timeWindowSize: [],
threshold0: [],
threshold1: [],
metric: [],
};
if (!c.aggType) {
errors[id].aggField.push(
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 69fc518

Please sign in to comment.