grafana/pkg/api/fakes.go
Torkel Ödegaard e31cb93ec0
NavTree: Make it possible to configure where in nav tree plugins live (#55484)
* NewIA: Plugin nav config

* progress

* Progress

* Things are working

* Add monitoring node

* Add alerts and incidents

* added experiment with standalone page

* Refactoring by adding a type for navtree root

* First test working

* More tests

* more tests

* Progress on richer config and sorting

* Sort weight working

* Path config

* Improving logic for not including admin or cfg nodes, making it the last step so that enterprise can add admin nodes without having to worry about the section not existing

* fixed index routes

* removed file

* Fixes

* Fixing tests

* Fixing more tests and adding support for weight config

* Updates

* Remove unused fake

* More fixes

* Minor tweak

* Minor fix

* Can now control position using sortweight even when existing items have no sortweight

* Added tests for frontend standalone page logic

* more tests

* Remove unused fake and fixed lint issue

* Moving reading settings to navtree impl package

* remove nav_id setting prefix

* Remove old test file

* Fix trailing newline

* Fixed bug with adding nil node

* fixing lint issue

* remove some code we have to rethink

* move read settings to PrivideService and switch to util.SplitString
2022-09-28 08:29:35 +02:00

54 lines
1.0 KiB
Go

package api
import (
"context"
"github.com/grafana/grafana/pkg/plugins"
)
type fakePluginInstaller struct {
plugins.Installer
plugins map[string]fakePlugin
}
type fakePlugin struct {
pluginID string
version string
}
func NewFakePluginInstaller() *fakePluginInstaller {
return &fakePluginInstaller{plugins: map[string]fakePlugin{}}
}
func (pm *fakePluginInstaller) Add(_ context.Context, pluginID, version string, _ plugins.CompatOpts) error {
pm.plugins[pluginID] = fakePlugin{
pluginID: pluginID,
version: version,
}
return nil
}
func (pm *fakePluginInstaller) Remove(_ context.Context, pluginID string) error {
delete(pm.plugins, pluginID)
return nil
}
type fakeRendererManager struct {
plugins.RendererManager
}
func (ps *fakeRendererManager) Renderer(_ context.Context) *plugins.Plugin {
return nil
}
type fakePluginStaticRouteResolver struct {
plugins.StaticRouteResolver
routes []*plugins.StaticRoute
}
func (psrr *fakePluginStaticRouteResolver) Routes() []*plugins.StaticRoute {
return psrr.routes
}