import React from 'react' ; import { i18n } from '@osd/i18n' ; import { IndexPatternField } from 'src/plugins/data/public' ; import { FieldParamEditor } from './field' ; import { getCompatibleAggs } from './top_aggregate' ; import { AggParamEditorProps } from '../agg_param_props' ; function TopFieldParamEditor ( props ) { const compatibleAggs = getCompatibleAggs ( props . agg ) ; let customError ; if ( props . value && ! compatibleAggs . length ) { customError = i18n . translate ( 'visDefaultEditor.controls.aggregateWith.noAggsErrorTooltip' , { defaultMessage : 'The chosen field has no compatible aggregations.' , } ) ; } return < FieldParamEditor { ... props } customError = { customError } / > ; } export { TopFieldParamEditor } ;