From d186a989b6808ff39fcd43a9f0b478aebc4aa346 Mon Sep 17 00:00:00 2001
From: zwlucas <lucas.fariamo08@gmail.com>
Date: Fri, 29 May 2026 17:21:48 -0300
Subject: feat: enhance maintenance management and heartbeat history features

- Updated Store interface to include methods for managing maintenances.
- Modified API functions to support pagination for heartbeat history and added CRUD operations for maintenances.
- Enhanced types to include paginated responses and initial log entries.
- Implemented maintenance management UI in the admin panel with create, edit, and delete functionalities.
- Updated service detail page to display paginated heartbeat history and improved chart rendering.
- Refactored status page to accommodate new data structures and ensure consistent data handling.

Signed-off-by: Lucas Faria Mendes <lucas.fariamo08@gmail.com>
---
 frontend/src/routes/+page.svelte | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'frontend/src/routes/+page.svelte')

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) {
-- 
cgit v1.2.3

