mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): add feature toggles for alerting functions
This commit is contained in:
parent
9d016a2756
commit
45b2b4bc52
@ -149,17 +149,19 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) {
|
||||
return
|
||||
}
|
||||
|
||||
saveAlertCommand := m.SaveAlertsCommand{
|
||||
DashboardId: cmd.Result.Id,
|
||||
OrgId: c.OrgId,
|
||||
UserId: c.UserId,
|
||||
Alerts: cmd.GetAlertModels(),
|
||||
}
|
||||
if setting.AlertingEnabled {
|
||||
saveAlertCommand := m.SaveAlertsCommand{
|
||||
DashboardId: cmd.Result.Id,
|
||||
OrgId: c.OrgId,
|
||||
UserId: c.UserId,
|
||||
Alerts: cmd.GetAlertModels(),
|
||||
}
|
||||
|
||||
err = bus.Dispatch(&saveAlertCommand)
|
||||
if err != nil {
|
||||
c.JsonApiErr(500, "Failed to save alerts", err)
|
||||
return
|
||||
err = bus.Dispatch(&saveAlertCommand)
|
||||
if err != nil {
|
||||
c.JsonApiErr(500, "Failed to save alerts", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
metrics.M_Api_Dashboard_Post.Inc(1)
|
||||
|
@ -1,8 +1,15 @@
|
||||
package migrations
|
||||
|
||||
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
import (
|
||||
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
func addAlertMigrations(mg *Migrator) {
|
||||
if !setting.AlertingEnabled {
|
||||
return
|
||||
}
|
||||
|
||||
alertV1 := Table{
|
||||
Name: "alert_rule",
|
||||
Columns: []*Column{
|
||||
|
Loading…
Reference in New Issue
Block a user