mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Rendering: Fix plugin initialization (#80013)
This commit is contained in:
parent
b2b4e8f68d
commit
1cec6195f1
@ -38,6 +38,7 @@ type RenderingService struct {
|
|||||||
version string
|
version string
|
||||||
versionMutex sync.RWMutex
|
versionMutex sync.RWMutex
|
||||||
capabilities []Capability
|
capabilities []Capability
|
||||||
|
pluginAvailable bool
|
||||||
|
|
||||||
perRequestRenderKeyProvider renderKeyProvider
|
perRequestRenderKeyProvider renderKeyProvider
|
||||||
Cfg *setting.Cfg
|
Cfg *setting.Cfg
|
||||||
@ -108,6 +109,8 @@ func ProvideService(cfg *setting.Cfg, features *featuremgmt.FeatureManager, remo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, exists := rm.Renderer(context.Background())
|
||||||
|
|
||||||
s := &RenderingService{
|
s := &RenderingService{
|
||||||
perRequestRenderKeyProvider: renderKeyProvider,
|
perRequestRenderKeyProvider: renderKeyProvider,
|
||||||
capabilities: []Capability{
|
capabilities: []Capability{
|
||||||
@ -131,6 +134,7 @@ func ProvideService(cfg *setting.Cfg, features *featuremgmt.FeatureManager, remo
|
|||||||
log: logger,
|
log: logger,
|
||||||
domain: domain,
|
domain: domain,
|
||||||
sanitizeURL: sanitizeURL,
|
sanitizeURL: sanitizeURL,
|
||||||
|
pluginAvailable: exists,
|
||||||
}
|
}
|
||||||
|
|
||||||
gob.Register(&RenderUser{})
|
gob.Register(&RenderUser{})
|
||||||
@ -200,17 +204,12 @@ func (rs *RenderingService) Run(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rs *RenderingService) pluginAvailable(ctx context.Context) bool {
|
|
||||||
_, exists := rs.RendererPluginManager.Renderer(ctx)
|
|
||||||
return exists
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rs *RenderingService) remoteAvailable() bool {
|
func (rs *RenderingService) remoteAvailable() bool {
|
||||||
return rs.Cfg.RendererUrl != ""
|
return rs.Cfg.RendererUrl != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rs *RenderingService) IsAvailable(ctx context.Context) bool {
|
func (rs *RenderingService) IsAvailable(ctx context.Context) bool {
|
||||||
return rs.remoteAvailable() || rs.pluginAvailable(ctx)
|
return rs.remoteAvailable() || rs.pluginAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rs *RenderingService) Version() string {
|
func (rs *RenderingService) Version() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user