2026-10-23 19:56:38 -07:00
|
|
|
|
'use client';
|
|
|
|
|
|
|
2026-11-17 00:24:33 +06:00
|
|
|
|
import { PageShell } from '@/components/layout/PageShell';
|
2026-10-23 19:56:38 -07:00
|
|
|
|
import { Button } from '@/components/ui/Button';
|
|
|
|
|
|
import { Card } from '@/components/ui/Card';
|
2026-11-18 05:18:55 +06:00
|
|
|
|
import { CodeBlock } from '@/components/ui/CodeBlock';
|
|
|
|
|
|
import { CopyButton } from '@/components/ui/CopyButton';
|
2026-10-23 19:56:38 -07:00
|
|
|
|
import { Input, Select } from '@/components/ui/Input';
|
2026-11-18 05:18:55 +06:00
|
|
|
|
import { Modal } from '@/components/ui/Modal';
|
2026-10-23 19:56:38 -07:00
|
|
|
|
import { Panel } from '@/components/ui/Panel';
|
2026-11-16 21:58:18 +06:00
|
|
|
|
import { Pill } from '@/components/ui/Pill';
|
2026-10-23 19:56:38 -07:00
|
|
|
|
import {
|
2026-11-17 00:24:33 +06:00
|
|
|
|
Table,
|
|
|
|
|
|
TableBody,
|
|
|
|
|
|
TableCell,
|
|
|
|
|
|
TableEmpty,
|
|
|
|
|
|
TableHead,
|
|
|
|
|
|
TableHeader,
|
|
|
|
|
|
TableRow,
|
|
|
|
|
|
TableWrap,
|
2026-10-23 19:56:38 -07:00
|
|
|
|
} from '@/components/ui/Table';
|
2026-11-16 23:10:44 +06:00
|
|
|
|
import { useRouter } from 'next/navigation';
|
2026-10-23 19:56:38 -07:00
|
|
|
|
import { useCallback, useEffect, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
|
|
interface StreamEvent {
|
|
|
|
|
|
clientId: string;
|
|
|
|
|
|
eventId: string;
|
|
|
|
|
|
timestamp: string;
|
|
|
|
|
|
payload: string;
|
|
|
|
|
|
status: 'stored' | 'buffered';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface Client {
|
|
|
|
|
|
clientId: string;
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const PAGE_SIZE = 12;
|
|
|
|
|
|
|
2026-11-18 05:18:55 +06:00
|
|
|
|
function formatEventPayload(raw: string): string {
|
|
|
|
|
|
try {
|
|
|
|
|
|
return JSON.stringify(JSON.parse(raw), null, 2);
|
|
|
|
|
|
} catch {
|
|
|
|
|
|
return raw;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getPayloadBytes(raw: string): number {
|
|
|
|
|
|
return new TextEncoder().encode(raw).length;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-23 19:56:38 -07:00
|
|
|
|
export function DataBrowser() {
|
2026-11-16 23:10:44 +06:00
|
|
|
|
const router = useRouter();
|
2026-10-23 19:56:38 -07:00
|
|
|
|
const [events, setEvents] = useState<StreamEvent[]>([]);
|
|
|
|
|
|
const [clients, setClients] = useState<Client[]>([]);
|
|
|
|
|
|
const [total, setTotal] = useState(0);
|
|
|
|
|
|
const [pageCount, setPageCount] = useState(1);
|
|
|
|
|
|
const [clientFilter, setClientFilter] = useState('all');
|
|
|
|
|
|
const [fromFilter, setFromFilter] = useState('');
|
|
|
|
|
|
const [toFilter, setToFilter] = useState('');
|
|
|
|
|
|
const [searchFilter, setSearchFilter] = useState('');
|
|
|
|
|
|
const [appliedFilters, setAppliedFilters] = useState({
|
|
|
|
|
|
clientId: 'all',
|
|
|
|
|
|
from: '',
|
|
|
|
|
|
to: '',
|
|
|
|
|
|
search: '',
|
|
|
|
|
|
});
|
|
|
|
|
|
const [page, setPage] = useState(1);
|
|
|
|
|
|
const [filtersReady, setFiltersReady] = useState(false);
|
|
|
|
|
|
const [refreshing, setRefreshing] = useState(false);
|
|
|
|
|
|
const [errorMessage, setErrorMessage] = useState('');
|
2026-11-18 05:18:55 +06:00
|
|
|
|
const [selectedEvent, setSelectedEvent] = useState<StreamEvent | null>(null);
|
2026-10-23 19:56:38 -07:00
|
|
|
|
|
|
|
|
|
|
const fetchEvents = useCallback(async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const params = new URLSearchParams({
|
|
|
|
|
|
clientId: appliedFilters.clientId,
|
|
|
|
|
|
from: appliedFilters.from,
|
|
|
|
|
|
to: appliedFilters.to,
|
|
|
|
|
|
search: appliedFilters.search,
|
|
|
|
|
|
page: String(page),
|
|
|
|
|
|
pageSize: String(PAGE_SIZE),
|
|
|
|
|
|
});
|
2026-11-18 05:18:55 +06:00
|
|
|
|
const response = await fetch(`/api/data?${params}`, { cache: 'no-store' });
|
|
|
|
|
|
if (response.status === 401) {
|
|
|
|
|
|
window.location.assign('/vcon/login');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-10-23 19:56:38 -07:00
|
|
|
|
if (!response.ok) throw new Error('Unable to load events');
|
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
|
setEvents(data.events || []);
|
|
|
|
|
|
setTotal(data.total || 0);
|
|
|
|
|
|
setPageCount(data.pageCount || 1);
|
|
|
|
|
|
setErrorMessage('');
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
setErrorMessage(error instanceof Error ? error.message : 'Unable to load events');
|
|
|
|
|
|
}
|
|
|
|
|
|
}, [appliedFilters, page]);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2026-11-18 05:18:55 +06:00
|
|
|
|
fetch('/api/clients', { cache: 'no-store' })
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (response.status === 401) {
|
|
|
|
|
|
window.location.assign('/vcon/login');
|
|
|
|
|
|
return { clients: [] };
|
|
|
|
|
|
}
|
|
|
|
|
|
return response.ok ? response.json() : { clients: [] };
|
|
|
|
|
|
})
|
2026-10-23 19:56:38 -07:00
|
|
|
|
.then((data) => setClients(data.clients || []))
|
|
|
|
|
|
.catch(() => setClients([]));
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
const clientId = new URLSearchParams(window.location.search).get('clientId');
|
|
|
|
|
|
if (clientId) {
|
|
|
|
|
|
setClientFilter(clientId);
|
|
|
|
|
|
setAppliedFilters((current) => ({ ...current, clientId }));
|
|
|
|
|
|
}
|
|
|
|
|
|
setFiltersReady(true);
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (!filtersReady) return;
|
|
|
|
|
|
fetchEvents();
|
|
|
|
|
|
}, [fetchEvents, filtersReady]);
|
|
|
|
|
|
|
|
|
|
|
|
const firstVisible = total === 0 ? 0 : (page - 1) * PAGE_SIZE + 1;
|
|
|
|
|
|
const lastVisible = Math.min(page * PAGE_SIZE, total);
|
|
|
|
|
|
const firstPage = Math.max(1, Math.min(page - 1, pageCount - 2));
|
|
|
|
|
|
const visiblePages = Array.from(
|
|
|
|
|
|
{ length: Math.min(3, pageCount) },
|
|
|
|
|
|
(_, index) => firstPage + index
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const applyFilters = () => {
|
|
|
|
|
|
setAppliedFilters({
|
|
|
|
|
|
clientId: clientFilter,
|
|
|
|
|
|
from: fromFilter,
|
|
|
|
|
|
to: toFilter,
|
|
|
|
|
|
search: searchFilter,
|
|
|
|
|
|
});
|
|
|
|
|
|
setPage(1);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const resetFilters = () => {
|
|
|
|
|
|
setClientFilter('all');
|
|
|
|
|
|
setFromFilter('');
|
|
|
|
|
|
setToFilter('');
|
|
|
|
|
|
setSearchFilter('');
|
|
|
|
|
|
setAppliedFilters({ clientId: 'all', from: '', to: '', search: '' });
|
|
|
|
|
|
setPage(1);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const refresh = async () => {
|
|
|
|
|
|
setRefreshing(true);
|
|
|
|
|
|
await fetchEvents();
|
|
|
|
|
|
setRefreshing(false);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-11-18 05:18:55 +06:00
|
|
|
|
const formattedSelectedPayload = selectedEvent
|
|
|
|
|
|
? formatEventPayload(selectedEvent.payload)
|
|
|
|
|
|
: '';
|
|
|
|
|
|
|
2026-10-23 19:56:38 -07:00
|
|
|
|
return (
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<PageShell
|
|
|
|
|
|
title="Events"
|
|
|
|
|
|
actions={
|
|
|
|
|
|
<>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
variant="secondary"
|
|
|
|
|
|
size="icon"
|
|
|
|
|
|
icon="RefreshCw"
|
|
|
|
|
|
title="Refresh events"
|
|
|
|
|
|
aria-label="Refresh events"
|
|
|
|
|
|
loading={refreshing}
|
|
|
|
|
|
onClick={refresh}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
variant="primary"
|
|
|
|
|
|
size="xs"
|
|
|
|
|
|
icon="Download"
|
|
|
|
|
|
onClick={() => router.push('/vcon/export')}
|
|
|
|
|
|
>
|
|
|
|
|
|
Export CSV
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Card compact className="p-0">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<div className="grid grid-cols-1 gap-px bg-[var(--border)] sm:grid-cols-2 lg:grid-cols-5">
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<div className="bg-[var(--surface)] p-2.5">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<Select
|
|
|
|
|
|
label="Client"
|
|
|
|
|
|
compact
|
|
|
|
|
|
value={clientFilter}
|
|
|
|
|
|
onChange={(event) => setClientFilter(event.target.value)}
|
|
|
|
|
|
>
|
|
|
|
|
|
<option value="all">All clients</option>
|
|
|
|
|
|
{clients.map((client) => (
|
|
|
|
|
|
<option key={client.clientId} value={client.clientId}>
|
|
|
|
|
|
{client.name || client.clientId}
|
|
|
|
|
|
</option>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</Select>
|
|
|
|
|
|
</div>
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<div className="bg-[var(--surface)] p-2.5">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<Input
|
|
|
|
|
|
label="From"
|
|
|
|
|
|
compact
|
|
|
|
|
|
type="date"
|
|
|
|
|
|
value={fromFilter}
|
|
|
|
|
|
onChange={(event) => setFromFilter(event.target.value)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<div className="bg-[var(--surface)] p-2.5">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<Input
|
|
|
|
|
|
label="To"
|
|
|
|
|
|
compact
|
|
|
|
|
|
type="date"
|
|
|
|
|
|
value={toFilter}
|
|
|
|
|
|
onChange={(event) => setToFilter(event.target.value)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<div className="bg-[var(--surface)] p-2.5">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<Input
|
2026-11-16 21:58:18 +06:00
|
|
|
|
label="Search"
|
2026-10-23 19:56:38 -07:00
|
|
|
|
compact
|
2026-11-16 21:58:18 +06:00
|
|
|
|
placeholder="Keyword..."
|
2026-10-23 19:56:38 -07:00
|
|
|
|
icon="Search"
|
|
|
|
|
|
value={searchFilter}
|
|
|
|
|
|
onChange={(event) => setSearchFilter(event.target.value)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<div className="flex items-end justify-end gap-1.5 bg-[var(--surface)] p-2.5">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<Button type="button" size="xs" icon="X" onClick={resetFilters}>
|
|
|
|
|
|
Reset
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button type="button" size="xs" variant="primary" onClick={applyFilters}>
|
|
|
|
|
|
Apply
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
|
|
<Panel
|
|
|
|
|
|
title="Events"
|
2026-11-16 21:58:18 +06:00
|
|
|
|
meta={`${total.toLocaleString()} · ${page}/${pageCount}`}
|
2026-10-23 19:56:38 -07:00
|
|
|
|
bodyClassName="overflow-hidden"
|
|
|
|
|
|
>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<TableWrap className="border-0 bg-transparent">
|
|
|
|
|
|
<Table>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
<TableHeader>
|
|
|
|
|
|
<TableRow>
|
|
|
|
|
|
<TableHead>Time</TableHead>
|
|
|
|
|
|
<TableHead>Client</TableHead>
|
|
|
|
|
|
<TableHead className="hidden sm:table-cell">Event ID</TableHead>
|
|
|
|
|
|
<TableHead>Payload</TableHead>
|
|
|
|
|
|
<TableHead className="hidden md:table-cell">Size</TableHead>
|
|
|
|
|
|
<TableHead className="text-right">Status</TableHead>
|
|
|
|
|
|
</TableRow>
|
|
|
|
|
|
</TableHeader>
|
|
|
|
|
|
<TableBody>
|
|
|
|
|
|
{errorMessage ? (
|
|
|
|
|
|
<TableEmpty colSpan={6} message={errorMessage} />
|
|
|
|
|
|
) : events.length === 0 ? (
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<TableEmpty colSpan={6} message="No matching events" />
|
2026-10-23 19:56:38 -07:00
|
|
|
|
) : (
|
|
|
|
|
|
events.map((event) => (
|
2026-11-18 05:18:55 +06:00
|
|
|
|
<TableRow
|
|
|
|
|
|
key={`${event.clientId}:${event.eventId}`}
|
|
|
|
|
|
className="cursor-pointer"
|
|
|
|
|
|
onClick={() => setSelectedEvent(event)}
|
|
|
|
|
|
>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<TableCell className="font-mono tabular-nums text-[var(--text)]">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
{new Date(event.timestamp).toLocaleTimeString([], {
|
|
|
|
|
|
hour: '2-digit',
|
|
|
|
|
|
minute: '2-digit',
|
|
|
|
|
|
second: '2-digit',
|
|
|
|
|
|
hour12: false,
|
|
|
|
|
|
})}
|
|
|
|
|
|
</TableCell>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<TableCell className="font-mono text-[var(--accent)]">
|
|
|
|
|
|
{event.clientId}
|
|
|
|
|
|
</TableCell>
|
|
|
|
|
|
<TableCell className="hidden font-mono text-[var(--text-faint)] sm:table-cell">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
{event.eventId}
|
|
|
|
|
|
</TableCell>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<TableCell className="max-w-0 truncate font-mono text-[var(--text)]">
|
2026-10-23 19:56:38 -07:00
|
|
|
|
{event.payload}
|
|
|
|
|
|
</TableCell>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<TableCell className="hidden font-mono tabular-nums md:table-cell">
|
2026-11-18 05:18:55 +06:00
|
|
|
|
{getPayloadBytes(event.payload)} B
|
2026-10-23 19:56:38 -07:00
|
|
|
|
</TableCell>
|
|
|
|
|
|
<TableCell className="text-right">
|
2026-11-18 05:18:55 +06:00
|
|
|
|
<div className="inline-flex items-center gap-2">
|
|
|
|
|
|
<span className="inline-flex items-center gap-1.5 text-[var(--text-muted)]">
|
|
|
|
|
|
<span
|
|
|
|
|
|
className={`h-1.5 w-1.5 ${
|
|
|
|
|
|
event.status === 'buffered'
|
|
|
|
|
|
? 'bg-[var(--warning)]'
|
|
|
|
|
|
: 'bg-[var(--accent)]'
|
|
|
|
|
|
}`}
|
|
|
|
|
|
/>
|
|
|
|
|
|
{event.status}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
variant="icon"
|
|
|
|
|
|
size="icon"
|
|
|
|
|
|
icon="Eye"
|
|
|
|
|
|
className="h-5 w-5 border border-transparent hover:border-[var(--border)] hover:bg-[var(--surface-2)]"
|
|
|
|
|
|
title={`Inspect event ${event.eventId}`}
|
|
|
|
|
|
aria-label={`Inspect event ${event.eventId}`}
|
|
|
|
|
|
onClick={(e) => {
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
setSelectedEvent(event);
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
</TableCell>
|
|
|
|
|
|
</TableRow>
|
|
|
|
|
|
))
|
|
|
|
|
|
)}
|
|
|
|
|
|
</TableBody>
|
|
|
|
|
|
</Table>
|
|
|
|
|
|
</TableWrap>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
<footer className="flex flex-wrap items-center justify-between gap-2 border-t border-[var(--border)] bg-[var(--surface-2)] px-3 py-2">
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<p className="font-mono text-[11px] tabular-nums text-[var(--text-muted)]">
|
|
|
|
|
|
{firstVisible}–{lastVisible} of {total.toLocaleString()}
|
2026-10-23 19:56:38 -07:00
|
|
|
|
</p>
|
|
|
|
|
|
<nav className="flex items-center gap-1" aria-label="Event pages">
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
variant="icon"
|
|
|
|
|
|
size="icon"
|
|
|
|
|
|
icon="ChevronLeft"
|
2026-11-16 21:58:18 +06:00
|
|
|
|
className="h-6 w-6 border border-[var(--border)]"
|
2026-10-23 19:56:38 -07:00
|
|
|
|
aria-label="Previous page"
|
|
|
|
|
|
disabled={page <= 1}
|
|
|
|
|
|
onClick={() => setPage((current) => Math.max(1, current - 1))}
|
|
|
|
|
|
/>
|
|
|
|
|
|
{firstPage > 1 && (
|
|
|
|
|
|
<>
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<Pill
|
|
|
|
|
|
active={page === 1}
|
|
|
|
|
|
aria-current={page === 1 ? 'page' : undefined}
|
|
|
|
|
|
className="min-w-6 justify-center px-1.5 font-mono tabular-nums"
|
|
|
|
|
|
onClick={() => setPage(1)}
|
|
|
|
|
|
>
|
|
|
|
|
|
1
|
|
|
|
|
|
</Pill>
|
|
|
|
|
|
{firstPage > 2 && <span className="px-1 text-[11px] text-[var(--text-faint)]">…</span>}
|
2026-10-23 19:56:38 -07:00
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{visiblePages.map((pageNumber) => (
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<Pill
|
2026-10-23 19:56:38 -07:00
|
|
|
|
key={pageNumber}
|
|
|
|
|
|
active={page === pageNumber}
|
2026-11-16 21:58:18 +06:00
|
|
|
|
aria-current={page === pageNumber ? 'page' : undefined}
|
|
|
|
|
|
className="min-w-6 justify-center px-1.5 font-mono tabular-nums"
|
|
|
|
|
|
onClick={() => setPage(pageNumber)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{pageNumber}
|
|
|
|
|
|
</Pill>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
))}
|
|
|
|
|
|
{firstPage + visiblePages.length - 1 < pageCount && (
|
|
|
|
|
|
<>
|
|
|
|
|
|
{firstPage + visiblePages.length < pageCount && (
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<span className="px-1 text-[11px] text-[var(--text-faint)]">…</span>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
)}
|
2026-11-16 21:58:18 +06:00
|
|
|
|
<Pill
|
2026-10-23 19:56:38 -07:00
|
|
|
|
active={page === pageCount}
|
2026-11-16 21:58:18 +06:00
|
|
|
|
aria-current={page === pageCount ? 'page' : undefined}
|
|
|
|
|
|
className="min-w-6 justify-center px-1.5 font-mono tabular-nums"
|
|
|
|
|
|
onClick={() => setPage(pageCount)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{pageCount}
|
|
|
|
|
|
</Pill>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
variant="icon"
|
|
|
|
|
|
size="icon"
|
|
|
|
|
|
icon="ChevronRight"
|
2026-11-16 21:58:18 +06:00
|
|
|
|
className="h-6 w-6 border border-[var(--border)]"
|
2026-10-23 19:56:38 -07:00
|
|
|
|
aria-label="Next page"
|
|
|
|
|
|
disabled={page >= pageCount}
|
|
|
|
|
|
onClick={() => setPage((current) => Math.min(pageCount, current + 1))}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
</Panel>
|
2026-11-18 05:18:55 +06:00
|
|
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
|
|
isOpen={Boolean(selectedEvent)}
|
|
|
|
|
|
onClose={() => setSelectedEvent(null)}
|
|
|
|
|
|
title={`Event payload: ${selectedEvent?.eventId || ''}`}
|
|
|
|
|
|
maxWidth="lg"
|
|
|
|
|
|
footer={
|
|
|
|
|
|
<Button type="button" size="xs" onClick={() => setSelectedEvent(null)}>
|
|
|
|
|
|
Close
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
{selectedEvent && (
|
|
|
|
|
|
<div className="flex flex-col gap-3">
|
|
|
|
|
|
<div className="grid grid-cols-2 gap-px border border-[var(--border)] bg-[var(--border)] sm:grid-cols-4">
|
|
|
|
|
|
<div className="bg-[var(--surface)] p-2">
|
|
|
|
|
|
<div className="text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
|
|
|
|
|
|
Client
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="truncate font-mono text-[11.5px] text-[var(--accent)]">
|
|
|
|
|
|
{selectedEvent.clientId}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="bg-[var(--surface)] p-2">
|
|
|
|
|
|
<div className="text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
|
|
|
|
|
|
Status
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="font-mono text-[11.5px] text-[var(--text)]">
|
|
|
|
|
|
{selectedEvent.status}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="bg-[var(--surface)] p-2">
|
|
|
|
|
|
<div className="text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
|
|
|
|
|
|
Size
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="font-mono text-[11.5px] tabular-nums text-[var(--text)]">
|
|
|
|
|
|
{getPayloadBytes(selectedEvent.payload)} B
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="bg-[var(--surface)] p-2">
|
|
|
|
|
|
<div className="text-[9.5px] uppercase tracking-wider text-[var(--text-faint)]">
|
|
|
|
|
|
Timestamp
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="truncate font-mono text-[11px] tabular-nums text-[var(--text-muted)]">
|
|
|
|
|
|
{selectedEvent.timestamp}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="flex flex-col gap-1">
|
|
|
|
|
|
<div className="flex items-center justify-between gap-2">
|
|
|
|
|
|
<span className="text-[10px] uppercase tracking-wider text-[var(--text-faint)]">
|
|
|
|
|
|
JSON / Raw Payload
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<CopyButton value={formattedSelectedPayload} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<CodeBlock className="max-h-[340px] border border-[var(--border)] text-[11px]">
|
|
|
|
|
|
{formattedSelectedPayload}
|
|
|
|
|
|
</CodeBlock>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</Modal>
|
2026-11-17 00:24:33 +06:00
|
|
|
|
</PageShell>
|
2026-10-23 19:56:38 -07:00
|
|
|
|
);
|
|
|
|
|
|
}
|