import React , { FC } from 'react' ; import { i18n } from '@kbn/i18n' ; import { EuiToolTip } from '@elastic/eui' ; import { isRegressionAnalysis , isOutlierAnalysis , isClassificationAnalysis , } from '../../../../common/analytics' ; import { DataFrameAnalyticsListRow } from '../analytics_list/common' ; export const mapActionButtonText = i18n . translate ( 'xpack.ml.dataframe.analyticsList.mapActionName' , { defaultMessage : 'Map' , } ) ; interface MapButtonProps { item : DataFrameAnalyticsListRow ; } export const MapButton = ( { item } ) => { const disabled = ! isRegressionAnalysis ( item . config . analysis ) && ! isOutlierAnalysis ( item . config . analysis ) && ! isClassificationAnalysis ( item . config . analysis ) ; if ( disabled ) { const toolTipContent = i18n . translate ( 'xpack.ml.dataframe.analyticsList.mapActionDisabledTooltipContent' , { defaultMessage : 'Unknown analysis type.' , } ) ; return ( < EuiToolTip position = "top" content = { toolTipContent } > < > { mapActionButtonText } < /> < /EuiToolTip>); } return < > { mapActionButtonText } < />; } ;