DetailsContainer.ts 850 B

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