aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/routes/+page.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/routes/+page.svelte')
-rw-r--r--frontend/src/routes/+page.svelte10
1 files changed, 9 insertions, 1 deletions
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index 511460a..172e6b8 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -7,8 +7,10 @@
import { subscribeHeartbeats } from '$lib/realtime';
import type { Service, Heartbeat } from '$lib/types';
+ import type { InitialLogEntry } from './+page.ts';
+
let { data } = $props<{
- data: { services: (Service & { heartbeats: Heartbeat[] })[]; error: string };
+ data: { services: (Service & { heartbeats: Heartbeat[] })[]; error: string; initialLog: InitialLogEntry[] };
}>();
let initialized = $state(false);
@@ -35,6 +37,12 @@
let logEntries = $state<LogEntry[]>([]);
+ $effect(() => {
+ if (data?.initialLog && logEntries.length === 0) {
+ logEntries = data.initialLog.map((e) => ({ ...e, timestamp: new Date(e.timestamp) }));
+ }
+ });
+
function pushEntry(entry: LogEntry) {
logEntries = [...logEntries, entry];
if (logEntries.length > 200) {