From 0c706a8337e0293faa441fd37b05c7e2f70016d0 Mon Sep 17 00:00:00 2001 From: bachmanity1 Date: Fri, 25 Oct 2024 12:22:01 +0900 Subject: [PATCH] refactor 'Online Partitions' column --- .../BrokersList/TableCells/TableCells.tsx | 20 ------------------- .../Brokers/BrokersList/lib/types.ts | 2 +- .../Brokers/BrokersList/lib/utils.ts | 9 +++------ 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/frontend/src/components/Brokers/BrokersList/TableCells/TableCells.tsx b/frontend/src/components/Brokers/BrokersList/TableCells/TableCells.tsx index 520ec2c80..84d27a0db 100644 --- a/frontend/src/components/Brokers/BrokersList/TableCells/TableCells.tsx +++ b/frontend/src/components/Brokers/BrokersList/TableCells/TableCells.tsx @@ -72,23 +72,3 @@ export const Skew = ({ getValue }: ScewProps) => { /> ); }; - -type OnlinePartitionsProps = CellContext< - BrokersTableRow, - BrokersTableRow['inSyncPartitions'] ->; - -export const OnlinePartitions = ({ row }: OnlinePartitionsProps) => { - const { count, inSyncPartitions } = row.original; - - if (count === undefined || inSyncPartitions === undefined) { - return null; - } - - return ( - - ); -}; diff --git a/frontend/src/components/Brokers/BrokersList/lib/types.ts b/frontend/src/components/Brokers/BrokersList/lib/types.ts index 5a2525c44..24b9abe4f 100644 --- a/frontend/src/components/Brokers/BrokersList/lib/types.ts +++ b/frontend/src/components/Brokers/BrokersList/lib/types.ts @@ -7,7 +7,7 @@ export type BrokersTableRow = { partitionsLeader: number | undefined; partitionsSkew: number | undefined; leadersSkew: number | undefined; - inSyncPartitions: number | undefined; + partitions: number | undefined; onlinePartitionCount: number | undefined; offlinePartitionCount: number | undefined; activeControllers: number | undefined; diff --git a/frontend/src/components/Brokers/BrokersList/lib/utils.ts b/frontend/src/components/Brokers/BrokersList/lib/utils.ts index 2bb55b94f..16f72a5bd 100644 --- a/frontend/src/components/Brokers/BrokersList/lib/utils.ts +++ b/frontend/src/components/Brokers/BrokersList/lib/utils.ts @@ -40,7 +40,7 @@ export const getBrokersTableRows = ({ partitionsLeader: broker.partitionsLeader, partitionsSkew: broker.partitionsSkew, leadersSkew: broker.leadersSkew, - inSyncPartitions: broker.inSyncPartitions, + partitions: broker.partitions, onlinePartitionCount, offlinePartitionCount, activeControllers, @@ -60,19 +60,16 @@ export const getBrokersTableColumns = () => { header: 'Disk usage', cell: Cell.DiscUsage, }), + columnHelper.accessor('partitions', { header: 'Partitions' }), columnHelper.accessor('partitionsSkew', { header: SkewHeader, cell: Cell.Skew, }), columnHelper.accessor('partitionsLeader', { header: 'Leaders' }), columnHelper.accessor('leadersSkew', { - header: 'Leader skew', + header: 'Leaders skew', cell: Cell.Skew, }), - columnHelper.accessor('inSyncPartitions', { - header: 'Online partitions', - cell: Cell.OnlinePartitions, - }), columnHelper.accessor('port', { header: 'Port' }), columnHelper.accessor('host', { header: 'Host' }), ];