[v11.3.x] Alerting: Fix saving advanced mode toggle state in the alert rule editor (#95981)
Alerting: Fix saving advanced mode toggle state in the alert rule editor (#95924)
(cherry picked from commit 4ce1abc6f9)
Co-authored-by: Alexander Akhmetov <me@alx.cx>
This commit is contained in:
co-authored by
Alexander Akhmetov
parent
8273628550
commit
0e0a2c0371
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user