ConsumersGroupsContainer.ts 849 B

123456789101112131415161718192021222324
  1. import { connect } from 'react-redux';
  2. import { fetchConsumerGroupsList } from 'redux/actions';
  3. import { RootState, ClusterName } from 'redux/interfaces';
  4. import { RouteComponentProps } from 'react-router-dom';
  5. import ConsumerGroups from './ConsumerGroups';
  6. import { getIsConsumerGroupsListFetched } from '../../redux/reducers/consumerGroups/selectors';
  7. interface RouteProps {
  8. clusterName: ClusterName;
  9. }
  10. interface OwnProps extends RouteComponentProps<RouteProps> { }
  11. const mapStateToProps = (state: RootState, { match: { params: { clusterName } }}: OwnProps) => ({
  12. isFetched: getIsConsumerGroupsListFetched(state),
  13. clusterName,
  14. });
  15. const mapDispatchToProps = {
  16. fetchConsumerGroupsList: (clusterName: ClusterName) => fetchConsumerGroupsList(clusterName),
  17. };
  18. export default connect(mapStateToProps, mapDispatchToProps)(ConsumerGroups);