The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/plugins/datasource/grafana-testdata-datasource/components/GrafanaLiveEditor.tsx

47 lines
1.3 KiB

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>
);
};