Skip to content

Commit 10618b8

Browse files
feat(kafka topic): display missing columns from topic list (#466)
1 parent 08c35f6 commit 10618b8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/cmd/kafka/topic/list/list.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ type Options struct {
3535
type topicRow struct {
3636
Name string `json:"name,omitempty" header:"Name"`
3737
PartitionsCount int `json:"partitions_count,omitempty" header:"Partitions"`
38+
RetentionTime string `json:"retention.ms,omitempty" header:"Retention time"`
39+
RetentionSize string `json:"retention.bytes,omitempty" header:"Retention size"`
3840
}
3941

4042
// NewListTopicCommand gets a new command for getting kafkas.
@@ -168,9 +170,22 @@ func mapTopicResultsToTableFormat(topics []strimziadminclient.Topic) []topicRow
168170
var rows []topicRow = []topicRow{}
169171

170172
for _, t := range topics {
173+
var RetentionTime, RetentionSize string
174+
175+
for _, config := range t.GetConfig() {
176+
if *config.Key == "retention.ms" {
177+
RetentionTime = *config.Value
178+
}
179+
if *config.Key == "retention.bytes" {
180+
RetentionSize = *config.Value
181+
}
182+
}
183+
171184
row := topicRow{
172185
Name: t.GetName(),
173186
PartitionsCount: len(t.GetPartitions()),
187+
RetentionTime: RetentionTime,
188+
RetentionSize: RetentionSize,
174189
}
175190
rows = append(rows, row)
176191
}

0 commit comments

Comments
 (0)