mirror of
https://github.com/grafana/grafana.git
synced 2024-12-30 10:47:30 -06:00
f8d69415ca
* search: create a separate http endpoint * search: extract api uri * search: rename uri * search: replicate the readiness check * search: replicate the readiness check metric * search: update mock
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package searchV2
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
|
"github.com/grafana/grafana-plugin-sdk-go/data"
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
)
|
|
|
|
type stubSearchService struct {
|
|
}
|
|
|
|
func (s *stubSearchService) doDashboardQuery(ctx context.Context, user *user.SignedInUser, orgId int64, query DashboardQuery) *backend.DataResponse {
|
|
return s.DoDashboardQuery(ctx, nil, orgId, query)
|
|
}
|
|
|
|
func (s *stubSearchService) IsReady(ctx context.Context, orgId int64) IsSearchReadyResponse {
|
|
return IsSearchReadyResponse{}
|
|
}
|
|
|
|
func (s *stubSearchService) IsDisabled() bool {
|
|
return true
|
|
}
|
|
|
|
func (s *stubSearchService) TriggerReIndex() {
|
|
// noop.
|
|
}
|
|
|
|
func NewStubSearchService() SearchService {
|
|
return &stubSearchService{}
|
|
}
|
|
|
|
func (s *stubSearchService) DoDashboardQuery(ctx context.Context, user *backend.User, orgId int64, query DashboardQuery) *backend.DataResponse {
|
|
rsp := &backend.DataResponse{}
|
|
|
|
// dashboards
|
|
fid := data.NewFieldFromFieldType(data.FieldTypeInt64, 0)
|
|
uid := data.NewFieldFromFieldType(data.FieldTypeString, 0)
|
|
|
|
fid.Append(int64(2))
|
|
uid.Append("hello")
|
|
|
|
rsp.Frames = append(rsp.Frames, data.NewFrame("dasboards", fid, uid))
|
|
|
|
return rsp
|
|
}
|
|
|
|
func (s *stubSearchService) RegisterDashboardIndexExtender(ext DashboardIndexExtender) {
|
|
// noop
|
|
}
|
|
|
|
func (s *stubSearchService) Run(_ context.Context) error {
|
|
return nil
|
|
}
|