mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add pluginBundle backend api methods and SQL storage
This commit is contained in:
@@ -37,8 +37,7 @@ type ExternalPluginRoute struct {
|
||||
}
|
||||
|
||||
type ExternalPluginJs struct {
|
||||
Module string `json:"module"`
|
||||
Directive string `json:"Directive"`
|
||||
Module string `json:"module"`
|
||||
}
|
||||
|
||||
type ExternalPluginNavLink struct {
|
||||
@@ -68,6 +67,7 @@ type PluginBundle struct {
|
||||
PanelPlugins []string `json:"panelPlugins"`
|
||||
DatasourcePlugins []string `json:"datasourcePlugins"`
|
||||
ExternalPlugins []string `json:"externalPlugins"`
|
||||
Module string `json:"module"`
|
||||
}
|
||||
|
||||
type EnabledPlugins struct {
|
||||
|
||||
@@ -172,13 +172,18 @@ func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetEnabledPlugins(bundles map[string]models.PluginBundle) EnabledPlugins {
|
||||
func GetEnabledPlugins(orgBundles []*models.PluginBundle) EnabledPlugins {
|
||||
enabledPlugins := NewEnabledPlugins()
|
||||
|
||||
orgBundlesMap := make(map[string]*models.PluginBundle)
|
||||
for _, orgBundle := range orgBundles {
|
||||
orgBundlesMap[orgBundle.Type] = orgBundle
|
||||
}
|
||||
|
||||
for bundleType, bundle := range Bundles {
|
||||
enabled := bundle.Enabled
|
||||
// check if the bundle is stored in the DB.
|
||||
if b, ok := bundles[bundleType]; ok {
|
||||
if b, ok := orgBundlesMap[bundleType]; ok {
|
||||
enabled = b.Enabled
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user