Merge pull request #15775 from ryantxu/rename-interpolate

use replaceVariables rather than onInterpolate
This commit is contained in:
Torkel Ödegaard
2019-03-05 09:10:45 +01:00
committed by GitHub
3 changed files with 6 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ export interface PanelProps<T = any> {
renderCounter: number;
width: number;
height: number;
onInterpolate: InterpolateFunction;
replaceVariables: InterpolateFunction;
}
export interface PanelData {

View File

@@ -85,7 +85,7 @@ export class PanelChrome extends PureComponent<Props, State> {
});
};
onInterpolate = (value: string, format?: string) => {
replaceVariables = (value: string, format?: string) => {
return templateSrv.replace(value, this.props.panel.scopedVars, format);
};
@@ -158,7 +158,7 @@ export class PanelChrome extends PureComponent<Props, State> {
width={width - 2 * variables.panelhorizontalpadding}
height={height - PANEL_HEADER_HEIGHT - variables.panelverticalpadding}
renderCounter={renderCounter}
onInterpolate={this.onInterpolate}
replaceVariables={this.replaceVariables}
/>
</div>
);

View File

@@ -15,11 +15,11 @@ interface Props extends PanelProps<GaugeOptions> {}
export class GaugePanel extends PureComponent<Props> {
render() {
const { panelData, width, height, onInterpolate, options } = this.props;
const { panelData, width, height, replaceVariables, options } = this.props;
const { valueOptions } = options;
const prefix = onInterpolate(valueOptions.prefix);
const suffix = onInterpolate(valueOptions.suffix);
const prefix = replaceVariables(valueOptions.prefix);
const suffix = replaceVariables(valueOptions.suffix);
let value: TimeSeriesValue;
if (panelData.timeSeries) {