mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Image Rendering: Fix render of graph panel legend aligned to the right using Grafana image renderer plugin/service (#21854)
Don't render class body--phantomjs on body element when PhantomJS renderer not is in use. Fixes #21830
This commit is contained in:
parent
aa6ee5ef38
commit
6e80315531
@ -67,6 +67,7 @@ export class GrafanaBootConfig {
|
|||||||
meta: false,
|
meta: false,
|
||||||
};
|
};
|
||||||
licenseInfo: LicenseInfo = {} as LicenseInfo;
|
licenseInfo: LicenseInfo = {} as LicenseInfo;
|
||||||
|
phantomJSRenderer = false;
|
||||||
|
|
||||||
constructor(options: GrafanaBootConfig) {
|
constructor(options: GrafanaBootConfig) {
|
||||||
this.theme = options.bootData.user.lightTheme ? getTheme(GrafanaThemeType.Light) : getTheme(GrafanaThemeType.Dark);
|
this.theme = options.bootData.user.lightTheme ? getTheme(GrafanaThemeType.Light) : getTheme(GrafanaThemeType.Dark);
|
||||||
|
@ -3,6 +3,8 @@ package api
|
|||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/services/rendering"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||||
"github.com/grafana/grafana/pkg/util"
|
"github.com/grafana/grafana/pkg/util"
|
||||||
|
|
||||||
@ -207,6 +209,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf
|
|||||||
"licenseUrl": hs.License.LicenseURL(c.SignedInUser),
|
"licenseUrl": hs.License.LicenseURL(c.SignedInUser),
|
||||||
},
|
},
|
||||||
"featureToggles": hs.Cfg.FeatureToggles,
|
"featureToggles": hs.Cfg.FeatureToggles,
|
||||||
|
"phantomJSRenderer": rendering.IsPhantomJSEnabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonObj, nil
|
return jsonObj, nil
|
||||||
|
@ -20,6 +20,8 @@ func init() {
|
|||||||
registry.RegisterService(&RenderingService{})
|
registry.RegisterService(&RenderingService{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var IsPhantomJSEnabled = false
|
||||||
|
|
||||||
type RenderingService struct {
|
type RenderingService struct {
|
||||||
log log.Logger
|
log log.Logger
|
||||||
pluginInfo *plugins.RendererPlugin
|
pluginInfo *plugins.RendererPlugin
|
||||||
@ -69,6 +71,7 @@ func (rs *RenderingService) Run(ctx context.Context) error {
|
|||||||
"You should consider migrating from phantomJS to grafana-image-renderer plugin. " +
|
"You should consider migrating from phantomJS to grafana-image-renderer plugin. " +
|
||||||
"Read more at https://grafana.com/docs/grafana/latest/administration/image_rendering/")
|
"Read more at https://grafana.com/docs/grafana/latest/administration/image_rendering/")
|
||||||
rs.renderAction = rs.renderViaPhantomJS
|
rs.renderAction = rs.renderViaPhantomJS
|
||||||
|
IsPhantomJSEnabled = true
|
||||||
<-ctx.Done()
|
<-ctx.Done()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ export function grafanaAppDirective(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// check if we are in server side render
|
// check if we are in server side render
|
||||||
if (document.cookie.indexOf('renderKey') !== -1) {
|
if (config.phantomJSRenderer && document.cookie.indexOf('renderKey') !== -1) {
|
||||||
body.addClass('body--phantomjs');
|
body.addClass('body--phantomjs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user