From 65c2b4fea231653a244d3a592ef978e9efa0cf8a Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 24 Feb 2023 14:21:25 +0100 Subject: [PATCH] [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 b3c0e7e977bd04dca3f0681853c9eedc07643336) Co-authored-by: Sven Grossmann --- public/app/plugins/datasource/testdata/QueryEditor.tsx | 6 +++--- public/app/plugins/datasource/testdata/runStreams.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/app/plugins/datasource/testdata/QueryEditor.tsx b/public/app/plugins/datasource/testdata/QueryEditor.tsx index 699fcd2da1d..0aa6a27c558 100644 --- a/public/app/plugins/datasource/testdata/QueryEditor.tsx +++ b/public/app/plugins/datasource/testdata/QueryEditor.tsx @@ -1,4 +1,4 @@ -import React, { ChangeEvent, FormEvent, useMemo } from 'react'; +import React, { FormEvent, useMemo } from 'react'; import { useAsync } from 'react-use'; import { QueryEditorProps, SelectableValue } from '@grafana/data'; @@ -138,8 +138,8 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) onUpdate({ ...query, [name]: newValue }); }; - const onFieldChange = (field: string) => (e: ChangeEvent) => { - const { name, value, type } = e.currentTarget; + const onFieldChange = (field: string) => (e: { target: { name: string; value: string; type: string } }) => { + const { name, value, type } = e.target; let newValue: any = value; if (type === 'number') { diff --git a/public/app/plugins/datasource/testdata/runStreams.ts b/public/app/plugins/datasource/testdata/runStreams.ts index cb1da0e1e32..3686173d4df 100644 --- a/public/app/plugins/datasource/testdata/runStreams.ts +++ b/public/app/plugins/datasource/testdata/runStreams.ts @@ -151,8 +151,8 @@ export function runLogsStream( let timeoutId: any = null; const pushNextEvent = () => { - data.fields[0].values.add(Date.now()); - data.fields[1].values.add(getRandomLine()); + data.fields[0].values.add(getRandomLine()); + data.fields[1].values.add(Date.now()); subscriber.next({ data: [data],