blob: 54e406f49d1902e2649692485e299ca25934db8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import React, { useState } from 'react'
import { useDispatch } from 'react-redux'
import ConfirmationModal from '../../../../../components/modals/ConfirmationModal'
import { deleteMachine } from '../../../../../redux/actions/topology/machine'
import { Button } from 'reactstrap'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faTrash } from '@fortawesome/free-solid-svg-icons'
const DeleteMachineContainer = () => {
const dispatch = useDispatch()
const [isVisible, setVisible] = useState(false)
const callback = (isConfirmed) => {
if (isConfirmed) {
dispatch(deleteMachine())
}
setVisible(false)
}
return (
<>
<Button color="danger" outline block onClick={() => setVisible(true)}>
<FontAwesomeIcon icon={faTrash} className="mr-2" />
Delete this machine
</Button>
<ConfirmationModal
title="Delete this machine"
message="Are you sure you want to delete this machine?"
show={isVisible}
callback={callback}
/>
</>
)
}
export default DeleteMachineContainer
|