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