TestData: use CodeEditor for csv content (#44239)

This commit is contained in:
Ryan McKinley
2022-01-20 09:05:36 -08:00
committed by GitHub
parent 22eb2df602
commit 2fd76ecaf7

View File

@@ -1,21 +1,21 @@
import React, { ChangeEvent } from 'react';
import { InlineField, TextArea } from '@grafana/ui';
import React from 'react';
import { CodeEditor } from '@grafana/ui';
import { EditorProps } from '../QueryEditor';
export const CSVContentEditor = ({ onChange, query }: EditorProps) => {
const onContent = (e: ChangeEvent<HTMLTextAreaElement>) => {
onChange({ ...query, csvContent: e.currentTarget.value });
const onSaveCSV = (csvContent: string) => {
onChange({ ...query, csvContent });
};
return (
<InlineField label="CSV" labelWidth={14}>
<TextArea
width="100%"
rows={10}
onBlur={onContent}
placeholder="CSV content"
defaultValue={query.csvContent ?? ''}
/>
</InlineField>
<CodeEditor
height={300}
language="csv"
value={query.csvContent ?? ''}
onBlur={onSaveCSV}
onSave={onSaveCSV}
showMiniMap={false}
showLineNumbers={true}
/>
);
};