Create src/components/SystemHealth.js
Browse files
src/components/SystemHealth.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState, useEffect } from 'react';
|
| 2 |
+
import { Activity, ShieldCheck, Server } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const SystemHealth = () => {
|
| 5 |
+
const [status, setStatus] = useState({ loading: true, online: false, data: null });
|
| 6 |
+
|
| 7 |
+
useEffect(() => {
|
| 8 |
+
const checkKernel = async () => {
|
| 9 |
+
try {
|
| 10 |
+
const response = await fetch('/api/status');
|
| 11 |
+
const data = await response.json();
|
| 12 |
+
setStatus({ loading: false, online: true, data });
|
| 13 |
+
} catch (error) {
|
| 14 |
+
setStatus({ loading: false, online: false, data: null });
|
| 15 |
+
}
|
| 16 |
+
};
|
| 17 |
+
checkKernel();
|
| 18 |
+
}, []);
|
| 19 |
+
|
| 20 |
+
return (
|
| 21 |
+
<div className="p-4 bg-slate-900/80 border border-slate-800 rounded-xl space-y-3">
|
| 22 |
+
<div className="flex items-center justify-between">
|
| 23 |
+
<span className="text-[10px] font-black uppercase tracking-widest text-slate-500">Kernel Link</span>
|
| 24 |
+
{status.online ? (
|
| 25 |
+
<span className="flex items-center gap-1 text-[9px] font-bold text-emerald-500 uppercase">
|
| 26 |
+
<ShieldCheck className="w-3 h-3" /> Secure
|
| 27 |
+
</span>
|
| 28 |
+
) : (
|
| 29 |
+
<span className="text-[9px] font-bold text-red-500 uppercase">Disconnected</span>
|
| 30 |
+
)}
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<div className="flex items-center gap-4">
|
| 34 |
+
<div className={`p-2 rounded-lg ${status.online ? 'bg-emerald-500/10' : 'bg-slate-800'}`}>
|
| 35 |
+
<Server className={`w-4 h-4 ${status.online ? 'text-emerald-500' : 'text-slate-600'}`} />
|
| 36 |
+
</div>
|
| 37 |
+
<div>
|
| 38 |
+
<p className="text-[11px] font-mono text-slate-300">
|
| 39 |
+
{status.data?.kernel || 'Checking...'}
|
| 40 |
+
</p>
|
| 41 |
+
<p className="text-[9px] text-slate-500 uppercase font-bold">
|
| 42 |
+
{status.data?.vault_encryption || 'Initializing Vault'}
|
| 43 |
+
</p>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
);
|
| 48 |
+
};
|
| 49 |
+
|
| 50 |
+
export default SystemHealth;
|