mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
fix: added changes for handling non value operators
This commit is contained in:
parent
2acee366a0
commit
339d81a240
@ -1,6 +1,6 @@
|
||||
/* eslint-disable sonarjs/cognitive-complexity */
|
||||
import { createAggregation } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
|
||||
import { OPERATORS } from 'constants/antlrQueryConstants';
|
||||
import { NON_VALUE_OPERATORS, OPERATORS } from 'constants/antlrQueryConstants';
|
||||
import { getOperatorValue } from 'container/QueryBuilder/filters/QueryBuilderSearch/utils';
|
||||
import { cloneDeep, isEqual, sortBy } from 'lodash-es';
|
||||
import { IQueryPair } from 'types/antlrQueryTypes';
|
||||
@ -87,10 +87,15 @@ export const convertFiltersToExpression = (
|
||||
return '';
|
||||
}
|
||||
|
||||
const sanitizedOperator = op.trim().toUpperCase();
|
||||
if (isFunctionOperator(op)) {
|
||||
return `${op}(${key.key}, ${value})`;
|
||||
}
|
||||
|
||||
if (NON_VALUE_OPERATORS.includes(sanitizedOperator)) {
|
||||
return `${key.key} ${op}`;
|
||||
}
|
||||
|
||||
const formattedValue = formatValueForExpression(value, op);
|
||||
return `${key.key} ${op} ${formattedValue}`;
|
||||
})
|
||||
|
||||
@ -99,7 +99,7 @@ export function isQueryPairComplete(queryPair: Partial<IQueryPair>): boolean {
|
||||
export function isFunctionOperator(operator: string): boolean {
|
||||
const functionOperators = Object.values(QUERY_BUILDER_FUNCTIONS);
|
||||
|
||||
const sanitizedOperator = operator.trim();
|
||||
const sanitizedOperator = operator.trim().toLowerCase();
|
||||
// Check if it's a direct function operator
|
||||
if (functionOperators.includes(sanitizedOperator)) {
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user