Alerting: Fix crash when viewing alert group without interval (#53166)

This commit is contained in:
Gilles De Mey
2022-08-03 08:22:52 +02:00
committed by GitHub
parent e1bb23a2d7
commit b7e11358cf
2 changed files with 6 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ interface RuleConfigStatusProps {
export function RuleConfigStatus({ rule }: RuleConfigStatusProps) {
const styles = useStyles2(getStyles);
const { exceedsLimit } = checkEvaluationIntervalGlobalLimit(rule.group.interval ?? '');
const { exceedsLimit } = checkEvaluationIntervalGlobalLimit(rule.group.interval);
if (!exceedsLimit) {
return null;

View File

@@ -5,7 +5,11 @@ export function getAllDataSources(): Array<DataSourceInstanceSettings<DataSource
return Object.values(config.datasources);
}
export function checkEvaluationIntervalGlobalLimit(alertGroupEvaluateEvery: string) {
export function checkEvaluationIntervalGlobalLimit(alertGroupEvaluateEvery?: string) {
if (!alertGroupEvaluateEvery) {
return { globalLimit: 0, exceedsLimit: false };
}
if (!isValidGoDuration(config.unifiedAlerting.minInterval)) {
return { globalLimit: 0, exceedsLimit: false };
}