import {connect} from 'react-redux';
import {add_dialog_msg, toggle_loading, get_modbus_list, get_mb_log, clear_modbus} from '../../actions';
import ModbusLogPage from '../../components/AdminPage/ModbusLog';

const mapStateToProps = (state) => ({
	i18n: state.i18n,
    list: state.lists.modbus.list,
    log: state.lists.modbus.log
});

const mapDispatchToProps = (dispatch, ownProps) => ({
	showDialog: (msg) => {
		dispatch(add_dialog_msg(msg));
	},
    toggleLoading: (flag = false) => {
        dispatch(toggle_loading(flag));
    },
    getList: () => {
        dispatch(get_modbus_list());
    },
    clearList: ()=>{
        dispatch(clear_modbus())
    },
    getMBLog: (data) => {
        dispatch(get_mb_log(data));
    }
})

export default connect(mapStateToProps, mapDispatchToProps)(ModbusLogPage);