mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki Query Builder: Throw warning in query builder when order of operations is ambiguous (#75198)
* flag vector aggregations containing metric expressions (i.e.`(...)`) containing binary operation expressions with ambiguous error in the UI when switching between code and visual query builders.
This commit is contained in:
@@ -541,6 +541,15 @@ function handleVectorAggregation(expr: string, node: SyntaxNode, context: Contex
|
||||
const op: QueryBuilderOperation = { id: funcName, params };
|
||||
|
||||
if (metricExpr) {
|
||||
// A vector aggregation expression with a child of metric expression with a child of binary expression is ambiguous after being parsed into a visual query
|
||||
if (metricExpr.firstChild?.type.id === BinOpExpr) {
|
||||
context.errors.push({
|
||||
text: 'Query parsing is ambiguous.',
|
||||
from: metricExpr.firstChild.from,
|
||||
to: metricExpr.firstChild?.to,
|
||||
});
|
||||
}
|
||||
|
||||
handleExpression(expr, metricExpr, context);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user