Skip to content

Commit

Permalink
Merge pull request #120 from VictoriaMetrics/issue-112/fix-parsing-qu…
Browse files Browse the repository at this point in the history
…ery-builder

fix query builder
  • Loading branch information
Loori-R authored Dec 5, 2023
2 parents 95d0711 + ef52e4a commit 43298f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions .config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = {
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}',
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}',
],
transform: {
'^.+\\.(t|j)sx?$': [
Expand All @@ -28,7 +27,4 @@ module.exports = {
],
},
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
transformIgnorePatterns: [
"!node_modules/d3-interpolate"
]
};
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
// Jest configuration provided by Grafana scaffolding
...require('./.config/jest.config'),
testTimeout: 300000,
"transformIgnorePatterns": [
"node_modules/(?!monaco-promql/)"
]
transformIgnorePatterns: [
"node_modules/(?!(d3-color|d3-interpolate|monaco-promql|ol)/)"
],
};
2 changes: 1 addition & 1 deletion src/querybuilder/parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function handleFunction(expr: string, node: SyntaxNode, context: Context) {
// the query model.
// - it is easier to handle template variables this way as template variable is an error for the parser
if (rangeFunctions.includes(funcName) || funcName.endsWith('_over_time')) {
let match = getString(expr, node).match(/\[(.+)\]/);
let match = getString(expr, node).match(/(?<!\{[^}]*)\[(.+?)](?![^{]*})/);
if (match?.[1]) {
interval = match[1];
params.push(match[1]);
Expand Down

0 comments on commit 43298f8

Please sign in to comment.