Add a notification history
Every notification is written down with how it went through each channel (or why it was not sent: held for quiet hours, a routing rule said nobody, no channel on). Records -> Notifications lists them with a filter, a search and Send again. Errors are cleaned of every secret in the settings; kept 30 days. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c6ccc0a4b
commit
9126200295
18 files changed
+9886
-34
No files matched your search
@@ -2235,6 +2235,20 @@ export interface Agenda {
|
||||
}
|
||||
|
||||
export type ChangeKind = "servers" | "maintenance" | "alerts" | "settings" | "integrations" | "dependencies" | "inventory" | "backups" | "endpoints" | "other";
|
||||
/** One notification as the history lists it: what it said and how each channel took it. */
|
||||
export interface NotificationEntry {
|
||||
id: number;
|
||||
at: string;
|
||||
title: string;
|
||||
message: string;
|
||||
/** sent, partly, failed, none (no channel to send it to), held (quiet hours or away) or muted (a routing rule says nobody). */
|
||||
status: string;
|
||||
results: { channel: string; ok: boolean; error: string | null }[];
|
||||
/** Why it was held or muted. */
|
||||
note: string | null;
|
||||
resentOf: number | null;
|
||||
}
|
||||
|
||||
export interface ChangeEntry {
|
||||
id: string;
|
||||
at: string;
|
||||
@@ -3824,6 +3838,14 @@ export const api = {
|
||||
return request<{ entries: ChangeEntry[]; more: boolean; kinds: { id: ChangeKind; label: string }[] }>(`/api/changes?${q.toString()}`);
|
||||
},
|
||||
},
|
||||
notificationLog: {
|
||||
list: (params: { status?: string; q?: string; limit?: number }) => {
|
||||
const q = new URLSearchParams();
|
||||
for (const [k, v] of Object.entries(params)) if (v !== undefined && v !== "") q.set(k, String(v));
|
||||
return request<{ entries: NotificationEntry[]; statuses: string[] }>(`/api/notification-log?${q.toString()}`);
|
||||
},
|
||||
resend: (id: number) => request<{ ok: boolean; entry: number | null }>(`/api/notification-log/${id}/resend`, { method: "POST" }),
|
||||
},
|
||||
push: {
|
||||
key: () => request<{ publicKey: string }>("/api/push/key"),
|
||||
mine: () => request<{ enabled: boolean; subscriptions: PushDevice[] }>("/api/push/mine"),
|
||||
|
||||
Reference in new issue
Block a user