system-status: show storage usage (DB, attachments, backups, disk free) — v0.1.0:63

/api/system/status now returns a best-effort storage block: database file size
(crm.db + WAL + SHM), the email_attachments dir, the backups dir, and disk
total/used/free via shutil.disk_usage(DATA_DIR). System Status renders a Storage
section with human-readable sizes so growth can be watched over time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Keysat
2026-06-06 13:34:18 -05:00
parent ea036f49a6
commit 3893a4fb9f
5 changed files with 87 additions and 4 deletions
+34
View File
@@ -10258,6 +10258,15 @@
if (error) return <div className="toast error" style={{ position: 'static' }}>{error}</div>;
if (!data) return <div className="empty-state">No data</div>;
const fmtBytes = (n) => {
if (n == null) return '—';
if (n < 1024) return n + ' B';
const u = ['KB', 'MB', 'GB', 'TB']; let i = -1; let v = n;
do { v /= 1024; i++; } while (v >= 1024 && i < u.length - 1);
return v.toFixed(v < 10 ? 1 : 0) + ' ' + u[i];
};
const storage = data.storage;
const entities = data.canonical_entities || {};
const sync = data.last_index_sync;
const thesis = data.thesis || {};
@@ -10317,6 +10326,31 @@
)}
</div>
{storage && (
<div className="section">
<div className="section-title">Storage</div>
<div className="kpi-grid" style={{ marginBottom: 0 }}>
<div className="kpi-card">
<div className="kpi-label">Database</div>
<div className="kpi-value" style={{ fontSize: '18px' }}>{fmtBytes(storage.database_bytes)}</div>
</div>
<div className="kpi-card">
<div className="kpi-label">Email attachments</div>
<div className="kpi-value" style={{ fontSize: '18px' }}>{fmtBytes(storage.attachments_bytes)}</div>
</div>
<div className="kpi-card">
<div className="kpi-label">Backups</div>
<div className="kpi-value" style={{ fontSize: '18px' }}>{fmtBytes(storage.backups_bytes)}</div>
</div>
<div className="kpi-card">
<div className="kpi-label">Disk free</div>
<div className="kpi-value" style={{ fontSize: '18px' }}>{fmtBytes(storage.disk_free_bytes)}</div>
<div className="kpi-subtitle">of {fmtBytes(storage.disk_total_bytes)} total</div>
</div>
</div>
</div>
)}
{isAdmin && (
<div className="section">
<div className="section-title">Index Actions</div>