Put alert rules, service levels, notifications and alert tickets on one Alert settings page, in four tabs
Old addresses (/alert-rules, /service-levels, /settings/notifications) lead to the right tab. Notifications and Alert tickets stay administrator-only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
07ce2b0305
commit
4269213275
40 files changed
+212
-188
No files matched your search
@@ -221,7 +221,7 @@ function RuleDrawer({ initial, servers, tags, onClose, onSaved }: { initial: Ale
|
||||
</select>
|
||||
)}
|
||||
<div className="text-secondary small mb-3">
|
||||
Severity and kind decide who hears of it: these are <strong>Monitoring</strong> alerts, so the routing rules under Settings → Notifications apply to them like any other.
|
||||
Severity and kind decide who hears of it: these are <strong>Monitoring</strong> alerts, so the routing rules under Alert settings → Notifications apply to them like any other.
|
||||
</div>
|
||||
{tried && (
|
||||
<div className={`alert ${tried.length > 0 ? "alert-warning" : "alert-success"} py-2`}>
|
||||
@@ -298,7 +298,7 @@ export default function AlertRules({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
|
||||
<h2 className="page-title mb-0">Alert rules</h2>
|
||||
<h3 className="mb-0">Alert rules</h3>
|
||||
{canEdit && (
|
||||
<div className="ms-auto">
|
||||
<button className="btn btn-primary" onClick={() => setEditing({ name: "", metric: "cpu", threshold: 90, forMinutes: 15, severity: "warning" })}>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Navigate, useLocation, useSearchParams } from "react-router-dom";
|
||||
import type { CurrentUser } from "../api/client";
|
||||
import ViewTabs from "../components/ViewTabs";
|
||||
import AlertRules from "./AlertRules";
|
||||
import ServiceLevels from "./ServiceLevels";
|
||||
import NotificationSettings from "./settings/NotificationSettings";
|
||||
import AlertTicketSettings from "./settings/AlertTicketSettings";
|
||||
|
||||
type View = "rules" | "levels" | "notifications" | "tickets";
|
||||
|
||||
/**
|
||||
* Everything that decides what is an alert and who hears of it, on one page with a tab for each: **Alert rules** (limits of your own), **Service levels**
|
||||
* (targets and error budgets), **Notifications** (channels, what is sent, who hears what, quiet hours, away mode) and **Alert tickets** (osTicket). The first two
|
||||
* are for everyone to read; the last two are Settings, so only an administrator sees them. The tab is `?view=`; Notifications keeps its own `?tab=` and `?section=`.
|
||||
*/
|
||||
export default function AlertSettings({ user }: { user: CurrentUser }) {
|
||||
const [params] = useSearchParams();
|
||||
const isAdmin = user.role === "admin";
|
||||
const asked = params.get("view");
|
||||
const view: View = asked === "levels" ? "levels" : isAdmin && (asked === "notifications" || asked === "tickets") ? asked : "rules";
|
||||
const tabs = [
|
||||
{ to: "/alert-settings", label: "Alert rules", active: view === "rules" },
|
||||
{ to: "/alert-settings?view=levels", label: "Service levels", active: view === "levels" },
|
||||
...(isAdmin
|
||||
? [
|
||||
{ to: "/alert-settings?view=notifications", label: "Notifications", active: view === "notifications" },
|
||||
{ to: "/alert-settings?view=tickets", label: "Alert tickets", active: view === "tickets" },
|
||||
]
|
||||
: []),
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title mb-3">Alert settings</h2>
|
||||
<ViewTabs label="Alert settings" tabs={tabs} />
|
||||
{view === "levels" ? <ServiceLevels user={user} /> : view === "notifications" ? <NotificationSettings /> : view === "tickets" ? <AlertTicketSettings /> : <AlertRules user={user} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** `/settings/notifications` (and its `?tab=`, `?section=`, `?view=tickets`) as it was before the alert settings were one page: the same place on the new one. */
|
||||
export function NotificationsRedirect() {
|
||||
const { search } = useLocation();
|
||||
const next = new URLSearchParams(search);
|
||||
next.set("view", next.get("view") === "tickets" ? "tickets" : "notifications");
|
||||
return <Navigate to={`/alert-settings?${next.toString()}`} replace />;
|
||||
}
|
||||
@@ -379,7 +379,7 @@ export default function Backups({ user, tabs }: { user?: CurrentUser; /** The ta
|
||||
</div>
|
||||
<div className="card-body text-secondary small pb-0">
|
||||
A backup nobody has restored is a hope, not a backup. Record each time you try one — for a guest above, or for anything else (a share, a database). A failed test is raised on the
|
||||
Alerts page; under Settings → Notifications you can also ask to be reminded when a guest with backups hasn’t had one in a while{report?.restoreTestDays ? ` (now: ${report.restoreTestDays} days)` : ""}.
|
||||
Alerts page; under Alert settings → Notifications you can also ask to be reminded when a guest with backups hasn’t had one in a while{report?.restoreTestDays ? ` (now: ${report.restoreTestDays} days)` : ""}.
|
||||
</div>
|
||||
{custom.length > 0 && (
|
||||
<div className="card-body pb-0">
|
||||
|
||||
@@ -753,7 +753,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
|
||||
{ id: "server", title: "Add a server and install its agent", description: "The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.", to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
|
||||
{ id: "dns", title: "Connect a DNS provider", description: "See your zones and records, and have names matched to servers.", to: "/dns", action: "Connect", done: (dnsStats?.totalProviders ?? 0) > 0 },
|
||||
{ id: "secret", title: "Track something that expires", description: "An API token, a certificate or a password — you're warned before it runs out.", to: "/secrets", action: "Add one", done: (secrets?.length ?? 0) > 0 },
|
||||
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, email, a webhook or push to your phone, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
|
||||
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, email, a webhook or push to your phone, with the checks you want.", to: "/alert-settings?view=notifications", action: "Set up", done: notifyConfigured === true },
|
||||
{ id: "people", title: "Let someone else in (optional)", description: "Others sign in with Authentik and appear under Users; you decide their role.", to: "/users", action: "Open Users", done: (userCount ?? 0) > 1 },
|
||||
];
|
||||
|
||||
|
||||
@@ -121,15 +121,15 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
|
||||
<strong>Critical</strong> findings are an alert — see <Link to="/alerts">Alerts</Link>;{" "}
|
||||
{data.highThreshold > 0 ? (
|
||||
<>
|
||||
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">Settings → Notifications</Link>); medium and low are only shown here.
|
||||
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/alert-settings?view=notifications">Alert settings → Notifications</Link>); medium and low are only shown here.
|
||||
</>
|
||||
) : (
|
||||
<>high, medium and low are only shown here (high ones can be alerted from a number you choose under Settings → Notifications).</>
|
||||
<>high, medium and low are only shown here (high ones can be alerted from a number you choose under Alert settings → Notifications).</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
The alert for critical findings is switched off (<Link to="/settings/notifications">Settings → Notifications</Link>).
|
||||
The alert for critical findings is switched off (<Link to="/alert-settings?view=notifications">Alert settings → Notifications</Link>).
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
|
||||
@@ -45,7 +45,7 @@ function ServiceLevelsSection({ rows, partial }: { rows: ServiceLevelResult[]; p
|
||||
<div className="card-body">
|
||||
<p>
|
||||
<strong>{metCount}</strong> of {rows.length} {rows.length === 1 ? "target was" : "targets were"} met{partial ? " so far" : ""}. Each is judged on the downtime it allowed over the whole stretch (the error budget).{" "}
|
||||
<Link to="/service-levels">Set targets</Link>
|
||||
<Link to="/alert-settings?view=levels">Set targets</Link>
|
||||
</p>
|
||||
<div className="table-responsive">
|
||||
<table className="table table-vcenter table-sm">
|
||||
@@ -201,7 +201,7 @@ export default function MonthlyReport({ user }: { user: CurrentUser }) {
|
||||
{user.role === "admin" ? (
|
||||
<>
|
||||
{" "}
|
||||
It can be sent on a day of the month, and a quarter's and year's report after the month that ends it: <Link to="/settings/notifications">Settings → Notifications</Link>.
|
||||
It can be sent on a day of the month, and a quarter's and year's report after the month that ends it: <Link to="/alert-settings?view=notifications">Alert settings → Notifications</Link>.
|
||||
</>
|
||||
) : null}
|
||||
</p>
|
||||
|
||||
@@ -229,7 +229,7 @@ export default function Privacy() {
|
||||
you configured, to read status and, when someone with permission asks, to act (start a VM, run a template…).
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
<strong>osTicket tickets</strong> — only if an admin has switched on Settings → Notifications → Alert tickets: for a problem that has lasted, the text of the alert
|
||||
<strong>osTicket tickets</strong> — only if an admin has switched on Alert settings → Alert tickets: for a problem that has lasted, the text of the alert
|
||||
(which server or integration, what is wrong), a link back to this app, and the requester name and email set there go to your osTicket's API.
|
||||
</li>
|
||||
<li className="mb-2">
|
||||
|
||||
@@ -185,7 +185,7 @@ export default function ServiceLevels({ user }: { user: CurrentUser }) {
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex align-items-center mb-1">
|
||||
<h2 className="page-title mb-0">Service levels</h2>
|
||||
<h3 className="mb-0">Service levels</h3>
|
||||
{isAdmin && !draft && (
|
||||
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
|
||||
Set a target
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Link, NavLink, Outlet } from "react-router-dom";
|
||||
import { searchSettings } from "../utils/settingsIndex";
|
||||
|
||||
const SUB_NAV = [
|
||||
{ to: "/settings/notifications", label: "Notifications" },
|
||||
{ to: "/settings/sign-in", label: "Sign-in" },
|
||||
{ to: "/settings/display", label: "Display" },
|
||||
{ to: "/settings/names", label: "Names" },
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import ViewTabs from "../../components/ViewTabs";
|
||||
import NotificationSettings from "./NotificationSettings";
|
||||
import AlertTicketSettings from "./AlertTicketSettings";
|
||||
import DisplaySettings from "./DisplaySettings";
|
||||
import BadgeSettings from "./BadgeSettings";
|
||||
import BackupSettings from "./BackupSettings";
|
||||
@@ -9,27 +7,9 @@ import LogSettings from "./LogSettings";
|
||||
import CacheSettings from "./CacheSettings";
|
||||
import StorageSettings from "./StorageSettings";
|
||||
|
||||
// Settings used to have twelve tabs of its own. Three of them gather the ones that belong together; each part is the same page it always was,
|
||||
// Settings used to have twelve tabs of its own. Two of them gather the ones that belong together; each part is the same page it always was,
|
||||
// switched by `?view=` (so it can be linked to, and the old addresses redirect here).
|
||||
|
||||
/** Notifications, and — beside it — opening an osTicket ticket for an alert. */
|
||||
export function NotificationsGroup() {
|
||||
const [params] = useSearchParams();
|
||||
const view = params.get("view") === "tickets" ? "tickets" : "notifications";
|
||||
return (
|
||||
<>
|
||||
<ViewTabs
|
||||
label="Notification settings"
|
||||
tabs={[
|
||||
{ to: "/settings/notifications", label: "Notifications", active: view === "notifications" },
|
||||
{ to: "/settings/notifications?view=tickets", label: "Alert tickets", active: view === "tickets" },
|
||||
]}
|
||||
/>
|
||||
{view === "tickets" ? <AlertTicketSettings /> : <NotificationSettings />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** How things look: dates, times and table sizes, and the colours of the badges. */
|
||||
export function DisplayGroup() {
|
||||
const [params] = useSearchParams();
|
||||
|
||||
Reference in new issue
Block a user