Skip to content

Commit dc1dbdf

Browse files
FE: Fix 'Online Partitions' column (#607)
Co-authored-by: German Osin <german.osin@gmail.com>
1 parent 371be00 commit dc1dbdf

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

e2e-tests/src/main/java/io/kafbat/ui/screens/brokers/BrokersList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public List<SelenideElement> getAllVisibleElements() {
4848
}
4949

5050
private List<SelenideElement> getEnabledColumnHeaders() {
51-
return Stream.of("Broker ID", "Disk usage", "Partitions skew",
52-
"Leaders", "Leader skew", "Online partitions", "Port", "Host")
51+
return Stream.of("Broker ID", "Disk usage", "In Sync Replicas", "Replicas", "Replicas skew",
52+
"Leaders", "Leaders skew", "Port", "Host")
5353
.map(name -> $x(String.format(columnHeaderLocator, name)))
5454
.collect(Collectors.toList());
5555
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as S from './SkewHeader.styled';
66

77
const SkewHeader: React.FC = () => (
88
<S.CellWrapper>
9-
Partitions skew
9+
Replicas skew
1010
<Tooltip
1111
value={<InfoIcon />}
1212
content="The divergence from the average brokers' value"

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

Lines changed: 14 additions & 15 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,24 @@ 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;
83-
84-
if (
85-
onlinePartitionCount === undefined ||
86-
offlinePartitionCount === undefined
87-
) {
81+
export const InSyncReplicas = ({ getValue, row }: InSyncReplicasProps) => {
82+
const inSyncReplicas = getValue();
83+
const { replicas } = row.original;
84+
if (inSyncReplicas === undefined || replicas === undefined) {
8885
return null;
8986
}
90-
9187
return (
92-
<ColoredCell
93-
value={onlinePartitionCount}
94-
attention={offlinePartitionCount > 0}
95-
/>
88+
<ColoredCell value={inSyncReplicas} attention={inSyncReplicas < replicas} />
9689
);
9790
};
91+
92+
type ReplicasProps = CellContext<BrokersTableRow, BrokersTableRow['replicas']>;
93+
94+
export const Replicas = ({ getValue }: ReplicasProps) => {
95+
return <ColoredCell value={getValue() || ''} />;
96+
};

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: 13 additions & 11 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,19 +57,23 @@ 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('replicas', {
65+
header: 'Replicas',
66+
cell: Cell.Replicas,
67+
}),
68+
columnHelper.accessor('replicasSkew', {
6369
header: SkewHeader,
6470
cell: Cell.Skew,
6571
}),
6672
columnHelper.accessor('partitionsLeader', { header: 'Leaders' }),
6773
columnHelper.accessor('leadersSkew', {
68-
header: 'Leader skew',
74+
header: 'Leaders skew',
6975
cell: Cell.Skew,
7076
}),
71-
columnHelper.accessor('onlinePartitionCount', {
72-
header: 'Online partitions',
73-
cell: Cell.OnlinePartitions,
74-
}),
7577
columnHelper.accessor('port', { header: 'Port' }),
7678
columnHelper.accessor('host', { header: 'Host' }),
7779
];

0 commit comments

Comments
 (0)