import { useMemo } from 'react'; import { SelectableValue } from '@grafana/data'; import { EditorField } from '@grafana/plugin-ui'; import { Select } from '@grafana/ui'; import { getAggregationOptionsByMetric } from '../functions'; import { ValueTypes } from '../types/query'; import { MetricDescriptor } from '../types/types'; export interface Props { refId: string; onChange: (metricDescriptor: string) => void; metricDescriptor?: MetricDescriptor; crossSeriesReducer: string; groupBys: string[]; templateVariableOptions: Array>; } export const Aggregation = (props: Props) => { const aggOptions = useAggregationOptionsByMetric(props); const selected = useSelectedFromOptions(aggOptions, props); return (