Alerting: Fix saving advanced mode toggle state in the alert rule editor (#95924)

This commit is contained in:
Alexander Akhmetov
2024-11-06 18:39:15 +01:00
committed by GitHub
parent 70c21a2e4d
commit 4ce1abc6f9
4 changed files with 32 additions and 5 deletions
@@ -313,13 +313,16 @@ func ValidateRuleGroup(
uids[rule.UID] = idx
}
var hasPause, isPaused bool
var hasPause, isPaused, hasMetadata bool
original := ruleGroupConfig.Rules[idx]
if alert := original.GrafanaManagedAlert; alert != nil {
if alert.IsPaused != nil {
isPaused = *alert.IsPaused
hasPause = true
}
if alert.Metadata != nil {
hasMetadata = true
}
}
ruleWithOptionals := ngmodels.AlertRuleWithOptionals{}
@@ -327,6 +330,7 @@ func ValidateRuleGroup(
rule.RuleGroupIndex = idx + 1
ruleWithOptionals.AlertRule = *rule
ruleWithOptionals.HasPause = hasPause
ruleWithOptionals.HasMetadata = hasMetadata
result = append(result, &ruleWithOptionals)
}