* feat: fixed panel coorelation not spreading the filter expression in explorer pages * feat: fixed multiagregation not getting sent in create alert * fix: fixed failing test cases * Update frontend/src/api/v5/queryRange/prepareQueryRangePayloadV5.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix: fix lint error * fix: stepInterval not updating in panel qb * fix: added test cases for mapQueryDataFromApi and prepareQueryRangePayloadV5 * fix: added convertV5Response test cases - timeseries, pie and table * fix: refactored handleRunQuery * fix: code refactor * fix: refactored the mapQueryDataFromApi function according to new sub_var api * fix: updated test cases * fix: removed isJSON and isColumn from everywhere * fix: fixed code and test cases * fix: fixed bar chart custom - step interval for qb v5 (#8806) * fix: added querytype boolean check for v5 changes * fix: fixed typechecks * fix: fixed typechecks --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
106 lines
2.8 KiB
TypeScript
106 lines
2.8 KiB
TypeScript
import './QueryAggregation.styles.scss';
|
|
|
|
import { Tooltip } from 'antd';
|
|
import InputWithLabel from 'components/InputWithLabel/InputWithLabel';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import { useMemo } from 'react';
|
|
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
|
import { DataSource } from 'types/common/queryBuilder';
|
|
|
|
import QueryAggregationSelect from './QueryAggregationSelect';
|
|
|
|
function QueryAggregationOptions({
|
|
dataSource,
|
|
panelType,
|
|
onAggregationIntervalChange,
|
|
onChange,
|
|
queryData,
|
|
}: {
|
|
dataSource: DataSource;
|
|
panelType?: string;
|
|
onAggregationIntervalChange: (value: number) => void;
|
|
onChange?: (value: string) => void;
|
|
queryData: IBuilderQuery;
|
|
}): JSX.Element {
|
|
const showAggregationInterval = useMemo(() => {
|
|
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
if (panelType === PANEL_TYPES.VALUE) {
|
|
return false;
|
|
}
|
|
|
|
if (dataSource === DataSource.TRACES || dataSource === DataSource.LOGS) {
|
|
return !(panelType === PANEL_TYPES.TABLE || panelType === PANEL_TYPES.PIE);
|
|
}
|
|
|
|
return true;
|
|
}, [dataSource, panelType]);
|
|
|
|
const handleAggregationIntervalChange = (value: string): void => {
|
|
onAggregationIntervalChange(Number(value));
|
|
};
|
|
|
|
return (
|
|
<div className="query-aggregation-container">
|
|
<div className="aggregation-container">
|
|
<QueryAggregationSelect
|
|
onChange={onChange}
|
|
queryData={queryData}
|
|
maxAggregations={
|
|
panelType === PANEL_TYPES.VALUE || panelType === PANEL_TYPES.PIE
|
|
? 1
|
|
: undefined
|
|
}
|
|
/>
|
|
|
|
{showAggregationInterval && (
|
|
<div className="query-aggregation-interval">
|
|
<Tooltip
|
|
title={
|
|
<div>
|
|
Set the time interval for aggregation
|
|
<br />
|
|
<a
|
|
href="https://signoz.io/docs/userguide/query-builder-v5/#time-aggregation-windows"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
style={{ color: '#1890ff', textDecoration: 'underline' }}
|
|
>
|
|
Learn about step intervals
|
|
</a>
|
|
</div>
|
|
}
|
|
placement="top"
|
|
>
|
|
<div
|
|
className="metrics-aggregation-section-content-item-label"
|
|
style={{ cursor: 'help' }}
|
|
>
|
|
every
|
|
</div>
|
|
</Tooltip>
|
|
|
|
<div className="query-aggregation-interval-input-container">
|
|
<InputWithLabel
|
|
initialValue={queryData?.stepInterval ? queryData?.stepInterval : null}
|
|
className="query-aggregation-interval-input"
|
|
label="Seconds"
|
|
placeholder="Auto"
|
|
type="number"
|
|
onChange={handleAggregationIntervalChange}
|
|
labelAfter
|
|
/>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
QueryAggregationOptions.defaultProps = {
|
|
panelType: null,
|
|
onChange: undefined,
|
|
};
|
|
|
|
export default QueryAggregationOptions;
|