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:
1 parent
82974b98d0
commit
f7f5e1cd41
24 files changed
+566
-25
No files matched your search
@@ -17,6 +17,8 @@ let state: State = { report: null, failed: false };
|
||||
const listeners = new Set<() => void>();
|
||||
let timer: ReturnType<typeof setInterval> | null = null;
|
||||
let inFlight = false;
|
||||
/** Someone asked again while a look was under way, so that look may predate what they changed: go again once it is done. */
|
||||
let again = false;
|
||||
|
||||
function set(next: State) {
|
||||
state = next;
|
||||
@@ -24,7 +26,10 @@ function set(next: State) {
|
||||
}
|
||||
|
||||
async function refresh(): Promise<void> {
|
||||
if (inFlight) return;
|
||||
if (inFlight) {
|
||||
again = true;
|
||||
return;
|
||||
}
|
||||
inFlight = true;
|
||||
try {
|
||||
set({ report: await api.alerts.list(), failed: false });
|
||||
@@ -32,9 +37,20 @@ async function refresh(): Promise<void> {
|
||||
set({ report: state.report, failed: true });
|
||||
} finally {
|
||||
inFlight = false;
|
||||
if (again) {
|
||||
again = false;
|
||||
void refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A maintenance window starting or ending changes what is silenced, so look again at once rather than at the next minute.
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("maintenance-changed", () => {
|
||||
if (listeners.size > 0) void refresh();
|
||||
});
|
||||
}
|
||||
|
||||
function subscribe(listener: () => void): () => void {
|
||||
listeners.add(listener);
|
||||
if (listeners.size === 1) {
|
||||
|
||||
Reference in new issue
Block a user