import React from 'react'; import { Topic, TopicDetails, ConsumerGroup } from 'generated-sources'; import { ClusterName, TopicName } from 'redux/interfaces'; import { clusterConsumerGroupsPath } from 'lib/paths'; import { Table } from 'components/common/table/Table/Table.styled'; import TableHeaderCell from 'components/common/table/TableHeaderCell/TableHeaderCell'; import TagStyled from 'components/common/Tag/Tag.styled'; import { TableKeyLink } from 'components/common/table/Table/TableKeyLink.styled'; import { Link } from 'react-router-dom'; interface Props extends Topic, TopicDetails { clusterName: ClusterName; topicName: TopicName; consumerGroups: ConsumerGroup[]; fetchTopicConsumerGroups( clusterName: ClusterName, topicName: TopicName ): void; } const TopicConsumerGroups: React.FC = ({ consumerGroups, fetchTopicConsumerGroups, clusterName, topicName, }) => { React.useEffect(() => { fetchTopicConsumerGroups(clusterName, topicName); }, []); return (
{consumerGroups.map((consumer) => ( {consumer.groupId} ))} {consumerGroups.length === 0 && ( )}
{consumer.members} {consumer.messagesBehind} {consumer.coordinator?.id} {consumer.state && ( {`${consumer.state .charAt(0) .toUpperCase()}${consumer.state .slice(1) .toLowerCase()}`} )}
No active consumer groups
); }; export default TopicConsumerGroups;