grafana/pkg/services/searchV2/stub.go
Artur Wierzbicki 18daa6754c
Previews: datasource permissions (#52747)
* Previews: datasource permissions

* lint

* simplify - force non-null `ds_uids`

* add `canBeDisabled` to search service

* add `IncludeThumbnailsWithEmptyDsUids`

* remove force refresh migration

* refactor main preview service

* add safeguard

* revert ticker interval

* update testdata

* fix test

* add mock search service

* add datasources lookup test

* update migration

* extract ds lookup to its own package to avoid cyclic imports

* lint

* fix dashbaord extract, use the real datasource lookup in tests. IS IT BULLETPROOF YET?!

* fix dashbaord extract, use the real datasource lookup in tests. IS IT BULLETPROOF YET?!

* remove stale log

* consistent casing

* pass context to `createServiceAccount`

* filter out the special grafana ds
2022-07-28 16:40:26 +04:00

47 lines
996 B
Go

package searchV2
import (
"context"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
)
type stubSearchService struct {
}
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
}