@@ -31,13 +31,19 @@ import {
3131 TRANSFORM_MODE ,
3232 TRANSFORM_LIST_COLUMN ,
3333} from '../../../../common' ;
34+ import { useStopTransforms } from '../../../../hooks' ;
3435import { AuthorizationContext } from '../../../../lib/authorization' ;
3536
3637import { CreateTransformButton } from '../create_transform_button' ;
3738import { RefreshTransformListButton } from '../refresh_transform_list_button' ;
38- import { useDeleteAction , DeleteButton , DeleteButtonModal } from '../action_delete' ;
39- import { useStartAction , StartButton , StartButtonModal } from '../action_start' ;
40- import { StopButton } from '../action_stop' ;
39+ import {
40+ isDeleteActionDisabled ,
41+ useDeleteAction ,
42+ DeleteActionName ,
43+ DeleteActionModal ,
44+ } from '../action_delete' ;
45+ import { useStartAction , StartActionName , StartActionModal } from '../action_start' ;
46+ import { StopActionName } from '../action_stop' ;
4147
4248import { ItemIdToExpandedRowMap , Clause , TermClause , FieldClause , Value } from './common' ;
4349import { getTaskStateBadge , useColumns } from './use_columns' ;
@@ -89,8 +95,8 @@ export const TransformList: FC<Props> = ({
8995
9096 const [ transformSelection , setTransformSelection ] = useState < TransformListRow [ ] > ( [ ] ) ;
9197 const [ isActionsMenuOpen , setIsActionsMenuOpen ] = useState ( false ) ;
92- const bulkStartAction = useStartAction ( ) ;
93- const bulkDeleteAction = useDeleteAction ( ) ;
98+ const bulkStartAction = useStartAction ( false ) ;
99+ const bulkDeleteAction = useDeleteAction ( false ) ;
94100
95101 const [ searchError , setSearchError ] = useState < any > ( undefined ) ;
96102
@@ -100,6 +106,8 @@ export const TransformList: FC<Props> = ({
100106 const [ sortField , setSortField ] = useState < string > ( TRANSFORM_LIST_COLUMN . ID ) ;
101107 const [ sortDirection , setSortDirection ] = useState < Direction > ( 'asc' ) ;
102108
109+ const stopTransforms = useStopTransforms ( ) ;
110+
103111 const { capabilities } = useContext ( AuthorizationContext ) ;
104112 const disabled =
105113 ! capabilities . canCreateTransform ||
@@ -257,13 +265,23 @@ export const TransformList: FC<Props> = ({
257265
258266 const bulkActionMenuItems = [
259267 < div key = "startAction" className = "transform__BulkActionItem" >
260- < StartButton items = { transformSelection } onClick = { bulkStartAction . openModal } />
268+ < EuiButtonEmpty onClick = { ( ) => bulkStartAction . openModal ( transformSelection ) } >
269+ < StartActionName items = { transformSelection } />
270+ </ EuiButtonEmpty >
261271 </ div > ,
262272 < div key = "stopAction" className = "transform__BulkActionItem" >
263- < StopButton items = { transformSelection } />
273+ < EuiButtonEmpty onClick = { ( ) => stopTransforms ( transformSelection ) } >
274+ < StopActionName items = { transformSelection } />
275+ </ EuiButtonEmpty >
264276 </ div > ,
265277 < div key = "deleteAction" className = "transform__BulkActionItem" >
266- < DeleteButton items = { transformSelection } onClick = { bulkDeleteAction . openModal } />
278+ < EuiButtonEmpty onClick = { ( ) => bulkDeleteAction . openModal ( transformSelection ) } >
279+ < DeleteActionName
280+ canDeleteTransform = { capabilities . canDeleteTransform }
281+ disabled = { isDeleteActionDisabled ( transformSelection , false ) }
282+ isBulkAction = { true }
283+ />
284+ </ EuiButtonEmpty >
267285 </ div > ,
268286 ] ;
269287
@@ -381,8 +399,8 @@ export const TransformList: FC<Props> = ({
381399 return (
382400 < div data-test-subj = "transformListTableContainer" >
383401 { /* Bulk Action Modals */ }
384- { bulkStartAction . isModalVisible && < StartButtonModal { ...bulkStartAction } /> }
385- { bulkDeleteAction . isModalVisible && < DeleteButtonModal { ...bulkDeleteAction } /> }
402+ { bulkStartAction . isModalVisible && < StartActionModal { ...bulkStartAction } /> }
403+ { bulkDeleteAction . isModalVisible && < DeleteActionModal { ...bulkDeleteAction } /> }
386404
387405 { /* Single Action Modals */ }
388406 { singleActionModals }
0 commit comments