Commit 5aba6fde by Torkel Ödegaard Committed by GitHub

Rendering: Fixed issue rendering text panel to image via image renderer plugin (#27083)

Fixes #26996
parent 37b3087b
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
PanelData, PanelData,
PanelPlugin, PanelPlugin,
FieldConfigSource, FieldConfigSource,
PanelPluginMeta,
} from '@grafana/data'; } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors'; import { selectors } from '@grafana/e2e-selectors';
...@@ -238,23 +239,27 @@ export class PanelChrome extends PureComponent<Props, State> { ...@@ -238,23 +239,27 @@ export class PanelChrome extends PureComponent<Props, State> {
}); });
}; };
shouldSignalRenderingCompleted(loadingState: LoadingState, pluginMeta: PanelPluginMeta) {
return loadingState === LoadingState.Done || pluginMeta.skipDataQuery;
}
renderPanel(width: number, height: number) { renderPanel(width: number, height: number) {
const { panel, plugin } = this.props; const { panel, plugin } = this.props;
const { renderCounter, data, isFirstLoad } = this.state; const { renderCounter, data, isFirstLoad } = this.state;
const { theme } = config; const { theme } = config;
const { state: loadingState } = data;
// do not render component until we have first data
if (isFirstLoad && (loadingState === LoadingState.Loading || loadingState === LoadingState.NotStarted)) {
return null;
}
// This is only done to increase a counter that is used by backend // This is only done to increase a counter that is used by backend
// image rendering to know when to capture image // image rendering to know when to capture image
const loading = data.state; if (this.shouldSignalRenderingCompleted(loadingState, plugin.meta)) {
if (loading === LoadingState.Done) {
profiler.renderingCompleted(); profiler.renderingCompleted();
} }
// do not render component until we have first data
if (isFirstLoad && (loading === LoadingState.Loading || loading === LoadingState.NotStarted)) {
return null;
}
const PanelComponent = plugin.panel!; const PanelComponent = plugin.panel!;
const timeRange = data.timeRange || this.timeSrv.timeRange(); const timeRange = data.timeRange || this.timeSrv.timeRange();
const headerHeight = this.hasOverlayHeader() ? 0 : theme.panelHeaderHeight; const headerHeight = this.hasOverlayHeader() ? 0 : theme.panelHeaderHeight;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment