mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 11:44:26 -06:00
e4297006f6
* context all the things * apply feedback * rollback some alerting changes * rollback some alerting changes #2 * more rollbacks * more rollbacks #2 * more rollbacks #3 * more rollbacks #4 * fix integration test * add missing context * add missing and remove incorrect dispatch
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/grafana/grafana/pkg/api/response"
|
|
"github.com/grafana/grafana/pkg/models"
|
|
)
|
|
|
|
func (hs *HTTPServer) AdminProvisioningReloadDashboards(c *models.ReqContext) response.Response {
|
|
err := hs.ProvisioningService.ProvisionDashboards(c.Req.Context())
|
|
if err != nil && !errors.Is(err, context.Canceled) {
|
|
return response.Error(500, "", err)
|
|
}
|
|
return response.Success("Dashboards config reloaded")
|
|
}
|
|
|
|
func (hs *HTTPServer) AdminProvisioningReloadDatasources(c *models.ReqContext) response.Response {
|
|
err := hs.ProvisioningService.ProvisionDatasources(c.Req.Context())
|
|
if err != nil {
|
|
return response.Error(500, "", err)
|
|
}
|
|
return response.Success("Datasources config reloaded")
|
|
}
|
|
|
|
func (hs *HTTPServer) AdminProvisioningReloadPlugins(c *models.ReqContext) response.Response {
|
|
err := hs.ProvisioningService.ProvisionPlugins()
|
|
if err != nil {
|
|
return response.Error(500, "Failed to reload plugins config", err)
|
|
}
|
|
return response.Success("Plugins config reloaded")
|
|
}
|
|
|
|
func (hs *HTTPServer) AdminProvisioningReloadNotifications(c *models.ReqContext) response.Response {
|
|
err := hs.ProvisioningService.ProvisionNotifications()
|
|
if err != nil {
|
|
return response.Error(500, "", err)
|
|
}
|
|
return response.Success("Notifications config reloaded")
|
|
}
|