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.
59 lines
1.4 KiB
59 lines
1.4 KiB
import PropTypes from 'prop-types';
|
|
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { createSelector } from 'reselect';
|
|
import { cloneIndexer, deleteIndexer, fetchIndexers } from 'Store/Actions/indexerActions';
|
|
import createSortedSectionSelector from 'Store/Selectors/createSortedSectionSelector';
|
|
import sortByName from 'Utilities/Array/sortByName';
|
|
import Indexers from './Indexers';
|
|
|
|
function createMapStateToProps() {
|
|
return createSelector(
|
|
createSortedSectionSelector('indexers', sortByName),
|
|
(indexers) => indexers
|
|
);
|
|
}
|
|
|
|
const mapDispatchToProps = {
|
|
dispatchFetchIndexers: fetchIndexers,
|
|
dispatchDeleteIndexer: deleteIndexer,
|
|
dispatchCloneIndexer: cloneIndexer
|
|
};
|
|
|
|
class IndexersConnector extends Component {
|
|
|
|
//
|
|
// Lifecycle
|
|
|
|
componentDidMount() {
|
|
this.props.dispatchFetchIndexers();
|
|
}
|
|
|
|
//
|
|
// Listeners
|
|
|
|
onConfirmDeleteIndexer = (id) => {
|
|
this.props.dispatchDeleteIndexer({ id });
|
|
}
|
|
|
|
//
|
|
// Render
|
|
|
|
render() {
|
|
return (
|
|
<Indexers
|
|
{...this.props}
|
|
onConfirmDeleteIndexer={this.onConfirmDeleteIndexer}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
IndexersConnector.propTypes = {
|
|
dispatchFetchIndexers: PropTypes.func.isRequired,
|
|
dispatchDeleteIndexer: PropTypes.func.isRequired,
|
|
dispatchCloneIndexer: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default connect(createMapStateToProps, mapDispatchToProps)(IndexersConnector);
|