import React, { FunctionComponent, PropsWithChildren, ReactElement, useMemo } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { Tooltip } from '@grafana/ui'; import { variableAdapters } from '../adapters'; import { VariableHide, VariableModel } from '../types'; interface Props { variable: VariableModel; } export const PickerRenderer: FunctionComponent = (props) => { const PickerToRender = useMemo(() => variableAdapters.get(props.variable.type).picker, [props.variable]); if (!props.variable) { return
Couldn't load variable
; } return (
{props.variable.hide !== VariableHide.hideVariable && PickerToRender && ( )}
); }; function PickerLabel({ variable }: PropsWithChildren): ReactElement | null { const labelOrName = useMemo(() => variable.label || variable.name, [variable]); if (variable.hide !== VariableHide.dontHide) { return null; } const elementId = `var-${variable.id}`; if (variable.description) { return ( ); } return ( ); }