Disk fill forecasts, skeleton loaders, and a Silence button on alerts

A disk that is on course to be full within 14 days (setting: 0 turns it off) is
flagged on the Alerts page and dashboard, from the server's own history: needs
three days of steady growth, skips erratic disks and ones the ordinary disk
alert covers. Skeleton placeholders replace "Fetching status…" and "Loading…".
Alerts that a maintenance window can silence get a Silence button (1, 4 or 24
hours) that starts one, and the alert list is refreshed at once when a window
starts or ends.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-15 00:12:33 +02:00
1 parent 82974b98d0
commit f7f5e1cd41
24 files changed
+566 -25

No files matched your search

+4 -1
View File
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { api, type IntegrationField, type IntegrationSummary, type IntegrationType } from "../api/client";
import { BlockSkeleton } from "./Skeleton";
const TYPE_LABELS: Record<IntegrationType, string> = {
tailscale: "Tailscale",
@@ -93,7 +94,9 @@ export default function IntegrationEditForm({
if (loading) {
return (
<div className="card mb-3">
<div className="card-body text-secondary">Loading…</div>
<div className="card-body">
<BlockSkeleton lines={4} />
</div>
</div>
);
}
+2 -1
View File
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import { api, type ServerMetricSeries } from "../api/client";
import Sparkline from "./Sparkline";
import { BlockSkeleton } from "./Skeleton";
const RANGES = [
{ days: 1, label: "24 hours" },
@@ -64,7 +65,7 @@ export default function ServerTrends({ serverId }: { serverId: number }) {
{failed ? (
<div className="text-secondary">Couldn't load the history.</div>
) : series === null ? (
<div className="text-secondary">Loading…</div>
<BlockSkeleton lines={4} />
) : series.length === 0 ? (
<div className="text-secondary">
No history yet. A sample is kept about every ten minutes once the agent has reported, so lines appear here after a short while.
+69
View File
@@ -0,0 +1,69 @@
import { useState } from "react";
import { api, type AlertItem } from "../api/client";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
const CHOICES = [
{ minutes: 60, label: "1 h", words: "1 hour" },
{ minutes: 240, label: "4 h", words: "4 hours" },
{ minutes: 1440, label: "24 h", words: "24 hours" },
];
/**
* "Silence" on an alert: pick how long, and a maintenance window goes on whatever the alert is about. That silences everything
* about that server or integration, not just this one alert — which is what a maintenance window is — so it says so, and the
* Maintenance page is where to end it early. The choices open in place, so nothing is clipped by the table around it.
*/
export default function SilenceButton({ alert, onDone }: { alert: AlertItem; onDone: () => void }) {
const [choosing, setChoosing] = useState(false);
const [busy, setBusy] = useState(false);
const target = alert.target;
if (!target || alert.silenced) return null;
async function silence(minutes: number, words: string) {
if (!target) return;
setBusy(true);
try {
await api.maintenance.start({
targetType: target.type,
targetId: target.id,
minutes,
reason: `Silenced from the Alerts page: ${alert.message}`.slice(0, 200),
});
toast.success(`${target.name} is silenced for ${words} — every alert about it. End it early under Maintenance.`);
// The sidebar badge and the maintenance banner listen for this.
window.dispatchEvent(new Event("maintenance-changed"));
setChoosing(false);
onDone();
} catch (err) {
toast.error(readableError(err));
} finally {
setBusy(false);
}
}
if (!choosing) {
return (
<button
type="button"
className="btn btn-sm btn-outline-secondary"
title={`Silence all alerts about ${target.name} for a while`}
onClick={() => setChoosing(true)}
>
Silence
</button>
);
}
return (
<div className="btn-group btn-group-sm" role="group" aria-label={`Silence ${target.name} for`}>
{CHOICES.map((c) => (
<button key={c.minutes} type="button" className="btn" disabled={busy} onClick={() => silence(c.minutes, c.words)} title={`Silence ${target.name} for ${c.words}`}>
{c.label}
</button>
))}
<button type="button" className="btn" disabled={busy} onClick={() => setChoosing(false)} aria-label="Cancel">
✕
</button>
</div>
);
}
+52
View File
@@ -0,0 +1,52 @@
import type { CSSProperties } from "react";
/** A grey bar with a slow shimmer, standing where text or a figure will be, so the page keeps its shape while it loads. */
export function Skeleton({ width = "100%", height = "1rem", className = "", style }: { width?: string | number; height?: string | number; className?: string; style?: CSSProperties }) {
return <span aria-hidden="true" className={`skeleton ${className}`.trim()} style={{ width, height, ...style }} />;
}
/** The inside of a dashboard widget while its figures are on the way: three figures with captions, and the bar beneath. */
export function WidgetSkeleton() {
return (
<div role="status" aria-live="polite">
<div className="row g-2 mb-3">
{[0, 1, 2].map((i) => (
<div className="col-4" key={i}>
<Skeleton width="55%" height="1.5rem" className="d-block mb-1" />
<Skeleton width="80%" height="0.7rem" className="d-block" />
</div>
))}
</div>
<Skeleton height="0.55rem" className="d-block" />
<span className="visually-hidden">Loading…</span>
</div>
);
}
/** A few lines of text-shaped bars, for a card or a settings page that is still loading. */
export function BlockSkeleton({ lines = 3 }: { lines?: number }) {
const widths = ["90%", "75%", "85%", "60%", "80%"];
return (
<div role="status" aria-live="polite">
{Array.from({ length: lines }, (_, i) => (
<Skeleton key={i} width={widths[i % widths.length]} height="0.95rem" className="d-block mb-2" />
))}
<span className="visually-hidden">Loading…</span>
</div>
);
}
/** A whole page's worth, for the full-page "Loading…" states (a title bar, then a card of lines). */
export function PageSkeleton() {
return (
<div role="status" aria-live="polite">
<Skeleton width="14rem" height="1.6rem" className="d-block mb-4" />
<div className="card">
<div className="card-body">
<BlockSkeleton lines={5} />
</div>
</div>
<span className="visually-hidden">Loading…</span>
</div>
);
}