import { css } from '@emotion/css'; import React from 'react'; import { QueryEditorProps } from '@grafana/data'; import InfluxDatasource from '../datasource'; import { buildRawQuery } from '../queryUtils'; import { InfluxOptions, InfluxQuery } from '../types'; import { FluxQueryEditor } from './FluxQueryEditor'; import { QueryEditorModeSwitcher } from './QueryEditorModeSwitcher'; import { RawInfluxQLEditor } from './RawInfluxQLEditor'; import { Editor as VisualInfluxQLEditor } from './VisualInfluxQLEditor/Editor'; type Props = QueryEditorProps; export const QueryEditor = ({ query, onChange, onRunQuery, datasource, range, data }: Props): JSX.Element => { if (datasource.isFlux) { return (
); } return (
{query.rawQuery ? ( ) : ( )}
{ onChange({ ...query, query: buildRawQuery(query), rawQuery: value }); onRunQuery(); }} />
); };