SchemasContainer.tsx 901 B

123456789101112131415161718192021222324252627282930313233
  1. import { connect } from 'react-redux';
  2. import { RootState, ClusterName } from 'redux/interfaces';
  3. import { fetchSchemasByClusterName } from 'redux/actions';
  4. import { getIsSchemaListFetching } from 'redux/reducers/schemas/selectors';
  5. import { getClustersReadonlyStatus } from 'redux/reducers/clusters/selectors';
  6. import { RouteComponentProps, withRouter } from 'react-router-dom';
  7. import Schemas from './Schemas';
  8. interface RouteProps {
  9. clusterName: ClusterName;
  10. }
  11. type OwnProps = RouteComponentProps<RouteProps>;
  12. const mapStateToProps = (
  13. state: RootState,
  14. {
  15. match: {
  16. params: { clusterName },
  17. },
  18. }: OwnProps
  19. ) => ({
  20. isFetching: getIsSchemaListFetching(state),
  21. isReadOnly: getClustersReadonlyStatus(clusterName)(state),
  22. });
  23. const mapDispatchToProps = {
  24. fetchSchemasByClusterName,
  25. };
  26. export default withRouter(
  27. connect(mapStateToProps, mapDispatchToProps)(Schemas)
  28. );