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
… (#62992)
  • Loading branch information
Zacqary committed Apr 9, 2020
1 parent f5c8904 commit 27e54a3
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 27e54a3

Please sign in to comment.