import React from 'react' ; import { EuiIconTip } from '@elastic/eui' ; import { i18n } from '@osd/i18n' ; import { SizeParamEditor } from './size' ; import { getCompatibleAggs } from './top_aggregate' ; import { AggParamEditorProps } from '../agg_param_props' ; function TopSizeParamEditor ( props ) { const iconTip = ( < > { ' ' } < EuiIconTip position = "right" content = { i18n . translate ( 'visDefaultEditor.controls.sizeTooltip' , { defaultMessage : "Request top-K hits. Multiple hits will be combined via 'aggregate with'." , } ) } type = "questionInCircle" / > < />); const fieldType = props . agg . params . field && props . agg . params . field . type ; const disabled = fieldType && ! getCompatibleAggs ( props . agg ) . length ; return < SizeParamEditor { ... props } iconTip = { iconTip } disabled = { disabled } / > ; } export { TopSizeParamEditor } ;