mirror of
https://github.com/grafana/grafana.git
synced 2025-09-28 23:34:03 +08:00

This pull request migrates testdata to coreplugin streaming capabilities, this is mostly a working concept of streaming plugins at the moment, the work will continue in the following pull requests.
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import { InlineField, InlineFieldRow, Select } from '@grafana/ui';
|
|
import { SelectableValue } from '@grafana/data';
|
|
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-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>
|
|
);
|
|
};
|