CSVContentEditor.tsx 506 B

1234567891011121314151617181920212223
  1. import React from 'react';
  2. import { CodeEditor } from '@grafana/ui';
  3. import { EditorProps } from '../QueryEditor';
  4. export const CSVContentEditor = ({ onChange, query }: EditorProps) => {
  5. const onSaveCSV = (csvContent: string) => {
  6. onChange({ ...query, csvContent });
  7. };
  8. return (
  9. <CodeEditor
  10. height={300}
  11. language="csv"
  12. value={query.csvContent ?? ''}
  13. onBlur={onSaveCSV}
  14. onSave={onSaveCSV}
  15. showMiniMap={false}
  16. showLineNumbers={true}
  17. />
  18. );
  19. };