feat(dashboard): add cPanel-style server info bar and bump to v0.4.4
Adds a compact info strip at the top of the NixPanel dashboard showing Username, Hostname, OS, NixPanel Version, Load Averages (live via WebSocket), and Server Monitoring alert count. Alert count is derived from GET /api/nixserver/services — green "All Clear" when all services are running, amber "N Alerts" for any stopped/failed service. Also fixes the version footer error state in Layout.tsx (versionError → "Version unavailable" fallback with retry button) so the spinner no longer hangs indefinitely when the version API is unreachable.
This commit is contained in:
@@ -462,13 +462,17 @@ export default function Layout() {
|
||||
// ── Version / upgrade state ──────────────────────────────────────────────
|
||||
type VersionInfo = { currentVersion: string; latestVersion: string | null; updateAvailable: boolean }
|
||||
const [versionInfo, setVersionInfo] = useState<VersionInfo | null>(null)
|
||||
const [versionError, setVersionError] = useState(false)
|
||||
const [upgradeState, setUpgradeState] = useState<'idle' | 'confirm' | 'running' | 'done' | 'error'>('idle')
|
||||
|
||||
const fetchVersion = useCallback(async () => {
|
||||
setVersionError(false)
|
||||
try {
|
||||
const { data } = await axios.get('/api/nixserver/system/version')
|
||||
const { data } = await axios.get('/api/nixserver/system/version', { timeout: 10_000 })
|
||||
setVersionInfo(data.data)
|
||||
} catch { /* non-fatal */ }
|
||||
} catch {
|
||||
setVersionError(true)
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => { fetchVersion() }, [fetchVersion])
|
||||
@@ -726,6 +730,13 @@ export default function Layout() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : versionError ? (
|
||||
<div className="flex items-center justify-between px-1 py-1">
|
||||
<span className="text-[#4a5568] text-[10px]">Version unavailable</span>
|
||||
<button onClick={fetchVersion} title="Retry" className="text-[#4a5568] hover:text-[#94a3b8] transition-colors">
|
||||
<RefreshCcw size={10} />
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center gap-1.5 px-1 py-1">
|
||||
<Loader2 size={10} className="animate-spin text-[#4a5568]" />
|
||||
|
||||
Reference in New Issue
Block a user