From d597271844e94917eeecf5ed3a180e5aaf0483f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 19 Mar 2019 14:07:48 +0100 Subject: [PATCH] Re-render gauge / singlestat panels when changing options --- public/app/plugins/panel/bargauge/BarGaugePanel.tsx | 6 +++--- public/app/plugins/panel/gauge/GaugePanel.tsx | 6 +++--- .../plugins/panel/singlestat2/ProcessedValuesRepeater.tsx | 6 +++--- public/app/plugins/panel/singlestat2/SingleStatPanel.tsx | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/public/app/plugins/panel/bargauge/BarGaugePanel.tsx b/public/app/plugins/panel/bargauge/BarGaugePanel.tsx index e738475afc8..42a330c620a 100644 --- a/public/app/plugins/panel/bargauge/BarGaugePanel.tsx +++ b/public/app/plugins/panel/bargauge/BarGaugePanel.tsx @@ -31,8 +31,7 @@ export class BarGaugePanel extends PureComponent> { }; render() { - const { height, width, options, panelData } = this.props; - const { orientation } = options; + const { height, width, options, panelData, renderCounter } = this.props; return ( > { width={width} height={height} source={panelData} - orientation={orientation} + renderCounter={renderCounter} + orientation={options.orientation} /> ); } diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index b83dc9ad440..d091812f23c 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -37,8 +37,7 @@ export class GaugePanel extends PureComponent> { }; render() { - const { height, width, options, panelData } = this.props; - const { orientation } = options; + const { height, width, options, panelData, renderCounter } = this.props; return ( > { width={width} height={height} source={panelData} - orientation={orientation} + renderCounter={renderCounter} + orientation={options.orientation} /> ); } diff --git a/public/app/plugins/panel/singlestat2/ProcessedValuesRepeater.tsx b/public/app/plugins/panel/singlestat2/ProcessedValuesRepeater.tsx index d42c033eac2..b8abf3aabb0 100644 --- a/public/app/plugins/panel/singlestat2/ProcessedValuesRepeater.tsx +++ b/public/app/plugins/panel/singlestat2/ProcessedValuesRepeater.tsx @@ -7,7 +7,7 @@ export interface Props { height: number; orientation: VizOrientation; source: any; // If this changes, the values will be processed - processFlag?: boolean; // change to force processing + renderCounter: number; // change to force processing getProcessedValues: () => T[]; renderValue: (value: T, width: number, height: number) => JSX.Element; @@ -30,8 +30,8 @@ export class ProcessedValuesRepeater extends PureComponent, State } componentDidUpdate(prevProps: Props) { - const { processFlag, source } = this.props; - if (processFlag !== prevProps.processFlag || source !== prevProps.source) { + const { renderCounter, source } = this.props; + if (renderCounter !== prevProps.renderCounter || source !== prevProps.source) { this.setState({ values: this.props.getProcessedValues() }); } } diff --git a/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx b/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx index 1c731e0a0c7..12f3be64a38 100644 --- a/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx +++ b/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx @@ -50,8 +50,7 @@ export class SingleStatPanel extends PureComponent }; render() { - const { height, width, options, panelData } = this.props; - const { orientation } = options; + const { height, width, options, panelData, renderCounter } = this.props; return ( width={width} height={height} source={panelData} - orientation={orientation} + renderCounter={renderCounter} + orientation={options.orientation} /> ); }