mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remove bus from search service (#44825)
This commit is contained in:
parent
3ce0730558
commit
c5211f848d
@ -373,7 +373,7 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
|
||||
// Search
|
||||
apiRoute.Get("/search/sorting", routing.Wrap(hs.ListSortOptions))
|
||||
apiRoute.Get("/search/", routing.Wrap(Search))
|
||||
apiRoute.Get("/search/", routing.Wrap(hs.Search))
|
||||
|
||||
// metrics
|
||||
apiRoute.Post("/tsdb/query", authorize(reqSignedIn, ac.EvalPermission(ActionDatasourcesQuery)), routing.Wrap(hs.QueryMetrics))
|
||||
|
@ -7,13 +7,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/search"
|
||||
)
|
||||
|
||||
func Search(c *models.ReqContext) response.Response {
|
||||
func (hs *HTTPServer) Search(c *models.ReqContext) response.Response {
|
||||
query := c.Query("query")
|
||||
tags := c.QueryStrings("tag")
|
||||
starred := c.Query("starred")
|
||||
@ -62,7 +61,7 @@ func Search(c *models.ReqContext) response.Response {
|
||||
Sort: sort,
|
||||
}
|
||||
|
||||
err := bus.Dispatch(c.Req.Context(), &searchQuery)
|
||||
err := hs.SearchService.SearchHandler(c.Req.Context(), &searchQuery)
|
||||
if err != nil {
|
||||
return response.Error(500, "Search failed", err)
|
||||
}
|
||||
|
@ -60,9 +60,8 @@ type FindPersistedDashboardsQuery struct {
|
||||
}
|
||||
|
||||
type SearchService struct {
|
||||
Bus bus.Bus
|
||||
Cfg *setting.Cfg
|
||||
|
||||
Bus bus.Bus
|
||||
Cfg *setting.Cfg
|
||||
sortOptions map[string]SortOption
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user