mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-19 05:15:54 +08:00
feat: added handling with type empty and key present or not
This commit is contained in:
parent
c574fc31d9
commit
71f204520b
@ -22,6 +22,7 @@ import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||
import { getMetricsOperatorsByAttributeType } from 'lib/newQueryBuilder/getMetricsOperatorsByAttributeType';
|
||||
import { getOperatorsBySourceAndPanelType } from 'lib/newQueryBuilder/getOperatorsBySourceAndPanelType';
|
||||
import { findDataTypeOfOperator } from 'lib/query/findDataTypeOfOperator';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
import {
|
||||
@ -203,6 +204,18 @@ export const useQueryOperations: UseQueryOperations = ({
|
||||
}
|
||||
|
||||
newQuery.spaceAggregation = '';
|
||||
|
||||
if (isEmpty(newQuery.aggregateAttribute.type)) {
|
||||
if (!isEmpty(newQuery.aggregateAttribute.key)) {
|
||||
newQuery.aggregateOperator = MetricAggregateOperator.AVG;
|
||||
newQuery.timeAggregation = MetricAggregateOperator.AVG;
|
||||
newQuery.spaceAggregation = MetricAggregateOperator.AVG;
|
||||
} else {
|
||||
newQuery.aggregateOperator = MetricAggregateOperator.COUNT;
|
||||
newQuery.timeAggregation = MetricAggregateOperator.RATE;
|
||||
newQuery.spaceAggregation = MetricAggregateOperator.SUM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleSetQueryData(index, newQuery);
|
||||
|
Loading…
x
Reference in New Issue
Block a user