import React, { ChangeEvent } from 'react'; import { SelectableValue } from '@grafana/data'; import { InlineField, InlineFieldRow, Input, Select } from '@grafana/ui'; import { EditorProps } from '../QueryEditor'; import { StreamingQuery } from '../types'; const streamingClientFields = [ { label: 'Speed (ms)', id: 'speed', placeholder: 'value', min: 10, step: 10 }, { label: 'Spread', id: 'spread', placeholder: 'value', min: 0.5, step: 0.1 }, { label: 'Noise', id: 'noise', placeholder: 'value', min: 0, step: 0.1 }, { label: 'Bands', id: 'bands', placeholder: 'bands', min: 0, step: 1 }, ]; const types = [ { value: 'signal', label: 'Signal' }, { value: 'logs', label: 'Logs' }, { value: 'fetch', label: 'Fetch' }, ]; export const StreamingClientEditor = ({ onChange, query }: EditorProps) => { const onSelectChange = ({ value }: SelectableValue) => { onChange({ target: { name: 'type', value } }); }; // Convert values to numbers before saving const onInputChange = (e: ChangeEvent) => { const { name, value } = e.target; onChange({ target: { name, value: Number(value) } }); }; return ( ); })} {query?.stream?.type === 'fetch' && ( )} ); };