ConsumersGroupsContainer.ts 863 B

12345678910111213141516171819202122232425262728293031
  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. type OwnProps = RouteComponentProps<RouteProps>;
  11. const mapStateToProps = (
  12. state: RootState,
  13. {
  14. match: {
  15. params: { clusterName },
  16. },
  17. }: OwnProps
  18. ) => ({
  19. isFetched: getIsConsumerGroupsListFetched(state),
  20. clusterName,
  21. });
  22. const mapDispatchToProps = {
  23. fetchConsumerGroupsList: (clusterName: ClusterName) =>
  24. fetchConsumerGroupsList(clusterName),
  25. };
  26. export default connect(mapStateToProps, mapDispatchToProps)(ConsumerGroups);