Add the Alert tickets settings page, and show each alert's ticket on the Alerts page

Settings -> Alert tickets: switch it on, choose the osTicket integration (only ones with a ticket API
set up can be chosen), who the tickets come from, help topic and priority, which severities and kinds,
how long a problem must last, when many become one summary ticket, how long a return counts as the
same problem, and what to do about problems already there. Buttons to send a test ticket and to check
now, and a line saying what the last check did. Server messages (a missing integration, a refused key)
are shown as they are.

The Alerts page shows "Ticket #123" on an alert that has one, linking to it in osTicket, and a Ticket
column in the CSV export.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-07 23:41:46 +02:00
1 parent 467d1a1a06
commit 96c93ef924
6 files changed
+372 -2

No files matched your search

+45
View File
@@ -409,6 +409,45 @@ export interface AlertItem {
link: string | null;
/** Under a maintenance window: still a real problem, but its notifications are held back. */
silenced: boolean;
/** The osTicket ticket opened for it, if one was. */
ticket?: { number: string | null; url: string | null; grouped: boolean; openedAt: string | null } | null;
}
export type AlertTicketSeverity = "critical" | "warning" | "info";
export interface AlertTicketSettings {
enabled: boolean;
integrationId: number | null;
severities: AlertTicketSeverity[];
categories: string[];
requesterName: string;
requesterEmail: string;
topicId: number | null;
priorityId: number | null;
notifyStaff: boolean;
existingProblems: "ignore" | "ticket";
confirmChecks: number;
summaryAbove: number;
reopenAfterMinutes: number;
}
export interface AlertTicketRunSummary {
at: string;
skipped?: "disabled" | "busy";
error?: string;
ticketsOpened: number;
alertsCovered: number;
baseline: number;
pending: number;
cleared: number;
failed: number;
}
export interface AlertTicketOverview {
settings: AlertTicketSettings;
integrations: { id: number; name: string; enabled: boolean; ticketApiReady: boolean }[];
categories: { value: string; label: string }[];
status: { lastRun: AlertTicketRunSummary | null; open: number; pending: number; baseline: number; baselinePending: boolean };
}
export interface AlertsReport {
@@ -1062,6 +1101,12 @@ export const api = {
alerts: {
list: (refresh = false) => request<AlertsReport>(`/api/alerts${refresh ? "?refresh=1" : ""}`),
},
alertTickets: {
get: () => request<AlertTicketOverview>("/api/alert-tickets"),
update: (patch: Partial<AlertTicketSettings>) => request<AlertTicketOverview>("/api/alert-tickets", { method: "PUT", body: JSON.stringify(patch) }),
test: () => request<{ ok: boolean; ticketNumber: string | null }>("/api/alert-tickets/test", { method: "POST" }),
run: () => request<{ summary: AlertTicketRunSummary; status: AlertTicketOverview["status"] }>("/api/alert-tickets/run", { method: "POST" }),
},
ports: {
agent: () => request<AgentPortsResponse>("/api/ports/agent"),
forwards: {