feat(ui): implement modern NaxOS Web Dashboard with Perses analytics and ZFS migration wizard
CI & Build NaxOS Web Dashboard / build (push) Failing after 1m29s

This commit is contained in:
Lukas Holzner
2026-09-03 23:59:06 +02:00
parent 155beec162
commit eaad4719eb
27 changed files with 5580 additions and 2 deletions
+209
View File
@@ -0,0 +1,209 @@
import React from 'react';
import {
HardDrive,
Cpu,
Layers,
FolderSync,
ShieldCheck,
Activity,
ArrowUpRight,
TrendingUp,
} from 'lucide-react';
import type { SystemStatus, ZfsPool, InstalledApp } from '../types/index.js';
interface OverviewViewProps {
status: SystemStatus | null;
pools: ZfsPool[];
apps: InstalledApp[];
onNavigate: (tab: string) => void;
}
export const OverviewView: React.FC<OverviewViewProps> = ({
status,
pools,
apps,
onNavigate,
}) => {
const primaryPool = pools[0];
return (
<div className="space-y-6">
{/* Top Banner / Welcome */}
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4 p-6 rounded-2xl bg-gradient-to-r from-slate-900 via-slate-900/80 to-emerald-950/30 border border-slate-800">
<div>
<h2 className="text-xl font-bold text-white tracking-tight">Appliance Overview</h2>
<p className="text-xs text-slate-400 mt-1">
Running {status?.osVersion || 'NaxOS 24.11'} on OpenZFS storage engine
</p>
</div>
<div className="flex items-center gap-3">
<button
onClick={() => onNavigate('storage')}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-xs font-medium text-slate-200 transition border border-slate-700"
>
<span>Manage Pools</span>
<ArrowUpRight className="h-3.5 w-3.5 text-slate-400" />
</button>
<button
onClick={() => onNavigate('apps')}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-xs font-medium text-white transition shadow-sm shadow-emerald-600/30"
>
<span>App Store</span>
<ArrowUpRight className="h-3.5 w-3.5" />
</button>
</div>
</div>
{/* KPI Cards Grid */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
{/* Storage Pool Card */}
<div className="p-5 rounded-2xl bg-slate-900/70 border border-slate-800/80 flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-xs text-slate-400 font-medium">Pool: {primaryPool?.name || 'tank'}</span>
<span className="px-2 py-0.5 rounded-full text-[10px] font-semibold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20">
{primaryPool?.health || 'ONLINE'}
</span>
</div>
<div className="mt-4">
<div className="text-2xl font-bold text-white tracking-tight">
{primaryPool?.allocated || '8.2T'} <span className="text-xs text-slate-400 font-normal">/ {primaryPool?.size || '14.5T'}</span>
</div>
{/* Progress Bar */}
<div className="w-full bg-slate-800 h-2 rounded-full mt-2 overflow-hidden">
<div
className="bg-gradient-to-r from-emerald-500 to-teal-400 h-full rounded-full transition-all duration-500"
style={{ width: `${primaryPool?.capacityPercent || 56}%` }}
/>
</div>
</div>
<div className="mt-3 flex items-center justify-between text-[11px] text-slate-400">
<span>Free: {primaryPool?.free || '6.3T'}</span>
<span>Frag: {primaryPool?.fragmentation || '14%'}</span>
</div>
</div>
{/* ZFS ARC Hit Ratio */}
<div className="p-5 rounded-2xl bg-slate-900/70 border border-slate-800/80 flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-xs text-slate-400 font-medium">ZFS ARC Cache</span>
<ShieldCheck className="h-4 w-4 text-emerald-400" />
</div>
<div className="mt-4">
<div className="text-2xl font-bold text-white tracking-tight">
{status?.arcHitRatioPercent || 98.6}%
</div>
<p className="text-xs text-slate-400 mt-1">
ARC Size: <strong>4.0 GB</strong> (Max: 4.0 GB)
</p>
</div>
<div className="mt-3 text-[11px] text-emerald-400 flex items-center gap-1">
<TrendingUp className="h-3 w-3" />
<span>Optimal cache hit performance</span>
</div>
</div>
{/* Workloads Card */}
<div className="p-5 rounded-2xl bg-slate-900/70 border border-slate-800/80 flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-xs text-slate-400 font-medium">Running Workloads</span>
<Layers className="h-4 w-4 text-sky-400" />
</div>
<div className="mt-4">
<div className="text-2xl font-bold text-white tracking-tight">
{apps.length || 2} <span className="text-xs text-slate-400 font-normal">Active Services</span>
</div>
<p className="text-xs text-slate-400 mt-1">
Immich (Systemd), Jellyfin (Docker)
</p>
</div>
<div className="mt-3 text-[11px] text-slate-400">
Runtime Engine: <span className="text-slate-200">Docker + Systemd</span>
</div>
</div>
{/* Network Shares */}
<div className="p-5 rounded-2xl bg-slate-900/70 border border-slate-800/80 flex flex-col justify-between">
<div className="flex items-center justify-between">
<span className="text-xs text-slate-400 font-medium">Active File Shares</span>
<FolderSync className="h-4 w-4 text-indigo-400" />
</div>
<div className="mt-4">
<div className="text-2xl font-bold text-white tracking-tight">
{status?.activeSharesCount || 3}
</div>
<p className="text-xs text-slate-400 mt-1">
SMB (Time Machine) + NFS v4
</p>
</div>
<div className="mt-3 text-[11px] text-slate-400">
Bonjour / mDNS discovery enabled
</div>
</div>
</div>
{/* Embedded Native Perses Analytics Panel */}
<div className="p-6 rounded-2xl bg-slate-900/70 border border-slate-800">
<div className="flex items-center justify-between mb-4">
<div className="flex items-center gap-2">
<Activity className="h-4 w-4 text-emerald-400" />
<h3 className="text-sm font-semibold text-white">Native Perses Telemetry</h3>
</div>
<button
onClick={() => onNavigate('analytics')}
className="text-xs text-emerald-400 hover:text-emerald-300 font-medium flex items-center gap-1"
>
<span>View Full Dashboards</span>
<ArrowUpRight className="h-3.5 w-3.5" />
</button>
</div>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
{/* Simulated Perses Panel 1: Throughput */}
<div className="p-4 rounded-xl bg-slate-950/60 border border-slate-800/80">
<div className="text-xs font-medium text-slate-300 mb-2">Pool Read/Write Throughput</div>
<div className="h-32 flex items-end gap-1 px-2 pt-4">
{[42, 65, 30, 85, 95, 120, 80, 45, 60, 90, 110, 75, 40, 95, 130, 85, 70, 90, 105, 140, 95, 60, 80, 115].map((val, i) => (
<div key={i} className="flex-1 bg-emerald-500/30 hover:bg-emerald-400 transition-colors rounded-t" style={{ height: `${(val / 150) * 100}%` }} title={`${val} MB/s`} />
))}
</div>
<div className="flex justify-between text-[10px] text-slate-500 mt-2 font-mono">
<span>-30m</span>
<span>115 MB/s Peak</span>
<span>Now</span>
</div>
</div>
{/* Simulated Perses Panel 2: Memory & ARC */}
<div className="p-4 rounded-xl bg-slate-950/60 border border-slate-800/80">
<div className="text-xs font-medium text-slate-300 mb-2">System Memory & ZFS ARC Distribution</div>
<div className="h-32 flex items-center justify-center">
<div className="w-full max-w-xs space-y-2">
<div className="flex justify-between text-xs text-slate-300">
<span>ZFS ARC Cache</span>
<span className="font-mono text-emerald-400">4.0 GB</span>
</div>
<div className="w-full bg-slate-800 h-2 rounded-full overflow-hidden">
<div className="bg-emerald-400 h-full rounded-full" style={{ width: '25%' }} />
</div>
<div className="flex justify-between text-xs text-slate-300">
<span>Services & Containers</span>
<span className="font-mono text-sky-400">9.2 GB</span>
</div>
<div className="w-full bg-slate-800 h-2 rounded-full overflow-hidden">
<div className="bg-sky-400 h-full rounded-full" style={{ width: '45%' }} />
</div>
<div className="flex justify-between text-xs text-slate-300">
<span>Free Available</span>
<span className="font-mono text-slate-400">18.8 GB</span>
</div>
<div className="w-full bg-slate-800 h-2 rounded-full overflow-hidden">
<div className="bg-slate-600 h-full rounded-full" style={{ width: '30%' }} />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};