Skip to content

Commit 62651c9

Browse files
committed
refactor online partitions to isr
1 parent 5f17a42 commit 62651c9

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

frontend/src/components/Brokers/BrokersList/TableCells/TableCells.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const DiscUsage = ({
5757

5858
type ScewProps = CellContext<
5959
BrokersTableRow,
60-
BrokersTableRow['partitionsSkew'] | BrokersTableRow['leadersSkew']
60+
BrokersTableRow['replicasSkew'] | BrokersTableRow['leadersSkew']
6161
>;
6262

6363
export const Skew = ({ getValue }: ScewProps) => {
@@ -73,25 +73,26 @@ export const Skew = ({ getValue }: ScewProps) => {
7373
);
7474
};
7575

76-
type OnlinePartitionsProps = CellContext<
76+
type InSyncReplicasProps = CellContext<
7777
BrokersTableRow,
78-
BrokersTableRow['onlinePartitionCount']
78+
BrokersTableRow['inSyncReplicas']
7979
>;
8080

81-
export const OnlinePartitions = ({ row }: OnlinePartitionsProps) => {
82-
const { onlinePartitionCount, offlinePartitionCount } = row.original;
81+
export const InSyncReplicas = ({ row }: InSyncReplicasProps) => {
82+
const { replicas, inSyncReplicas } = row.original;
8383

8484
if (
85-
onlinePartitionCount === undefined ||
86-
offlinePartitionCount === undefined
85+
replicas === undefined ||
86+
inSyncReplicas === undefined
8787
) {
8888
return null;
8989
}
90+
const value = `${inSyncReplicas} of ${replicas}`;
9091

9192
return (
9293
<ColoredCell
93-
value={onlinePartitionCount}
94-
attention={offlinePartitionCount > 0}
94+
value={value}
95+
attention={inSyncReplicas < replicas}
9596
/>
9697
);
9798
};

frontend/src/components/Brokers/BrokersList/lib/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export type BrokersTableRow = {
55
port: number | undefined;
66
host: string | undefined;
77
partitionsLeader: number | undefined;
8-
partitionsSkew: number | undefined;
98
leadersSkew: number | undefined;
10-
onlinePartitionCount: number | undefined;
11-
offlinePartitionCount: number | undefined;
9+
replicas: number | undefined;
10+
inSyncReplicas: number | undefined;
11+
replicasSkew: number | undefined;
1212
activeControllers: number | undefined;
1313
};

frontend/src/components/Brokers/BrokersList/lib/utils.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export const getBrokersTableRows = ({
1919
brokers = [],
2020
diskUsage = [],
2121
activeControllers,
22-
onlinePartitionCount,
23-
offlinePartitionCount,
2422
}: GetBrokersTableRowsParams): BrokersTableRow[] => {
2523
if (!brokers || brokers.length === 0) {
2624
return [];
@@ -38,10 +36,10 @@ export const getBrokersTableRows = ({
3836
port: broker.port,
3937
host: broker.host,
4038
partitionsLeader: broker.partitionsLeader,
41-
partitionsSkew: broker.partitionsSkew,
4239
leadersSkew: broker.leadersSkew,
43-
onlinePartitionCount,
44-
offlinePartitionCount,
40+
replicas: broker.partitions,
41+
inSyncReplicas: broker.inSyncPartitions,
42+
replicasSkew: broker.partitionsSkew,
4543
activeControllers,
4644
};
4745
});
@@ -59,7 +57,11 @@ export const getBrokersTableColumns = () => {
5957
header: 'Disk usage',
6058
cell: Cell.DiscUsage,
6159
}),
62-
columnHelper.accessor('partitionsSkew', {
60+
columnHelper.accessor('inSyncReplicas', {
61+
header: 'In Sync Replicas',
62+
cell: Cell.InSyncReplicas,
63+
}),
64+
columnHelper.accessor('replicasSkew', {
6365
header: SkewHeader,
6466
cell: Cell.Skew,
6567
}),
@@ -68,10 +70,6 @@ export const getBrokersTableColumns = () => {
6870
header: 'Leader skew',
6971
cell: Cell.Skew,
7072
}),
71-
columnHelper.accessor('onlinePartitionCount', {
72-
header: 'Online partitions',
73-
cell: Cell.OnlinePartitions,
74-
}),
7573
columnHelper.accessor('port', { header: 'Port' }),
7674
columnHelper.accessor('host', { header: 'Host' }),
7775
];

0 commit comments

Comments
 (0)