2022-02-15 10:26:03 -08:00
|
|
|
package searchV2
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/data"
|
2023-01-30 09:57:50 +01:00
|
|
|
|
2022-09-23 01:02:09 +02:00
|
|
|
"github.com/grafana/grafana/pkg/services/user"
|
2022-02-15 10:26:03 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type stubSearchService struct {
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-23 01:02:09 +02:00
|
|
|
func (s *stubSearchService) doDashboardQuery(ctx context.Context, user *user.SignedInUser, orgId int64, query DashboardQuery) *backend.DataResponse {
|
|
|
|
|
return s.DoDashboardQuery(ctx, nil, orgId, query)
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-26 12:36:41 +04:00
|
|
|
func (s *stubSearchService) IsReady(ctx context.Context, orgId int64) IsSearchReadyResponse {
|
|
|
|
|
return IsSearchReadyResponse{}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-28 16:40:26 +04:00
|
|
|
func (s *stubSearchService) IsDisabled() bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-27 18:11:08 +03:00
|
|
|
func (s *stubSearchService) TriggerReIndex() {
|
|
|
|
|
// noop.
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 10:26:03 -08:00
|
|
|
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
|
|
|
|
|
}
|
2022-04-27 12:29:39 +04:00
|
|
|
|
2022-05-19 12:46:18 -04:00
|
|
|
func (s *stubSearchService) RegisterDashboardIndexExtender(ext DashboardIndexExtender) {
|
|
|
|
|
// noop
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-27 12:29:39 +04:00
|
|
|
func (s *stubSearchService) Run(_ context.Context) error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|