Fix: Graphite query rendering fix (#16390)

Only interpolate string parameters

Fixes #16367
This commit is contained in:
Torkel Ödegaard 2019-04-05 09:56:47 +02:00 committed by GitHub
parent c2d399b059
commit 173e7fd839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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)) {

View File

@ -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', () => {