summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/containers/modals/DeleteMachineModal.js
blob: 33b2612fc6038d6d84b6c1a38a2066c395cb661c (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
import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { closeDeleteMachineModal } from '../../actions/modals/topology'
import { deleteMachine } from '../../actions/topology/machine'
import ConfirmationModal from '../../components/modals/ConfirmationModal'

const DeleteMachineModal = () => {
    const dispatch = useDispatch()
    const callback = (isConfirmed) => {
        if (isConfirmed) {
            dispatch(deleteMachine())
        }
        dispatch(closeDeleteMachineModal())
    }
    const visible = useSelector((state) => state.modals.deleteMachineModalVisible)
    return (
        <ConfirmationModal
            title="Delete this machine"
            message="Are you sure you want to delete this machine?"
            show={visible}
            callback={callback}
        />
    )
}

export default DeleteMachineModal