NGAlert: Send list of available ngalert notification channels via API (#33489)
Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>
This commit is contained in:
+10
-2
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/alerting"
|
||||
"github.com/grafana/grafana/pkg/services/guardian"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/notifier"
|
||||
"github.com/grafana/grafana/pkg/services/search"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
@@ -179,8 +180,15 @@ func GetAlert(c *models.ReqContext) response.Response {
|
||||
return response.JSON(200, &query.Result)
|
||||
}
|
||||
|
||||
func GetAlertNotifiers(c *models.ReqContext) response.Response {
|
||||
return response.JSON(200, alerting.GetNotifiers())
|
||||
func GetAlertNotifiers(ngalertEnabled bool) func(*models.ReqContext) response.Response {
|
||||
return func(_ *models.ReqContext) response.Response {
|
||||
if ngalertEnabled {
|
||||
return response.JSON(200, notifier.GetAvailableNotifiers())
|
||||
}
|
||||
// TODO(codesome): This wont be required in 8.0 since ngalert
|
||||
// will be enabled by default with no disabling. This is to be removed later.
|
||||
return response.JSON(200, alerting.GetNotifiers())
|
||||
}
|
||||
}
|
||||
|
||||
func GetAlertNotificationLookup(c *models.ReqContext) response.Response {
|
||||
|
||||
Reference in New Issue
Block a user