From b3c0e7e977bd04dca3f0681853c9eedc07643336 Mon Sep 17 00:00:00 2001 From: Sven Grossmann Date: Fri, 24 Feb 2023 14:13:56 +0100 Subject: [PATCH] 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 --- 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 149c330c964..c9b11c9f122 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: ReturnType; 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],