mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 04:09:50 +08:00

* update eslint, tsconfig + esbuild to handle new jsx transform * remove thing that breaks the new jsx transform * remove react imports * adjust grafana-icons build * is this the correct syntax? * try this * well this was much easier than expected... * change grafana-plugin-configs webpack config * fixes * fix lockfile * fix 2 more violations * use path.resolve instead of require.resolve * remove react import * fix react imports * more fixes * remove React import * remove import React from docs * remove another react import
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { SelectableValue } from '@grafana/data';
|
|
import { InlineField, InlineFieldRow, Select } from '@grafana/ui';
|
|
|
|
import { EditorProps } from '../QueryEditor';
|
|
|
|
const liveTestDataChannels = [
|
|
{
|
|
label: 'random-2s-stream',
|
|
value: 'random-2s-stream',
|
|
description: 'Random stream with points every 2s',
|
|
},
|
|
{
|
|
label: 'random-flakey-stream',
|
|
value: 'random-flakey-stream',
|
|
description: 'Stream that returns data in random intervals',
|
|
},
|
|
{
|
|
label: 'random-labeled-stream',
|
|
value: 'random-labeled-stream',
|
|
description: 'Value with moving labels',
|
|
},
|
|
{
|
|
label: 'random-20Hz-stream',
|
|
value: 'random-20Hz-stream',
|
|
description: 'Random stream with points in 20Hz',
|
|
},
|
|
];
|
|
|
|
export const GrafanaLiveEditor = ({ onChange, query }: EditorProps) => {
|
|
const onChannelChange = ({ value }: SelectableValue<string>) => {
|
|
onChange({ ...query, channel: value });
|
|
};
|
|
|
|
return (
|
|
<InlineFieldRow>
|
|
<InlineField label="Channel" labelWidth={14}>
|
|
<Select
|
|
width={32}
|
|
onChange={onChannelChange}
|
|
placeholder="Select channel"
|
|
options={liveTestDataChannels}
|
|
value={liveTestDataChannels.find((f) => f.value === query.channel)}
|
|
/>
|
|
</InlineField>
|
|
</InlineFieldRow>
|
|
);
|
|
};
|