Commit 173e7fd8 by Torkel Ödegaard Committed by GitHub

Fix: Graphite query rendering fix (#16390)

Only interpolate string parameters

Fixes #16367
parent c2d399b0
......@@ -966,7 +966,6 @@ export class FuncInstance {
const str = this.def.name + '(';
const parameters = _.map(this.params, (value, index) => {
const valueInterpolated = replaceVariables(value);
let paramType;
if (index < this.def.params.length) {
......@@ -980,6 +979,8 @@ export class FuncInstance {
return value;
}
const valueInterpolated = _.isString(value) ? replaceVariables(value) : value;
// param types that might be quoted
// To quote variables correctly we need to interpolate it to check if it contains a numeric or string value
if (_.includes(['int_or_interval', 'node_or_tag'], paramType) && _.isFinite(+valueInterpolated)) {
......
......@@ -31,7 +31,8 @@ describe('when creating func instance from func names', () => {
});
function replaceVariablesDummy(str: string) {
return str;
// important that this does replace
return str.replace('asdasdas', 'asdsad');
}
describe('when rendering func instance', () => {
......
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