You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.6 KiB
66 lines
1.6 KiB
6 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React, { Component } from 'react';
|
||
|
import { connect } from 'react-redux';
|
||
|
import { clearPendingChanges } from 'Store/Actions/baseActions';
|
||
4 years ago
|
import { cancelSaveIndexer, cancelTestIndexer } from 'Store/Actions/indexerActions';
|
||
6 years ago
|
import EditIndexerModal from './EditIndexerModal';
|
||
|
|
||
|
function createMapDispatchToProps(dispatch, props) {
|
||
4 years ago
|
const section = 'indexers';
|
||
6 years ago
|
|
||
|
return {
|
||
|
dispatchClearPendingChanges() {
|
||
|
dispatch(clearPendingChanges({ section }));
|
||
|
},
|
||
|
|
||
|
dispatchCancelTestIndexer() {
|
||
|
dispatch(cancelTestIndexer({ section }));
|
||
|
},
|
||
|
|
||
|
dispatchCancelSaveIndexer() {
|
||
|
dispatch(cancelSaveIndexer({ section }));
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class EditIndexerModalConnector extends Component {
|
||
|
|
||
|
//
|
||
|
// Listeners
|
||
|
|
||
|
onModalClose = () => {
|
||
|
this.props.dispatchClearPendingChanges();
|
||
|
this.props.dispatchCancelTestIndexer();
|
||
|
this.props.dispatchCancelSaveIndexer();
|
||
|
this.props.onModalClose();
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Render
|
||
|
|
||
|
render() {
|
||
|
const {
|
||
|
dispatchClearPendingChanges,
|
||
|
dispatchCancelTestIndexer,
|
||
|
dispatchCancelSaveIndexer,
|
||
|
...otherProps
|
||
|
} = this.props;
|
||
|
|
||
|
return (
|
||
|
<EditIndexerModal
|
||
|
{...otherProps}
|
||
|
onModalClose={this.onModalClose}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
EditIndexerModalConnector.propTypes = {
|
||
|
onModalClose: PropTypes.func.isRequired,
|
||
|
dispatchClearPendingChanges: PropTypes.func.isRequired,
|
||
|
dispatchCancelTestIndexer: PropTypes.func.isRequired,
|
||
|
dispatchCancelSaveIndexer: PropTypes.func.isRequired
|
||
|
};
|
||
|
|
||
|
export default connect(null, createMapDispatchToProps)(EditIndexerModalConnector);
|