just do it
This commit is contained in:
@@ -151,6 +151,13 @@ type FrontendSettingsSqlConnectionLimitsDTO struct {
|
||||
ConnMaxLifetime int `json:"connMaxLifetime"`
|
||||
}
|
||||
|
||||
type DependencyInfo struct {
|
||||
PluginID string `json:"pluginId"`
|
||||
PluginName string `json:"pluginName"`
|
||||
PluginType string `json:"pluginType"`
|
||||
PluginVersion string `json:"pluginVersion"`
|
||||
}
|
||||
|
||||
type FrontendSettingsDTO struct {
|
||||
DefaultDatasource string `json:"defaultDatasource"`
|
||||
Datasources map[string]plugins.DataSourceDTO `json:"datasources"`
|
||||
@@ -236,6 +243,7 @@ type FrontendSettingsDTO struct {
|
||||
SnapshotEnabled bool `json:"snapshotEnabled"`
|
||||
SecureSocksDSProxyEnabled bool `json:"secureSocksDSProxyEnabled"`
|
||||
ReportingStaticContext map[string]string `json:"reportingStaticContext"`
|
||||
PluginDependencies map[string][]DependencyInfo `json:"pluginDependants"`
|
||||
|
||||
Azure FrontendSettingsAzureDTO `json:"azure"`
|
||||
|
||||
|
||||
@@ -242,6 +242,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
|
||||
LocalFileSystemAvailable: hs.Cfg.LocalFileSystemAvailable,
|
||||
ReportingStaticContext: hs.Cfg.ReportingStaticContext,
|
||||
ExploreDefaultTimeOffset: hs.Cfg.ExploreDefaultTimeOffset,
|
||||
PluginDependencies: pluginDependencyMap(c.Req.Context(), hs.pluginStore),
|
||||
|
||||
BuildInfo: dtos.FrontendSettingsBuildInfoDTO{
|
||||
HideVersion: hideVersion,
|
||||
@@ -765,3 +766,24 @@ func (hs *HTTPServer) getEnabledOAuthProviders() map[string]any {
|
||||
}
|
||||
return providers
|
||||
}
|
||||
|
||||
// pluginDependencyMap returns a map of dependant plugin IDs to their parent.
|
||||
func pluginDependencyMap(ctx context.Context, pluginStore pluginstore.Store) map[string][]dtos.DependencyInfo {
|
||||
dependencies := make(map[string][]dtos.DependencyInfo)
|
||||
|
||||
for _, plugin := range pluginStore.Plugins(ctx) {
|
||||
for _, dep := range plugin.Dependencies.Plugins {
|
||||
if _, exists := dependencies[dep.ID]; !exists {
|
||||
dependencies[dep.ID] = []dtos.DependencyInfo{}
|
||||
}
|
||||
dependencies[dep.ID] = append(dependencies[dep.ID], dtos.DependencyInfo{
|
||||
PluginID: plugin.ID,
|
||||
PluginVersion: plugin.Info.Version,
|
||||
PluginName: plugin.Name,
|
||||
PluginType: string(plugin.Type),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user