Move Notifications back to Settings and link to it from Alert settings
Alert settings keeps Alert rules, Service levels and Alert tickets; administrators get a link to Settings -> Notifications. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4269213275
commit
ccb863e7c3
32 files changed
+152
-150
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 Alert 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 Settings → Notifications apply to them like any other.
|
||||
</div>
|
||||
{tried && (
|
||||
<div className={`alert ${tried.length > 0 ? "alert-warning" : "alert-success"} py-2`}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Navigate, useLocation, useSearchParams } from "react-router-dom";
|
||||
import { Link, Navigate, useLocation, useSearchParams } from "react-router-dom";
|
||||
import type { CurrentUser } from "../api/client";
|
||||
import ViewTabs from "../components/ViewTabs";
|
||||
import AlertRules from "./AlertRules";
|
||||
@@ -6,41 +6,42 @@ import ServiceLevels from "./ServiceLevels";
|
||||
import NotificationSettings from "./settings/NotificationSettings";
|
||||
import AlertTicketSettings from "./settings/AlertTicketSettings";
|
||||
|
||||
type View = "rules" | "levels" | "notifications" | "tickets";
|
||||
type View = "rules" | "levels" | "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=`.
|
||||
* What decides what is an alert, on one page with a tab for each: **Alert rules** (limits of your own), **Service levels** (targets and error budgets) and **Alert tickets**
|
||||
* (osTicket). The first two are for everyone to read; the third is Settings, so only an administrator sees it. The tab is `?view=`. Who hears of an alert — the
|
||||
* channels, what is sent, quiet hours — is not here: it serves more than alerts, so it stays under Settings → Notifications, and an administrator gets a link to it.
|
||||
*/
|
||||
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 view: View = asked === "levels" ? "levels" : isAdmin && asked === "tickets" ? "tickets" : "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" },
|
||||
]
|
||||
: []),
|
||||
...(isAdmin ? [{ to: "/alert-settings?view=tickets", label: "Alert tickets", active: view === "tickets" }] : []),
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<h2 className="page-title mb-3">Alert settings</h2>
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
<h2 className="page-title mb-0">Alert settings</h2>
|
||||
{isAdmin && (
|
||||
<Link to="/settings/notifications" className="ms-auto">
|
||||
Notification settings: channels, what is sent, quiet hours →
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<ViewTabs label="Alert settings" tabs={tabs} />
|
||||
{view === "levels" ? <ServiceLevels user={user} /> : view === "notifications" ? <NotificationSettings /> : view === "tickets" ? <AlertTicketSettings /> : <AlertRules user={user} />}
|
||||
{view === "levels" ? <ServiceLevels user={user} /> : 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() {
|
||||
/** `/settings/notifications?view=tickets` is how Alert tickets was addressed when it was a tab beside Notifications: it is a tab of Alert settings now. Anything else is Notifications itself. */
|
||||
export function NotificationsPage() {
|
||||
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 />;
|
||||
if (new URLSearchParams(search).get("view") === "tickets") return <Navigate to="/alert-settings?view=tickets" replace />;
|
||||
return <NotificationSettings />;
|
||||
}
|
||||
@@ -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 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)` : ""}.
|
||||
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)` : ""}.
|
||||
</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: "/alert-settings?view=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: "/settings/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="/alert-settings?view=notifications">Alert 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="/settings/notifications">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 Alert settings → Notifications).</>
|
||||
<>high, medium and low are only shown here (high ones can be alerted from a number you choose under Settings → Notifications).</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
The alert for critical findings is switched off (<Link to="/alert-settings?view=notifications">Alert settings → Notifications</Link>).
|
||||
The alert for critical findings is switched off (<Link to="/settings/notifications">Settings → Notifications</Link>).
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
|
||||
@@ -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="/alert-settings?view=notifications">Alert 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="/settings/notifications">Settings → Notifications</Link>.
|
||||
</>
|
||||
) : null}
|
||||
</p>
|
||||
|
||||
@@ -3,6 +3,7 @@ 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" },
|
||||
|
||||
Reference in new issue
Block a user