mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
Plugin: Skip preloading disabled app plugins (#63083)
will not preload app plugins that is disabled.
This commit is contained in:
parent
504eabbe80
commit
ace4175e26
@ -402,11 +402,12 @@ func newAppDTO(plugin plugins.PluginDTO, settings pluginsettings.InfoDTO) *plugi
|
||||
ID: plugin.ID,
|
||||
Version: plugin.Info.Version,
|
||||
Path: plugin.Module,
|
||||
Preload: plugin.Preload,
|
||||
Preload: false,
|
||||
}
|
||||
|
||||
if settings.Enabled {
|
||||
app.Extensions = plugin.Extensions
|
||||
app.Preload = plugin.Preload
|
||||
}
|
||||
|
||||
return app
|
||||
|
@ -310,6 +310,76 @@ func TestHTTPServer_GetFrontendSettings_apps(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "disabled app with preload",
|
||||
pluginStore: func() plugins.Store {
|
||||
return &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{
|
||||
{
|
||||
Module: fmt.Sprintf("/%s/module.js", "test-app"),
|
||||
JSONData: plugins.JSONData{
|
||||
ID: "test-app",
|
||||
Info: plugins.Info{Version: "0.5.0"},
|
||||
Type: plugins.App,
|
||||
Extensions: []*plugindef.ExtensionsLink{},
|
||||
Preload: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
pluginSettings: func() pluginSettings.Service {
|
||||
return &pluginSettings.FakePluginSettings{
|
||||
Plugins: newAppSettings("test-app", false),
|
||||
}
|
||||
},
|
||||
expected: settings{
|
||||
Apps: map[string]*plugins.AppDTO{
|
||||
"test-app": {
|
||||
ID: "test-app",
|
||||
Preload: false,
|
||||
Path: "/test-app/module.js",
|
||||
Version: "0.5.0",
|
||||
Extensions: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "enalbed app with preload",
|
||||
pluginStore: func() plugins.Store {
|
||||
return &plugins.FakePluginStore{
|
||||
PluginList: []plugins.PluginDTO{
|
||||
{
|
||||
Module: fmt.Sprintf("/%s/module.js", "test-app"),
|
||||
JSONData: plugins.JSONData{
|
||||
ID: "test-app",
|
||||
Info: plugins.Info{Version: "0.5.0"},
|
||||
Type: plugins.App,
|
||||
Extensions: []*plugindef.ExtensionsLink{},
|
||||
Preload: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
pluginSettings: func() pluginSettings.Service {
|
||||
return &pluginSettings.FakePluginSettings{
|
||||
Plugins: newAppSettings("test-app", true),
|
||||
}
|
||||
},
|
||||
expected: settings{
|
||||
Apps: map[string]*plugins.AppDTO{
|
||||
"test-app": {
|
||||
ID: "test-app",
|
||||
Preload: true,
|
||||
Path: "/test-app/module.js",
|
||||
Version: "0.5.0",
|
||||
Extensions: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user