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

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

Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
This commit is contained in:
Sofia Papagiannaki
2022-07-13 12:33:28 +03:00
committed by GitHub
co-authored by Ida Furjesova
parent c4c7908f51
commit b3992df988
3 changed files with 56 additions and 26 deletions
+6
View File
@@ -1445,6 +1445,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")