import { css } from '@emotion/css'; import React, { useCallback } from 'react'; import { GrafanaTheme2, SelectableValue, TransformerRegistryItem, TransformerUIProps } from '@grafana/data'; import { InlineField, InlineFieldRow, Select, useStyles2 } from '@grafana/ui'; import { prepareTimeSeriesTransformer, PrepareTimeSeriesOptions, timeSeriesFormat } from './prepareTimeSeries'; const wideInfo = { label: 'Wide time series', value: timeSeriesFormat.TimeSeriesWide, description: 'Creates a single frame joined by time', info: ( ), }; const manyInfo = { label: 'Multi-frame time series', value: timeSeriesFormat.TimeSeriesMany, description: 'Creates a new frame for each time/number pair', info: ( ), }; const longInfo = { label: 'Long time series', value: timeSeriesFormat.TimeSeriesLong, description: 'Convert each frame to long format', info: ( ), }; const formats: Array> = [wideInfo, manyInfo, longInfo]; export function PrepareTimeSeriesEditor(props: TransformerUIProps): React.ReactElement { const { options, onChange } = props; const styles = useStyles2(getStyles); const onSelectFormat = useCallback( (value: SelectableValue) => { onChange({ ...options, format: value.value!, }); }, [onChange, options] ); return ( <>