blob: c2b658d9a9f96db1b99546ca3c578e12e5dd8e42 (
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
35
36
|
import React from "react";
import {connect} from "react-redux";
import {closeDeleteMachineModal} from "../../actions/modals/topology";
import {deleteMachine} from "../../actions/topology/machine";
import ConfirmationModal from "../../components/modals/ConfirmationModal";
const DeleteMachineModalComponent = ({visible, callback}) => (
<ConfirmationModal title="Delete this machine"
message="Are you sure you want to delete this machine?"
show={visible}
callback={callback}/>
);
const mapStateToProps = state => {
return {
visible: state.modals.deleteMachineModalVisible
};
};
const mapDispatchToProps = dispatch => {
return {
callback: (isConfirmed) => {
if (isConfirmed) {
dispatch(deleteMachine());
}
dispatch(closeDeleteMachineModal());
}
};
};
const DeleteMachineModal = connect(
mapStateToProps,
mapDispatchToProps
)(DeleteMachineModalComponent);
export default DeleteMachineModal;
|