[v9.4.x] TestData: Fix bug when selecting "Log" streaming (#63725)
TestData: Fix bug when selecting "Log" streaming (#63190)
* fix wrong fields getting populated
* fix bug not being able to select another streaming type
* add correct arg type
* remove unused import
(cherry picked from commit b3c0e7e977)
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
This commit is contained in:
co-authored by
Sven Grossmann
parent
f18c84af5a
commit
65c2b4fea2
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
import React, { ChangeEvent, FormEvent, useMemo } from 'react';
|
import React, { FormEvent, useMemo } from 'react';
|
||||||
import { useAsync } from 'react-use';
|
import { useAsync } from 'react-use';
|
||||||
|
|
||||||
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||||
@@ -138,8 +138,8 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
onUpdate({ ...query, [name]: newValue });
|
onUpdate({ ...query, [name]: newValue });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFieldChange = (field: string) => (e: ChangeEvent<HTMLInputElement>) => {
|
const onFieldChange = (field: string) => (e: { target: { name: string; value: string; type: string } }) => {
|
||||||
const { name, value, type } = e.currentTarget;
|
const { name, value, type } = e.target;
|
||||||
let newValue: any = value;
|
let newValue: any = value;
|
||||||
|
|
||||||
if (type === 'number') {
|
if (type === 'number') {
|
||||||
|
|||||||
+2
-2
@@ -151,8 +151,8 @@ export function runLogsStream(
|
|||||||
let timeoutId: any = null;
|
let timeoutId: any = null;
|
||||||
|
|
||||||
const pushNextEvent = () => {
|
const pushNextEvent = () => {
|
||||||
data.fields[0].values.add(Date.now());
|
data.fields[0].values.add(getRandomLine());
|
||||||
data.fields[1].values.add(getRandomLine());
|
data.fields[1].values.add(Date.now());
|
||||||
|
|
||||||
subscriber.next({
|
subscriber.next({
|
||||||
data: [data],
|
data: [data],
|
||||||
|
|||||||
Reference in New Issue
Block a user