Skip to content

Commit a87278a

Browse files
Leshe4kaLeshe4kagermanosin
authored
Sorting by messages count (#1338)
Co-authored-by: Leshe4ka <[email protected]> Co-authored-by: German Osin <[email protected]>
1 parent ac7dc22 commit a87278a

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

frontend/src/components/Topics/List/TopicTable.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,13 @@ const TopicTable: React.FC = () => {
7272
size: 148,
7373
},
7474
{
75+
id: TopicColumnsToSort.MESSAGES_COUNT,
7576
header: 'Number of messages',
76-
accessorKey: 'partitions',
77-
enableSorting: false,
78-
size: 146,
79-
cell: ({ getValue }) => {
80-
const partitions = getValue<Topic['partitions']>();
81-
if (partitions === undefined || partitions.length === 0) {
82-
return 0;
83-
}
84-
return partitions.reduce((memo, { offsetMax, offsetMin }) => {
85-
return memo + (offsetMax - offsetMin);
86-
}, 0);
77+
accessorKey: 'messagesCount',
78+
cell: (args) => {
79+
return args.getValue() ?? 'N/A';
8780
},
81+
size: 146,
8882
},
8983
{
9084
id: TopicColumnsToSort.SIZE,

frontend/src/lib/fixtures/topics.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const internalTopicPayload = {
1717
segmentSize: 0,
1818
segmentCount: 1,
1919
underReplicatedPartitions: 0,
20+
messagesCount: 0,
2021
partitions: [
2122
{
2223
partition: 0,
@@ -38,6 +39,7 @@ export const externalTopicPayload = {
3839
segmentSize: 1263,
3940
segmentCount: 1,
4041
underReplicatedPartitions: 0,
42+
messagesCount: 0,
4143
partitions: [
4244
{
4345
partition: 0,

0 commit comments

Comments
 (0)