API: Do not validate/save legacy alerts when saving a dashboard if legacy alerting is disabled (#51883) (#52137)

* API: Do not validate/save legacy alerts if legacy alerting is disabled

Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
(cherry picked from commit b3992df988)

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-07-13 05:52:32 -04:00
committed by GitHub
co-authored by Sofia Papagiannaki
parent 7d8fbb83f4
commit f3f66f6325
3 changed files with 56 additions and 26 deletions
+6
View File
@@ -1436,6 +1436,12 @@ func readAlertingSettings(iniFile *ini.File) error {
return nil
}
// IsLegacyAlertingEnabled returns whether the legacy alerting is enabled or not.
// It's safe to be used only after readAlertingSettings() and ReadUnifiedAlertingSettings() are executed.
func IsLegacyAlertingEnabled() bool {
return AlertingEnabled != nil && *AlertingEnabled
}
func readSnapshotsSettings(cfg *Cfg, iniFile *ini.File) error {
snapshots := iniFile.Section("snapshots")