mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 05:29:42 -06:00
e31cb93ec0
* 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
39 lines
631 B
Go
39 lines
631 B
Go
package plugins
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type FakePluginStore struct {
|
|
Store
|
|
|
|
PluginList []PluginDTO
|
|
}
|
|
|
|
func (pr FakePluginStore) Plugin(_ context.Context, pluginID string) (PluginDTO, bool) {
|
|
for _, v := range pr.PluginList {
|
|
if v.ID == pluginID {
|
|
return v, true
|
|
}
|
|
}
|
|
|
|
return PluginDTO{}, false
|
|
}
|
|
|
|
func (pr FakePluginStore) Plugins(_ context.Context, pluginTypes ...Type) []PluginDTO {
|
|
var result []PluginDTO
|
|
if len(pluginTypes) == 0 {
|
|
pluginTypes = PluginTypes
|
|
}
|
|
|
|
for _, v := range pr.PluginList {
|
|
for _, t := range pluginTypes {
|
|
if v.Type == t {
|
|
result = append(result, v)
|
|
}
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|