import React, { useCallback } from 'react'; import { SelectableValue } from '@grafana/data'; import { EditorHeader, InlineSelect } from '@grafana/experimental'; import { AzureMonitorQuery, AzureQueryType } from '../types'; interface QueryTypeFieldProps { query: AzureMonitorQuery; onQueryChange: (newQuery: AzureMonitorQuery) => void; } export const QueryHeader: React.FC = ({ query, onQueryChange }) => { const queryTypes: Array<{ value: AzureQueryType; label: string }> = [ { value: AzureQueryType.AzureMonitor, label: 'Metrics' }, { value: AzureQueryType.LogAnalytics, label: 'Logs' }, { value: AzureQueryType.AzureResourceGraph, label: 'Azure Resource Graph' }, ]; const handleChange = useCallback( (change: SelectableValue) => { change.value && onQueryChange({ ...query, queryType: change.value, }); }, [onQueryChange, query] ); return ( ); };