Plugins: Refactor creation of plugin context to dedicated service (#66451)

* first pass

* fix tests

* return errs

* change signature

* tidy

* delete unnecessary fields from test

* tidy

* fix tests

* simplify

* separate error check in API

* apply nits
This commit is contained in:
Will Browne
2023-06-08 13:59:51 +02:00
committed by GitHub
parent 49ad802ca6
commit 624777258b
25 changed files with 308 additions and 261 deletions
+2 -7
View File
@@ -9,6 +9,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/user"
)
// Request is similar to plugins.DataQuery but with the Time Ranges is per Query.
@@ -17,7 +18,7 @@ type Request struct {
Debug bool
OrgId int64
Queries []Query
User *backend.User
User *user.SignedInUser
}
// Query is like plugins.DataSubQuery, but with a a time range, and only the UID
@@ -136,9 +137,3 @@ func hiddenRefIDs(queries []Query) (map[string]struct{}, error) {
}
return hidden, nil
}
func (s *Service) decryptSecureJsonDataFn(ctx context.Context) func(ds *datasources.DataSource) (map[string]string, error) {
return func(ds *datasources.DataSource) (map[string]string, error) {
return s.dataSourceService.DecryptedValues(ctx, ds)
}
}