mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
42b745a098
* Add api to reaload provisioning * Refactor and simplify the polling code * Add test for the provisioning service * Fix provider initialization and move some code to file reader * Simplify the code and move initialization * Remove unused code * Update comment * Add comment * Change error messages * Add DashboardProvisionerFactory type * Update imports * Use new assert lib * Use mutext for synchronizing the reloading * Fix typo Co-Authored-By: aocenas <mr.ocenas@gmail.com> * Add docs about the new api
31 lines
858 B
Go
31 lines
858 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"github.com/grafana/grafana/pkg/models"
|
|
)
|
|
|
|
func (server *HTTPServer) AdminProvisioningReloadDasboards(c *models.ReqContext) Response {
|
|
err := server.ProvisioningService.ProvisionDashboards()
|
|
if err != nil && err != context.Canceled {
|
|
return Error(500, "", err)
|
|
}
|
|
return Success("Dashboards config reloaded")
|
|
}
|
|
|
|
func (server *HTTPServer) AdminProvisioningReloadDatasources(c *models.ReqContext) Response {
|
|
err := server.ProvisioningService.ProvisionDatasources()
|
|
if err != nil {
|
|
return Error(500, "", err)
|
|
}
|
|
return Success("Datasources config reloaded")
|
|
}
|
|
|
|
func (server *HTTPServer) AdminProvisioningReloadNotifications(c *models.ReqContext) Response {
|
|
err := server.ProvisioningService.ProvisionNotifications()
|
|
if err != nil {
|
|
return Error(500, "", err)
|
|
}
|
|
return Success("Notifications config reloaded")
|
|
}
|