Plugins: Plugin Store API returns DTO model (#41340)
* toying around * fix refs * remove unused fields * go further * add context * ensure streaming handler is set
This commit is contained in:
+22
-5
@@ -1,17 +1,34 @@
|
||||
package api
|
||||
|
||||
import "github.com/grafana/grafana/pkg/plugins"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
)
|
||||
|
||||
type fakePluginStore struct {
|
||||
plugins.Store
|
||||
|
||||
plugins map[string]plugins.PluginDTO
|
||||
}
|
||||
|
||||
func (ps *fakePluginStore) Plugin(pluginID string) *plugins.Plugin {
|
||||
return nil
|
||||
func (pr fakePluginStore) Plugin(_ context.Context, pluginID string) (plugins.PluginDTO, bool) {
|
||||
p, exists := pr.plugins[pluginID]
|
||||
|
||||
return p, exists
|
||||
}
|
||||
|
||||
func (ps *fakePluginStore) Plugins(pluginType ...plugins.Type) []*plugins.Plugin {
|
||||
return nil
|
||||
func (pr fakePluginStore) Plugins(_ context.Context, pluginTypes ...plugins.Type) []plugins.PluginDTO {
|
||||
var result []plugins.PluginDTO
|
||||
for _, v := range pr.plugins {
|
||||
for _, t := range pluginTypes {
|
||||
if v.Type == t {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
type fakeRendererManager struct {
|
||||
|
||||
Reference in New Issue
Block a user