feat(alerting): add feature toggles for alerting functions
This commit is contained in:
+12
-10
@@ -149,17 +149,19 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAlertCommand := m.SaveAlertsCommand{
|
if setting.AlertingEnabled {
|
||||||
DashboardId: cmd.Result.Id,
|
saveAlertCommand := m.SaveAlertsCommand{
|
||||||
OrgId: c.OrgId,
|
DashboardId: cmd.Result.Id,
|
||||||
UserId: c.UserId,
|
OrgId: c.OrgId,
|
||||||
Alerts: cmd.GetAlertModels(),
|
UserId: c.UserId,
|
||||||
}
|
Alerts: cmd.GetAlertModels(),
|
||||||
|
}
|
||||||
|
|
||||||
err = bus.Dispatch(&saveAlertCommand)
|
err = bus.Dispatch(&saveAlertCommand)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JsonApiErr(500, "Failed to save alerts", err)
|
c.JsonApiErr(500, "Failed to save alerts", err)
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics.M_Api_Dashboard_Post.Inc(1)
|
metrics.M_Api_Dashboard_Post.Inc(1)
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
package migrations
|
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) {
|
func addAlertMigrations(mg *Migrator) {
|
||||||
|
if !setting.AlertingEnabled {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
alertV1 := Table{
|
alertV1 := Table{
|
||||||
Name: "alert_rule",
|
Name: "alert_rule",
|
||||||
Columns: []*Column{
|
Columns: []*Column{
|
||||||
|
|||||||
Reference in New Issue
Block a user