SettingsContainer.ts 879 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { connect } from 'react-redux';
  2. import { RootState, ClusterName, TopicName } from 'redux/interfaces';
  3. import { withRouter, RouteComponentProps } from 'react-router-dom';
  4. import { fetchTopicConfig } from 'redux/actions';
  5. import {
  6. getTopicConfig,
  7. getTopicConfigFetched,
  8. } from 'redux/reducers/topics/selectors';
  9. import Settings from './Settings';
  10. interface RouteProps {
  11. clusterName: ClusterName;
  12. topicName: TopicName;
  13. }
  14. type OwnProps = RouteComponentProps<RouteProps>;
  15. const mapStateToProps = (
  16. state: RootState,
  17. {
  18. match: {
  19. params: { topicName, clusterName },
  20. },
  21. }: OwnProps
  22. ) => ({
  23. clusterName,
  24. topicName,
  25. config: getTopicConfig(state, topicName),
  26. isFetched: getTopicConfigFetched(state),
  27. });
  28. const mapDispatchToProps = {
  29. fetchTopicConfig,
  30. };
  31. export default withRouter(
  32. connect(mapStateToProps, mapDispatchToProps)(Settings)
  33. );