import React, { FC } from 'react'; import { Field, InputControl } from '@grafana/ui'; import { RuleEditorSection } from './RuleEditorSection'; import { useFormContext } from 'react-hook-form'; import { RuleFormType, RuleFormValues } from '../../types/rule-form'; import { ExpressionEditor } from './ExpressionEditor'; import { GrafanaQueryEditor } from './GrafanaQueryEditor'; import { isArray } from 'lodash'; // @TODO get proper query editors in export const QueryStep: FC = () => { const { control, watch, errors } = useFormContext(); const type = watch('type'); const dataSourceName = watch('dataSourceName'); return ( {type === RuleFormType.system && dataSourceName && ( )} {type === RuleFormType.threshold && ( isArray(queries) && !!queries.length, }} /> )} ); };