mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Core plugins register via backend factory provider (#43171)
* refactoring store interface and init flow * fix import * fix linter * refactor resource calling * load with class * re-order args * fix tests * fix linter * remove old creator * add custom config struct * fix some tests * cleanup * fix * tackle plugins * fix linter * refactor and fix test * add connect failure error * add fix for azure, cloud monitoring and test data * restructure * remove unused err * add fake tracer for test * fix grafana ds plugin
This commit is contained in:
@@ -85,7 +85,7 @@ func writeResponse(rw http.ResponseWriter, code int, msg string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) resourceHandler(subDataSource string) func(rw http.ResponseWriter, req *http.Request) {
|
||||
func (s *Service) handleResourceReq(subDataSource string) func(rw http.ResponseWriter, req *http.Request) {
|
||||
return func(rw http.ResponseWriter, req *http.Request) {
|
||||
azlog.Debug("Received resource call", "url", req.URL.String(), "method", req.Method)
|
||||
|
||||
@@ -115,11 +115,13 @@ func (s *Service) resourceHandler(subDataSource string) func(rw http.ResponseWri
|
||||
}
|
||||
}
|
||||
|
||||
// registerRoutes provides route definitions shared with the frontend.
|
||||
// newResourceMux provides route definitions shared with the frontend.
|
||||
// Check: /public/app/plugins/datasource/grafana-azure-monitor-datasource/utils/common.ts <routeNames>
|
||||
func (s *Service) registerRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("/azuremonitor/", s.resourceHandler(azureMonitor))
|
||||
mux.HandleFunc("/appinsights/", s.resourceHandler(appInsights))
|
||||
mux.HandleFunc("/loganalytics/", s.resourceHandler(azureLogAnalytics))
|
||||
mux.HandleFunc("/resourcegraph/", s.resourceHandler(azureResourceGraph))
|
||||
func (s *Service) newResourceMux() *http.ServeMux {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/azuremonitor/", s.handleResourceReq(azureMonitor))
|
||||
mux.HandleFunc("/appinsights/", s.handleResourceReq(appInsights))
|
||||
mux.HandleFunc("/loganalytics/", s.handleResourceReq(azureLogAnalytics))
|
||||
mux.HandleFunc("/resourcegraph/", s.handleResourceReq(azureResourceGraph))
|
||||
return mux
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user