Skip to content

Commit

Permalink
Merge pull request #1052 from redpanda-data/fix/exception-when-config…
Browse files Browse the repository at this point in the history
…uring-message-table

Fixes an exception when choosing non-existing column in Table definition
  • Loading branch information
jvorcak authored Jan 31, 2024
2 parents 6630a54 + 993d0e2 commit b716b4f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions frontend/src/components/pages/topics/Tab.Messages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,16 @@ export class TopicMessageView extends Component<TopicMessageViewProps> {
accessorKey: 'value',
cell: ({row: {original}}) => <MessagePreview msg={original} previewFields={() => this.activePreviewTags} isCompactTopic={this.props.topic.cleanupPolicy.includes('compact')}/>
},
keySize: {
header: 'Key Size',
accessorKey: 'key.size',
cell: ({row: {original: {key: {size}}}}) => <span>{prettyBytes(size)}</span>
},
valueSize: {
header: 'Value Size',
accessorKey: 'value.size',
cell: ({row: {original: {value: {size}}}}) => <span>{prettyBytes(size)}</span>
}
}


Expand All @@ -557,7 +567,9 @@ export class TopicMessageView extends Component<TopicMessageViewProps> {
})
}

newColumns[newColumns.length - 1].size = Infinity
if(newColumns.length > 0) {
newColumns[newColumns.length - 1].size = Infinity
}

const columns: ColumnDef<TopicMessage>[] = [...newColumns, {
header: () => <button onClick={() => {
Expand Down Expand Up @@ -1436,7 +1448,8 @@ const ColumnOptions: FC<{ tags: ColumnList[] }> = ({ tags }) => {
{ title: 'Key', dataIndex: 'key' },
// { title: 'Headers', dataIndex: 'headers' },
{ title: 'Value', dataIndex: 'value' },
{ title: 'Size', dataIndex: 'size' }, // size of the whole message is not available (bc it was a bad guess), might be added back later
{ title: 'Key Size', dataIndex: 'keySize' }, // size of the whole message is not available (bc it was a bad guess), might be added back later
{ title: 'Value Size', dataIndex: 'valueSize' }, // size of the whole message is not available (bc it was a bad guess), might be added back later
];

const value = tags.map(column => ({
Expand Down

0 comments on commit b716b4f

Please sign in to comment.