import React from 'react' ; import { EuiTableActionsColumnType } from '@elastic/eui' ; import { TransformListRow } from '../../../../common' ; import { useCloneAction } from '../action_clone' ; import { useDeleteAction , DeleteActionModal } from '../action_delete' ; import { useDiscoverAction } from '../action_discover' ; import { EditTransformFlyout } from '../edit_transform_flyout' ; import { useEditAction } from '../action_edit' ; import { useStartAction , StartActionModal } from '../action_start' ; import { useStopAction } from '../action_stop' ; import { useCreateAlertRuleAction } from '../action_create_alert' ; export const useActions = ( { forceDisable , transformNodes , } ) : { actions : EuiTableActionsColumnType < TransformListRow > [ 'actions' ] ; modals : JSX . Element ; } => { const cloneAction = useCloneAction ( forceDisable , transformNodes ) ; const deleteAction = useDeleteAction ( forceDisable ) ; const discoverAction = useDiscoverAction ( forceDisable ) ; const editAction = useEditAction ( forceDisable , transformNodes ) ; const startAction = useStartAction ( forceDisable , transformNodes ) ; const stopAction = useStopAction ( forceDisable ) ; const createAlertRuleAction = useCreateAlertRuleAction ( forceDisable ) ; return { modals : ( < > { startAction . isModalVisible && < StartActionModal { ... startAction } / > } { editAction . config && editAction . isFlyoutVisible && ( < EditTransformFlyout closeFlyout = { editAction . closeFlyout } config = { editAction . config } indexPatternId = { editAction . indexPatternId } / > ) } { deleteAction . isModalVisible && < DeleteActionModal { ... deleteAction } / > } < />), actions : [ discoverAction . action , createAlertRuleAction . action , startAction . action , stopAction . action , editAction . action , cloneAction . action , deleteAction . action , ] , } ; } ;