Details.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import React from 'react';
  2. import { ClusterName } from 'redux/interfaces';
  3. import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
  4. import { clusterConsumerGroupsPath } from 'lib/paths';
  5. import { ConsumerGroupID, ConsumerGroup, ConsumerGroupDetails } from 'redux/interfaces/consumerGroup';
  6. import { Consumer } from 'redux/interfaces/consumerGroup';
  7. import ListItem from './ListItem';
  8. interface Props extends ConsumerGroup, ConsumerGroupDetails {
  9. clusterName: ClusterName;
  10. consumerGroupID: ConsumerGroupID;
  11. consumers: (Consumer)[];
  12. fetchConsumerGroupDetails: (clusterName: ClusterName, consumerGroupID: ConsumerGroupID) => void;
  13. }
  14. const Details: React.FC<Props> = ({
  15. clusterName,
  16. consumerGroupID,
  17. consumers,
  18. fetchConsumerGroupDetails
  19. }) => {
  20. React.useEffect(
  21. () => { fetchConsumerGroupDetails(clusterName, consumerGroupID); },
  22. [fetchConsumerGroupDetails, clusterName, consumerGroupID],
  23. );
  24. const items = consumers || [];
  25. return (
  26. <div className="section">
  27. <div className="level">
  28. <div className="level-item level-left">
  29. <Breadcrumb links={[
  30. { href: clusterConsumerGroupsPath(clusterName), label: 'All Consumer Groups' },
  31. ]}>
  32. {consumerGroupID}
  33. </Breadcrumb>
  34. </div>
  35. </div>
  36. <div className="box">
  37. <table className="table is-striped is-fullwidth">
  38. <thead>
  39. <tr>
  40. <th>Consumer ID</th>
  41. <th>Topic</th>
  42. <th>Partition</th>
  43. <th>Messages behind</th>
  44. <th>Current offset</th>
  45. <th>End offset</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. {items
  50. .map((consumer, index) => (
  51. <ListItem
  52. key={`consumers-list-item-key-${index}`}
  53. clusterName={clusterName}
  54. {...consumer}
  55. />
  56. ))}
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. );
  62. };
  63. export default Details;