Skip to content

Commit

Permalink
refactor 'Online Partitions' column
Browse files Browse the repository at this point in the history
  • Loading branch information
bachmanity1 committed Dec 19, 2024
1 parent d53faa6 commit 0c706a8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<ColoredCell
value={inSyncPartitions}
attention={inSyncPartitions !== count}
/>
);
};
2 changes: 1 addition & 1 deletion frontend/src/components/Brokers/BrokersList/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/components/Brokers/BrokersList/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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' }),
];
Expand Down

0 comments on commit 0c706a8

Please sign in to comment.