summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/containers/modals/DeleteRackModal.js
blob: ca76fd04cd96607dbacea40ea81e81a233f4391a (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
import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { closeDeleteRackModal } from '../../actions/modals/topology'
import { deleteRack } from '../../actions/topology/rack'
import ConfirmationModal from '../../components/modals/ConfirmationModal'

const DeleteRackModal = (props) => {
    const visible = useSelector((state) => state.modals.deleteRackModalVisible)
    const dispatch = useDispatch()
    const callback = (isConfirmed) => {
        if (isConfirmed) {
            dispatch(deleteRack())
        }
        dispatch(closeDeleteRackModal())
    }
    return (
        <ConfirmationModal
            title="Delete this rack"
            message="Are you sure you want to delete this rack?"
            show={visible}
            callback={callback}
            {...props}
        />
    )
}

export default DeleteRackModal