mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 00:32:21 +08:00
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
This commit is contained in:
@ -175,10 +175,8 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
requestedFile: {},
|
||||
},
|
||||
}
|
||||
service := &fakePluginStore{
|
||||
plugins: map[string]plugins.PluginDTO{
|
||||
pluginID: p,
|
||||
},
|
||||
service := &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{p},
|
||||
}
|
||||
l := &logtest.Fake{}
|
||||
|
||||
@ -200,10 +198,8 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
},
|
||||
PluginDir: pluginDir,
|
||||
}
|
||||
service := &fakePluginStore{
|
||||
plugins: map[string]plugins.PluginDTO{
|
||||
pluginID: p,
|
||||
},
|
||||
service := &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{p},
|
||||
}
|
||||
l := &logtest.Fake{}
|
||||
|
||||
@ -223,10 +219,8 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
},
|
||||
PluginDir: pluginDir,
|
||||
}
|
||||
service := &fakePluginStore{
|
||||
plugins: map[string]plugins.PluginDTO{
|
||||
pluginID: p,
|
||||
},
|
||||
service := &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{p},
|
||||
}
|
||||
l := &logtest.Fake{}
|
||||
|
||||
@ -248,10 +242,8 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
},
|
||||
PluginDir: pluginDir,
|
||||
}
|
||||
service := &fakePluginStore{
|
||||
plugins: map[string]plugins.PluginDTO{
|
||||
pluginID: p,
|
||||
},
|
||||
service := &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{p},
|
||||
}
|
||||
l := &logtest.Fake{}
|
||||
|
||||
@ -271,8 +263,8 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Given a request for an non-existing plugin", func(t *testing.T) {
|
||||
service := &fakePluginStore{
|
||||
plugins: map[string]plugins.PluginDTO{},
|
||||
service := &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{},
|
||||
}
|
||||
l := &logtest.Fake{}
|
||||
|
||||
@ -292,10 +284,11 @@ func Test_GetPluginAssets(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Given a request for a core plugin's file", func(t *testing.T) {
|
||||
service := &fakePluginStore{
|
||||
plugins: map[string]plugins.PluginDTO{
|
||||
pluginID: {
|
||||
Class: plugins.Core,
|
||||
service := &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{
|
||||
{
|
||||
JSONData: plugins.JSONData{ID: pluginID},
|
||||
Class: plugins.Core,
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -392,8 +385,8 @@ func (c *fakePluginClient) QueryData(ctx context.Context, req *backend.QueryData
|
||||
}
|
||||
|
||||
func Test_PluginsList_AccessControl(t *testing.T) {
|
||||
pluginStore := fakePluginStore{plugins: map[string]plugins.PluginDTO{
|
||||
"test-app": {
|
||||
pluginStore := plugins.FakePluginStore{PluginList: []plugins.PluginDTO{
|
||||
{
|
||||
PluginDir: "/grafana/plugins/test-app/dist",
|
||||
Class: "external",
|
||||
DefaultNavURL: "/plugins/test-app/page/test",
|
||||
@ -410,7 +403,7 @@ func Test_PluginsList_AccessControl(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
"mysql": {
|
||||
{
|
||||
PluginDir: "/grafana/public/app/plugins/datasource/mysql",
|
||||
Class: "core",
|
||||
Pinned: false,
|
||||
@ -428,7 +421,8 @@ func Test_PluginsList_AccessControl(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}}
|
||||
pluginSettings := fakePluginSettings{plugins: map[string]*pluginsettings.DTO{
|
||||
|
||||
pluginSettings := pluginsettings.FakePluginSettings{Plugins: map[string]*pluginsettings.DTO{
|
||||
"test-app": {ID: 0, OrgID: 1, PluginID: "test-app", PluginVersion: "1.0.0", Enabled: true},
|
||||
"mysql": {ID: 0, OrgID: 1, PluginID: "mysql", PluginVersion: "", Enabled: true}},
|
||||
}
|
||||
|
Reference in New Issue
Block a user