
* remove withRouter HOC from FiltersContainer * remove withRouter HOC from Topics DetailsContainer * remove withRouter HOC from Topics TopicsConsumerGroupsContainer * withRouter HOC from Topics TopicsConsumerGroupsContainer * minor code refactor in the Details spec * Routes code modifications to refactor strings representation to functions * Settings and TopicsConsumer removal of HOC with Router * Remove withRouter HOC from Overview file * Remove withRouter HOC from Edit file * replace Router path with functions instead of strings * delete CustomParamsContainer and use the simple component in the TopicForm * remove HOC from DangerZone container * Remove withRouter HOC from Connect pages like Config , Overview , Tasks * Remove withRouter HOC from Connect pages like Actions, Details, Edit, New * Refactor Kafka Connect Codes * Refactor Topics pages * Remove HOC from Diff component and minor code refactor * Route component migration into children instead of renderProps or component param in App Component * Route component migration into children instead of renderProps or component param in Cluster Component * Route component migration into children instead of renderProps or component param in Topics Component * Route component migration into children instead of renderProps or component param in Topic Component * Route component migration into children instead of renderProps or component param in Topic Component * minor bug fix in the Overview selector spread * change Router from component Render to child render in ConsumerGroups page * change Router from component Render to child render in Schemas page * change Router from component Render to child render in KsqlDb page * change Router from component Render to child render in Connect page * change Router from component Render to child render in Connect Details page * Overview Details styling code modifications * All written path to paths with functions * Route Parameters code fix with functions and params with variables * Updating BreadCrumb Route * Refactor Redirects * WIP React Router v6 migration * Remove unused imports from the file * Make KsqlDb pages work with relative Routes * WIP Make Connect pages work and fix the Schema page testing problem * transforming consumer groups into relative path router * Transform Topics pages into relative routes * Transform Topic pages into relative routes * Minor changes in Connect and KsqlDb test suites relative routes * Minor changes in Connect and KsqlDb test suites relative routes * change the Details into relative Routes * Topics List naviagtion and caching issue fixed in tests suites * Topic New Naviagation issue fix + tests suites * Details navigate migrating into relative paths * Send Message Submit Naviagttion with tests suites * Topic Edit pages with working routes navigation * Topic Details and ResetOffsets Pages tests suites and navigations * Messages Table Tests suites * BreadCrumbs Routes fixes * ClusterMenu and Links styling minor code modifications * ClusterMenu and Links styling minor code modifications * Minor Code modifications * Fix Lintter Problems * fix Code Smells * create custom useParams hook * Adding Path tests * minor code refactors * Fix the Button Component redundant Props + transforming routes to relative * Fix linter issues
135 lines
4.6 KiB
TypeScript
135 lines
4.6 KiB
TypeScript
import React from 'react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import useAppParams from 'lib/hooks/useAppParams';
|
|
import {
|
|
clusterConsumerGroupResetRelativePath,
|
|
ClusterGroupParam,
|
|
} from 'lib/paths';
|
|
import PageLoader from 'components/common/PageLoader/PageLoader';
|
|
import ConfirmationModal from 'components/common/ConfirmationModal/ConfirmationModal';
|
|
import ClusterContext from 'components/contexts/ClusterContext';
|
|
import PageHeading from 'components/common/PageHeading/PageHeading';
|
|
import VerticalElipsisIcon from 'components/common/Icons/VerticalElipsisIcon';
|
|
import * as Metrics from 'components/common/Metrics';
|
|
import { Tag } from 'components/common/Tag/Tag.styled';
|
|
import Dropdown from 'components/common/Dropdown/Dropdown';
|
|
import DropdownItem from 'components/common/Dropdown/DropdownItem';
|
|
import { groupBy } from 'lodash';
|
|
import { Table } from 'components/common/table/Table/Table.styled';
|
|
import TableHeaderCell from 'components/common/table/TableHeaderCell/TableHeaderCell';
|
|
import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
|
|
import {
|
|
fetchConsumerGroupDetails,
|
|
deleteConsumerGroup,
|
|
selectById,
|
|
getIsConsumerGroupDeleted,
|
|
getAreConsumerGroupDetailsFulfilled,
|
|
} from 'redux/reducers/consumerGroups/consumerGroupsSlice';
|
|
import getTagColor from 'components/common/Tag/getTagColor';
|
|
|
|
import ListItem from './ListItem';
|
|
|
|
const Details: React.FC = () => {
|
|
const navigate = useNavigate();
|
|
const { isReadOnly } = React.useContext(ClusterContext);
|
|
const { consumerGroupID, clusterName } = useAppParams<ClusterGroupParam>();
|
|
const dispatch = useAppDispatch();
|
|
const consumerGroup = useAppSelector((state) =>
|
|
selectById(state, consumerGroupID)
|
|
);
|
|
const isDeleted = useAppSelector(getIsConsumerGroupDeleted);
|
|
const isFetched = useAppSelector(getAreConsumerGroupDetailsFulfilled);
|
|
|
|
const [isConfirmationModalVisible, setIsConfirmationModalVisible] =
|
|
React.useState<boolean>(false);
|
|
|
|
React.useEffect(() => {
|
|
dispatch(fetchConsumerGroupDetails({ clusterName, consumerGroupID }));
|
|
}, [clusterName, consumerGroupID, dispatch]);
|
|
|
|
const onDelete = () => {
|
|
setIsConfirmationModalVisible(false);
|
|
dispatch(deleteConsumerGroup({ clusterName, consumerGroupID }));
|
|
};
|
|
React.useEffect(() => {
|
|
if (isDeleted) {
|
|
navigate('../');
|
|
}
|
|
}, [clusterName, navigate, isDeleted]);
|
|
|
|
const onResetOffsets = () => {
|
|
navigate(clusterConsumerGroupResetRelativePath);
|
|
};
|
|
|
|
if (!isFetched || !consumerGroup) {
|
|
return <PageLoader />;
|
|
}
|
|
|
|
const partitionsByTopic = groupBy(consumerGroup.partitions, 'topic');
|
|
|
|
return (
|
|
<div>
|
|
<div>
|
|
<PageHeading text={consumerGroupID}>
|
|
{!isReadOnly && (
|
|
<Dropdown label={<VerticalElipsisIcon />} right>
|
|
<DropdownItem onClick={onResetOffsets}>Reset offset</DropdownItem>
|
|
<DropdownItem
|
|
onClick={() => setIsConfirmationModalVisible(true)}
|
|
danger
|
|
>
|
|
Delete consumer group
|
|
</DropdownItem>
|
|
</Dropdown>
|
|
)}
|
|
</PageHeading>
|
|
</div>
|
|
<Metrics.Wrapper>
|
|
<Metrics.Section>
|
|
<Metrics.Indicator label="State">
|
|
<Tag color={getTagColor(consumerGroup)}>{consumerGroup.state}</Tag>
|
|
</Metrics.Indicator>
|
|
<Metrics.Indicator label="Members">
|
|
{consumerGroup.members}
|
|
</Metrics.Indicator>
|
|
<Metrics.Indicator label="Assigned Topics">
|
|
{consumerGroup.topics}
|
|
</Metrics.Indicator>
|
|
<Metrics.Indicator label="Assigned Partitions">
|
|
{consumerGroup.partitions?.length}
|
|
</Metrics.Indicator>
|
|
<Metrics.Indicator label="Coordinator ID">
|
|
{consumerGroup.coordinator?.id}
|
|
</Metrics.Indicator>
|
|
</Metrics.Section>
|
|
</Metrics.Wrapper>
|
|
<Table isFullwidth>
|
|
<thead>
|
|
<tr>
|
|
<TableHeaderCell> </TableHeaderCell>
|
|
<TableHeaderCell title="Topic" />
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{Object.keys(partitionsByTopic).map((key) => (
|
|
<ListItem
|
|
clusterName={clusterName}
|
|
consumers={partitionsByTopic[key]}
|
|
name={key}
|
|
key={key}
|
|
/>
|
|
))}
|
|
</tbody>
|
|
</Table>
|
|
<ConfirmationModal
|
|
isOpen={isConfirmationModalVisible}
|
|
onCancel={() => setIsConfirmationModalVisible(false)}
|
|
onConfirm={onDelete}
|
|
>
|
|
Are you sure you want to delete this consumer group?
|
|
</ConfirmationModal>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Details;
|