a075488f4b
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>
25 lines
690 B
TypeScript
25 lines
690 B
TypeScript
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)} />;
|
|
}
|