Alerting: improve error on failure to remove query referenced by legacy alerting (#42169)

* Improve error and add test

* praise the linter!

* pr feedback

* guard against nil

* getters and setters

* Use IsEnabled instead of accessing struct
This commit is contained in:
David Parrott
2021-12-02 07:41:24 -08:00
committed by GitHub
parent e061cbd25b
commit a53b78df0c
4 changed files with 223 additions and 2 deletions
+1 -1
View File
@@ -345,7 +345,7 @@ func (hs *HTTPServer) postDashboard(c *models.ReqContext, cmd models.SaveDashboa
}
dashSvc := dashboards.NewService(hs.SQLStore)
dashboard, err := dashSvc.SaveDashboard(ctx, dashItem, allowUiUpdate)
dashboard, err := dashSvc.SaveDashboard(alerting.WithUAEnabled(ctx, hs.Cfg.UnifiedAlerting.IsEnabled()), dashItem, allowUiUpdate)
if hs.Live != nil {
// Tell everyone listening that the dashboard changed