|
@@ -9,51 +9,50 @@ export interface MessagesTableProp {
|
|
onNext(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
onNext(event: React.MouseEvent<HTMLButtonElement>): void;
|
|
}
|
|
}
|
|
|
|
|
|
-const MessagesTable: React.FC<MessagesTableProp> = ({ messages, onNext }) => {
|
|
|
|
- if (!messages.length) {
|
|
|
|
- return <div>No messages at selected topic</div>;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return (
|
|
|
|
- <>
|
|
|
|
- <table className="table is-fullwidth is-narrow">
|
|
|
|
- <thead>
|
|
|
|
|
|
+const MessagesTable: React.FC<MessagesTableProp> = ({ messages, onNext }) => (
|
|
|
|
+ <>
|
|
|
|
+ <table className="table is-fullwidth is-narrow">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr>
|
|
|
|
+ <th>Timestamp</th>
|
|
|
|
+ <th>Key</th>
|
|
|
|
+ <th>Offset</th>
|
|
|
|
+ <th>Partition</th>
|
|
|
|
+ <th>Content</th>
|
|
|
|
+ <th> </th>
|
|
|
|
+ </tr>
|
|
|
|
+ </thead>
|
|
|
|
+ <tbody>
|
|
|
|
+ {messages.map(
|
|
|
|
+ ({ partition, offset, timestamp, content, key }: TopicMessage) => (
|
|
|
|
+ <MessageItem
|
|
|
|
+ key={`message-${timestamp.getTime()}-${offset}`}
|
|
|
|
+ partition={partition}
|
|
|
|
+ offset={offset}
|
|
|
|
+ timestamp={timestamp}
|
|
|
|
+ content={content}
|
|
|
|
+ messageKey={key}
|
|
|
|
+ />
|
|
|
|
+ )
|
|
|
|
+ )}
|
|
|
|
+ {messages.length === 0 && (
|
|
<tr>
|
|
<tr>
|
|
- <th>Timestamp</th>
|
|
|
|
- <th>Key</th>
|
|
|
|
- <th>Offset</th>
|
|
|
|
- <th>Partition</th>
|
|
|
|
- <th>Content</th>
|
|
|
|
- <th> </th>
|
|
|
|
|
|
+ <td colSpan={10}>No messages at selected topic</td>
|
|
</tr>
|
|
</tr>
|
|
- </thead>
|
|
|
|
- <tbody>
|
|
|
|
- {messages.map(
|
|
|
|
- ({ partition, offset, timestamp, content, key }: TopicMessage) => (
|
|
|
|
- <MessageItem
|
|
|
|
- key={`message-${timestamp.getTime()}-${offset}`}
|
|
|
|
- partition={partition}
|
|
|
|
- offset={offset}
|
|
|
|
- timestamp={timestamp}
|
|
|
|
- content={content}
|
|
|
|
- messageKey={key}
|
|
|
|
- />
|
|
|
|
- )
|
|
|
|
- )}
|
|
|
|
- </tbody>
|
|
|
|
- </table>
|
|
|
|
- <div className="columns">
|
|
|
|
- <div className="column is-full">
|
|
|
|
- <CustomParamButton
|
|
|
|
- className="is-link is-pulled-right"
|
|
|
|
- type="fa-chevron-right"
|
|
|
|
- onClick={onNext}
|
|
|
|
- btnText="Next"
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
|
|
+ )}
|
|
|
|
+ </tbody>
|
|
|
|
+ </table>
|
|
|
|
+ <div className="columns">
|
|
|
|
+ <div className="column is-full">
|
|
|
|
+ <CustomParamButton
|
|
|
|
+ className="is-link is-pulled-right"
|
|
|
|
+ type="fa-chevron-right"
|
|
|
|
+ onClick={onNext}
|
|
|
|
+ btnText="Next"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
- </>
|
|
|
|
- );
|
|
|
|
-};
|
|
|
|
|
|
+ </div>
|
|
|
|
+ </>
|
|
|
|
+);
|
|
|
|
|
|
export default MessagesTable;
|
|
export default MessagesTable;
|