Loki Query Builder: Fix bug parsing range params (#61678)

feat(loki-query-builder): fix bug parsing range params
This commit is contained in:
Matias Chomicki
2023-01-18 15:54:18 +01:00
committed by GitHub
parent d042c0b30b
commit 89e77d072f
2 changed files with 25 additions and 3 deletions

View File

@@ -413,10 +413,11 @@ function handleRangeAggregation(expr: string, node: SyntaxNode, context: Context
const number = node.getChild(NumberLezer);
const logExpr = node.getChild(LogRangeExpr);
const params = number !== null && number !== undefined ? [getString(expr, number)] : [];
const range = logExpr?.getChild(Range);
const rangeValue = range ? getString(expr, range) : null;
let match = getString(expr, node).match(/\[(.+)\]/);
if (match?.[1]) {
params.unshift(match[1]);
if (rangeValue) {
params.unshift(rangeValue.substring(1, rangeValue.length - 1));
}
const op = {