${opts.display !== undefined ? opts.display : Math.round(value)}${opts.suffix || '%'}
diff --git a/containers/libreportal/frontend/js/components/admin/system-metric-page.js b/containers/libreportal/frontend/js/components/admin/system-metric-page.js
index 33d706b..2b60037 100644
--- a/containers/libreportal/frontend/js/components/admin/system-metric-page.js
+++ b/containers/libreportal/frontend/js/components/admin/system-metric-page.js
@@ -23,6 +23,7 @@ class SystemMetricPage {
this.tier = '1m';
this.hoverIdx = -1;
this._rafHover = null;
+ this._lpPct = null; // disk only: LibrePortal's share of the disk (%)
this._unsubLive = null;
this._onKey = this._onKey.bind(this);
this._onResize = this._onResize.bind(this);
@@ -49,6 +50,29 @@ class SystemMetricPage {
this._bind();
await this._loadRange();
this._attachLive();
+ this._loadLibrePortalShare();
+ }
+
+ // Disk page only: compute LibrePortal's current share of the disk so the
+ // chart can mark it with a reference line beside the disk-usage trend.
+ // It's a "now" value (app_storage + Docker df ÷ disk total) — there's no
+ // historical LP series, so the line is flat across the range.
+ async _loadLibrePortalShare() {
+ if (this.metricKey !== 'disk') return;
+ try {
+ const [app, dock, metrics] = await Promise.all([
+ fetch(`/data/system/app_storage.json?t=${Date.now()}`).then(r => r.ok ? r.json() : null).catch(() => null),
+ fetch('/api/system/storage').then(r => r.ok ? r.json() : null).catch(() => null),
+ fetch(`/data/system/metrics.json?t=${Date.now()}`).then(r => r.ok ? r.json() : null).catch(() => null),
+ ]);
+ const lpBytes = ((app && app.total_local) || 0) + ((dock && dock.total) || 0);
+ const disks = (metrics && Array.isArray(metrics.disks)) ? metrics.disks : [];
+ const root = disks.find(d => d.mount === '/') || disks[0];
+ const diskTotal = root ? Number(root.total) || 0 : 0;
+ this._lpPct = (diskTotal > 0 && lpBytes > 0) ? (lpBytes / diskTotal) * 100 : null;
+ this._lpBytes = lpBytes;
+ this._renderChart();
+ } catch (_) { this._lpPct = null; }
}
dispose() {
@@ -357,6 +381,15 @@ class SystemMetricPage {
? `
` : '';
const nowIdx = n - 1;
const nowDot = `
`;
+ // Disk page: a flat reference line marking LibrePortal's share of the disk.
+ let lpLine = '';
+ if (this.metricKey === 'disk' && Number.isFinite(this._lpPct)) {
+ const ly = yAt(this._lpPct);
+ const label = `LibrePortal ${this._lpPct.toFixed(1)}%${this._lpBytes ? ` · ${window.SystemFmt.bytes(this._lpBytes)}` : ''}`;
+ lpLine = `
+
+
${label}`;
+ }
const crosshair = `
`;
const gradId = 'sys-detail-grad';
@@ -378,6 +411,7 @@ class SystemMetricPage {
+ ${lpLine}
${minDot}
${peakDot}
${nowDot}