import React from 'react'; import { TableCellProps } from 'components/common/SmartTable/TableColumn'; import { Tag } from 'components/common/Tag/Tag.styled'; import BytesFormatted from 'components/common/BytesFormatted/BytesFormatted'; import { Topic } from 'generated-sources'; import * as S from './List.styled'; export const TitleCell: React.FC> = ({ dataItem: { internal, name }, }) => { return ( <> {internal && IN} {name} ); }; export const TopicSizeCell: React.FC> = ({ dataItem: { segmentSize }, }) => { return ; }; export const OutOfSyncReplicasCell: React.FC> = ({ dataItem: { partitions }, }) => { const data = React.useMemo(() => { if (partitions === undefined || partitions.length === 0) { return 0; } return partitions.reduce((memo, { replicas }) => { const outOfSync = replicas?.filter(({ inSync }) => !inSync); return memo + (outOfSync?.length || 0); }, 0); }, [partitions]); return {data}; }; export const MessagesCell: React.FC> = ({ dataItem: { partitions }, }) => { const data = React.useMemo(() => { if (partitions === undefined || partitions.length === 0) { return 0; } return partitions.reduce((memo, { offsetMax, offsetMin }) => { return memo + (offsetMax - offsetMin); }, 0); }, [partitions]); return {data}; };