PartitionTable.tsx 988 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* eslint-disable react/no-unstable-nested-components */
  2. import React from 'react';
  3. import { TopicAnalysisStats } from 'generated-sources';
  4. import { ColumnDef } from '@tanstack/react-table';
  5. import Table from 'components/common/NewTable';
  6. import PartitionInfoRow from './PartitionInfoRow';
  7. const PartitionTable: React.FC<{ data: TopicAnalysisStats[] }> = ({ data }) => {
  8. const columns = React.useMemo<ColumnDef<TopicAnalysisStats>[]>(
  9. () => [
  10. {
  11. header: 'Partition ID',
  12. accessorKey: 'partition',
  13. },
  14. {
  15. header: 'Total Messages',
  16. accessorKey: 'totalMsgs',
  17. },
  18. {
  19. header: 'Min Offset',
  20. accessorKey: 'minOffset',
  21. },
  22. { header: 'Max Offset', accessorKey: 'maxOffset' },
  23. ],
  24. []
  25. );
  26. return (
  27. <Table
  28. data={data}
  29. columns={columns}
  30. getRowCanExpand={() => true}
  31. renderSubComponent={PartitionInfoRow}
  32. enableSorting
  33. />
  34. );
  35. };
  36. export default PartitionTable;