mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-25 11:30:08 +00:00
* feat: query_range migration from v3/v4 -> v5 * feat: cleanup files * feat: cleanup code * feat: metric payload improvements * feat: metric payload improvements * feat: data retention and qb v2 for dashboard cleanup * feat: corrected datasource change daata updatation in qb v2 * feat: fix value panel plotting with new query v5 * feat: alert migration * feat: fixed aggregation css * feat: explorer pages migration * feat: trace and logs explorer fixes
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import './QueryAggregation.styles.scss';
|
|
|
|
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} />
|
|
|
|
{showAggregationInterval && (
|
|
<div className="query-aggregation-interval">
|
|
<div className="query-aggregation-interval-label">every</div>
|
|
<div className="query-aggregation-interval-input-container">
|
|
<InputWithLabel
|
|
initialValue={queryData.stepInterval ? queryData.stepInterval : '60'}
|
|
className="query-aggregation-interval-input"
|
|
label="Seconds"
|
|
placeholder="60"
|
|
type="number"
|
|
onChange={handleAggregationIntervalChange}
|
|
labelAfter
|
|
onClose={(): void => {}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
QueryAggregationOptions.defaultProps = {
|
|
panelType: null,
|
|
onChange: undefined,
|
|
};
|
|
|
|
export default QueryAggregationOptions;
|