remove bus from search and avoid import cycle (#46789)
* fix the import cicle * fix some unittest * fix removal bus from search
This commit is contained in:
+2
-2
@@ -89,7 +89,7 @@ func (hs *HTTPServer) GetAlerts(c *models.ReqContext) response.Response {
|
||||
Limit: 1000,
|
||||
OrgId: c.OrgId,
|
||||
DashboardIds: dashboardIDs,
|
||||
Type: string(search.DashHitDB),
|
||||
Type: string(models.DashHitDB),
|
||||
FolderIds: folderIDs,
|
||||
Permission: models.PERMISSION_VIEW,
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (hs *HTTPServer) GetAlerts(c *models.ReqContext) response.Response {
|
||||
}
|
||||
|
||||
for _, d := range searchQuery.Result {
|
||||
if d.Type == search.DashHitDB && d.ID > 0 {
|
||||
if d.Type == models.DashHitDB && d.ID > 0 {
|
||||
dashboardIDs = append(dashboardIDs, d.ID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ type setUpConf struct {
|
||||
aclMockResp []*models.DashboardAclInfoDTO
|
||||
}
|
||||
|
||||
type mockSearchService struct{ ExpectedResult search.HitList }
|
||||
type mockSearchService struct{ ExpectedResult models.HitList }
|
||||
|
||||
func (mss *mockSearchService) SearchHandler(_ context.Context, q *search.Query) error {
|
||||
q.Result = mss.ExpectedResult
|
||||
return nil
|
||||
}
|
||||
func (mss *mockSearchService) SortOptions() []search.SortOption { return nil }
|
||||
func (mss *mockSearchService) SortOptions() []models.SortOption { return nil }
|
||||
|
||||
func setUp(confs ...setUpConf) *HTTPServer {
|
||||
singleAlert := &models.Alert{Id: 1, DashboardId: 1, Name: "singlealert"}
|
||||
@@ -94,9 +94,9 @@ func TestAlertingAPIEndpoint(t *testing.T) {
|
||||
loggedInUserScenarioWithRole(t, "When calling GET on", "GET",
|
||||
"/api/alerts?dashboardId=1&dashboardId=2&folderId=3&dashboardTag=abc&dashboardQuery=dbQuery&limit=5&query=alertQuery",
|
||||
"/api/alerts", models.ROLE_EDITOR, func(sc *scenarioContext) {
|
||||
hs.SearchService.(*mockSearchService).ExpectedResult = search.HitList{
|
||||
&search.Hit{ID: 1},
|
||||
&search.Hit{ID: 2},
|
||||
hs.SearchService.(*mockSearchService).ExpectedResult = models.HitList{
|
||||
&models.Hit{ID: 1},
|
||||
&models.Hit{ID: 2},
|
||||
}
|
||||
|
||||
sc.handlerFunc = hs.GetAlerts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package definitions
|
||||
|
||||
import "github.com/grafana/grafana/pkg/services/search"
|
||||
import "github.com/grafana/grafana/pkg/models"
|
||||
|
||||
// swagger:route GET /search/sorting search searchSorting
|
||||
//
|
||||
@@ -75,7 +75,7 @@ type SearchParameters struct {
|
||||
// swagger:response searchResponse
|
||||
type SearchResponse struct {
|
||||
// in: body
|
||||
Body search.HitList `json:"body"`
|
||||
Body models.HitList `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response searchSortingResponse
|
||||
|
||||
Reference in New Issue
Block a user