+
{emptyDataMessage}
{/if}
- {#each orderedData as item (item.id)}
+ {#each orderedData as item, index}
{
if (!animationEnabled) return;
e.target.style.backgroundColor = 'rgb(74, 222, 128)';
diff --git a/src/lib/domain/Message.ts b/src/lib/domain/Message.ts
new file mode 100644
index 0000000..666cc77
--- /dev/null
+++ b/src/lib/domain/Message.ts
@@ -0,0 +1,36 @@
+export type Message = {
+ checksum: number;
+ header: Record;
+ id: number;
+ offset: number;
+ payload: string;
+ truncatedPayload: string
+ state: "available";
+ timestamp: number;
+};
+
+export function messageMapper(item: any): Message {
+ let payload = "";
+
+ try {
+ payload = atob(item.payload)
+ } catch {
+ payload = "[NOT DECODABLE]"
+ }
+
+ let truncatedPayload = payload;
+ if (payload.length > 100) {
+ truncatedPayload = `${payload.slice(0, 100)} [...]`
+ }
+
+ return {
+ id: item.id,
+ header: item.header,
+ offset: item.offset,
+ payload,
+ state: item.state,
+ timestamp: item.timestamp,
+ checksum: item.checksum,
+ truncatedPayload,
+ };
+}
diff --git a/src/lib/domain/MessageDetails.ts b/src/lib/domain/MessageDetails.ts
new file mode 100644
index 0000000..9190178
--- /dev/null
+++ b/src/lib/domain/MessageDetails.ts
@@ -0,0 +1,11 @@
+import { Message, messageMapper } from './Message';
+
+type Payload = {
+ partition_id: number,
+ current_offset: number,
+ messages: Array,
+}
+
+export function messageDetailsMapper(payload: Payload): Array {
+ return payload.messages.map(messageMapper);
+}
diff --git a/src/lib/types/appRoutes.ts b/src/lib/types/appRoutes.ts
index 7961ce2..0a00ec0 100644
--- a/src/lib/types/appRoutes.ts
+++ b/src/lib/types/appRoutes.ts
@@ -5,6 +5,7 @@ type DashboardRoutes = `/dashboard/${
| 'streams'
| `streams/${number}`
| `streams/${number}/topics/${number}`
+ | `streams/${number}/topics/${number}/messages`
| 'clients'
| 'logs'
| SettingsSegment}`;
diff --git a/src/routes/dashboard/streams/[streamId=i32]/+page.svelte b/src/routes/dashboard/streams/[streamId=i32]/+page.svelte
index 2966f3e..99bd2e6 100644
--- a/src/routes/dashboard/streams/[streamId=i32]/+page.svelte
+++ b/src/routes/dashboard/streams/[streamId=i32]/+page.svelte
@@ -1,5 +1,4 @@
+
+
+
+
+
Messages for {topic.name}
+
+
+
+ Messages: {topic.messagesCount}
+
+
+
+
+
+ openModal('InspectMessage', { message: data.messages[index] })
+ }
+ colNames={{
+ offset: "Offset",
+ truncatedPayload: "Payload",
+ timestamp: "timestamp",
+ checksum: "Checksum",
+ header: "Headers",
+ }}
+/>