ConsumerGroups.tsx 829 B

12345678910111213141516171819202122232425262728293031323334
  1. import React from 'react';
  2. import { ClusterName } from 'redux/interfaces';
  3. import {
  4. Switch,
  5. Route,
  6. } from 'react-router-dom';
  7. import ListContainer from './List/ListContainer';
  8. import PageLoader from 'components/common/PageLoader/PageLoader';
  9. interface Props {
  10. clusterName: ClusterName;
  11. isFetched: boolean;
  12. fetchConsumerGroupsList: (clusterName: ClusterName) => void;
  13. }
  14. const ConsumerGroups: React.FC<Props> = ({
  15. clusterName,
  16. isFetched,
  17. fetchConsumerGroupsList,
  18. }) => {
  19. React.useEffect(() => { fetchConsumerGroupsList(clusterName); }, [fetchConsumerGroupsList, clusterName]);
  20. if (isFetched) {
  21. return (
  22. <Switch>
  23. <Route exact path="/clusters/:clusterName/consumer-groups" component={ListContainer} />
  24. </Switch>
  25. );
  26. }
  27. return (<PageLoader />);
  28. };
  29. export default ConsumerGroups;