blob: eba37833f749631d679b24f60d4935af0ff2b156 (
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
37
|
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;
|