import React , { FC } from 'react' ; import { EuiButton , EuiToolTip } from '@elastic/eui' ; import { i18n } from '@kbn/i18n' ; import { createPermissionFailureMessage } from '../../../../../capabilities/check_capabilities' ; interface Props { isDisabled : boolean ; setIsSourceIndexModalVisible : React . Dispatch < React . SetStateAction < any > > ; } export const CreateAnalyticsButton = ( { isDisabled , setIsSourceIndexModalVisible } ) => { const handleClick = ( ) => { setIsSourceIndexModalVisible ( true ) ; } ; const button = ( < EuiButton disabled = { isDisabled } fill onClick = { handleClick } iconType = "plusInCircle" size = "s" data - test - subj = "mlAnalyticsButtonCreate" > { i18n . translate ( 'xpack.ml.dataframe.analyticsList.createDataFrameAnalyticsButton' , { defaultMessage : 'Create job' , } ) } < /EuiButton>); if ( isDisabled ) { return ( < EuiToolTip position = "top" content = { createPermissionFailureMessage ( 'canCreateDataFrameAnalytics' ) } > { button } < /EuiToolTip>); } return button ; } ;