Let each kind of game server alert be switched off

Three tick boxes on the Fragnet integration: do not alert about disk space,
memory or backups. The page still shows the figures (a switched-off bar is blue
and the backups tile says not judged); /metrics is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-08 22:36:54 +01:00
1 parent 4a7b1494c8
commit 1ef686d1ba
8 files changed
+58 -15

No files matched your search

+1 -1
View File
@@ -1533,7 +1533,7 @@ export interface FragnetAccount {
panelUrl: string;
status: { at: string; ok: boolean; error: string | null } | null;
fresh: boolean;
options: { backupDays: number; fullPercent: number; ignoreBackups: string[] };
options: { backupDays: number; fullPercent: number; ignoreBackups: string[]; /** Which kinds of alert are raised (each can be switched off in the integration's settings). */ alerts: { backups: boolean; disk: boolean; memory: boolean } };
state: { servers: FragnetServerInfo[]; updatedAt: string } | null;
problems: { key: string; serverId: string; message: string; severity: "warning" | "critical" }[];
}
+5 -5
View File
@@ -37,14 +37,14 @@ function StateBadge({ s }: { s: Server }) {
}
/** What is used of a limit, as a bar that turns yellow at the integration's limit for "nearly full" and red near the top. A limit of 0 (or none) is no limit: only the use is written. */
function UseBar({ label, used, limitMb, fullPercent }: { label: string; used: number | null; limitMb: number | null; fullPercent: number }) {
function UseBar({ label, used, limitMb, fullPercent, alerting = true }: { label: string; used: number | null; limitMb: number | null; fullPercent: number; /** False when the integration is set not to alert about it: the figure stays, and is not coloured as a warning. */ alerting?: boolean }) {
if (used === null) return <div className="small text-secondary">{label} —</div>;
if (!limitMb || limitMb <= 0) return <div className="small text-secondary">{label} {formatBytes(used)}, no limit</div>;
const share = used / (limitMb * MB);
return (
<div style={{ minWidth: 150 }} className="mb-1">
<div className="progress progress-sm">
<div className={`progress-bar ${share >= 0.98 ? "bg-red" : share * 100 >= fullPercent ? "bg-yellow" : "bg-green"}`} style={{ width: `${Math.min(100, share * 100)}%` }} />
<div className={`progress-bar ${!alerting ? "bg-blue" : share >= 0.98 ? "bg-red" : share * 100 >= fullPercent ? "bg-yellow" : "bg-green"}`} style={{ width: `${Math.min(100, share * 100)}%` }} />
</div>
<div className="small text-secondary">
{label} {formatBytes(used)} of {formatBytes(limitMb * MB)} ({Math.floor(share * 100)}%)
@@ -226,8 +226,8 @@ function ServerRow({ a, s, readAt, canAct, open, onToggle, onSignal, onBackup, b
{s.allocations.length > 1 && <div className="small text-secondary">+{s.allocations.length - 1} more</div>}
</td>
<td>
<UseBar label="Memory" used={s.state === "running" || s.state === "starting" ? (s.usage?.memoryBytes ?? null) : null} limitMb={s.memoryLimitMb} fullPercent={a.options.fullPercent} />
<UseBar label="Disk" used={s.usage?.diskBytes ?? null} limitMb={s.diskLimitMb} fullPercent={a.options.fullPercent} />
<UseBar label="Memory" used={s.state === "running" || s.state === "starting" ? (s.usage?.memoryBytes ?? null) : null} limitMb={s.memoryLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.memory} />
<UseBar label="Disk" used={s.usage?.diskBytes ?? null} limitMb={s.diskLimitMb} fullPercent={a.options.fullPercent} alerting={a.options.alerts.disk} />
</td>
<td className="text-secondary">
{backup === null ? (
@@ -402,7 +402,7 @@ function Card({ a, canAct, reload }: { a: FragnetAccount; canAct: boolean; reloa
<div className="card-body">
<div className="text-secondary small">Backups</div>
<div className="h2 mb-0">{s.servers.reduce((n, x) => n + (x.backups?.filter((b) => b.completedAt !== null && b.successful).length ?? 0), 0)}</div>
<div className="text-secondary small">{a.options.backupDays > 0 ? `one is wanted every ${a.options.backupDays} days` : "not judged"}</div>
<div className="text-secondary small">{a.options.backupDays > 0 && a.options.alerts.backups ? `one is wanted every ${a.options.backupDays} days` : "not judged"}</div>
</div>
</div>
</div>