Scaffold homelab-monitor: Fastify API + React dashboard + CI
Vertical slice for Phase 1 (v1-dashboard milestone): Proxmox collector, SQLite storage, local auth, and a dashboard UI showing host/container status cards. Config-driven collector registry so future data sources (SSH-based hosts, Zabbix, network discovery) plug in without rewiring. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { me } from "./api";
|
||||
import { Login } from "./pages/Login";
|
||||
import { Dashboard } from "./pages/Dashboard";
|
||||
|
||||
export default function App() {
|
||||
const [username, setUsername] = useState<string | null>(null);
|
||||
const [checked, setChecked] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
me()
|
||||
.then((r) => setUsername(r.username))
|
||||
.catch(() => setUsername(null))
|
||||
.finally(() => setChecked(true));
|
||||
}, []);
|
||||
|
||||
if (!checked) return null;
|
||||
|
||||
if (!username) {
|
||||
return <Login onLoggedIn={() => me().then((r) => setUsername(r.username))} />;
|
||||
}
|
||||
|
||||
return <Dashboard username={username} onLoggedOut={() => setUsername(null)} />;
|
||||
}
|
||||
Reference in New Issue
Block a user