Close an alert: dealt with or accepted, hidden until it gets worse
Close... on the Alerts page hides an alert with no end, with an optional reason that is also written on its incident. It opens again only if it gets more serious than when it was closed (said once) or the problem has been gone for half an hour; Open again brings it back at once. Built on the snooze table (kind, severity and note columns), so everything that holds back snoozed alerts holds back closed ones. Audit log, change log and /api/v1 alerts carry it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ff0b44943
commit
a94899865e
24 files changed
+7982
-24
No files matched your search
@@ -16,6 +16,7 @@ import SilenceButton from "../components/SilenceButton";
|
||||
import RunPlaybookButton from "../components/RunPlaybookButton";
|
||||
import RunbookEntry from "../components/RunbookEntry";
|
||||
import AckDrawer, { ackWords } from "../components/AckDrawer";
|
||||
import CloseDrawer from "../components/CloseDrawer";
|
||||
import SnoozeDrawer, { SnoozeBulkDrawer, snoozeWords } from "../components/SnoozeDrawer";
|
||||
import { useAlertsReport } from "../hooks/useAlertsReport";
|
||||
import { summariseAlerts } from "../utils/alertSummary";
|
||||
@@ -97,6 +98,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
const [attention, setAttention] = useState<"all" | "unacknowledged" | "acknowledged" | "mine">("all");
|
||||
const [acking, setAcking] = useState<AlertItem | null>(null);
|
||||
const [snoozing, setSnoozing] = useState<AlertItem | null>(null);
|
||||
const [closing, setClosing] = useState<AlertItem | null>(null);
|
||||
// Alerts ticked for a bulk action, and which bulk form is open.
|
||||
const [picked, setPicked] = useState<Set<string>>(new Set());
|
||||
const [bulkForm, setBulkForm] = useState<"ack" | "silence" | "snooze" | null>(null);
|
||||
@@ -198,6 +200,16 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
void load(true);
|
||||
reloadBadge();
|
||||
}
|
||||
async function reopen(a: AlertItem) {
|
||||
try {
|
||||
await api.alerts.reopen(a.id);
|
||||
toast.success("Opened again.");
|
||||
await load(true);
|
||||
reloadBadge();
|
||||
} catch (err) {
|
||||
toast.error(readableError(err));
|
||||
}
|
||||
}
|
||||
async function wake(a: AlertItem) {
|
||||
try {
|
||||
await api.alerts.unsnooze(a.id);
|
||||
@@ -466,6 +478,10 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<span className="badge bg-secondary-lt text-secondary ms-2" title={`${a.causedBy.name} is down too, which explains this — notifications for this are held back. If ${a.causedBy.name} comes back and this stays down, it alerts then.`}>
|
||||
caused by {a.causedBy.name}
|
||||
</span>
|
||||
) : a.closed ? (
|
||||
<span className="badge bg-secondary-lt text-secondary ms-2" title={`Closed by ${a.closed.by}${a.closed.note ? `: ${a.closed.note}` : ""} — hidden until it gets worse, or the problem has gone for half an hour and returns`}>
|
||||
closed by {a.closed.by}
|
||||
</span>
|
||||
) : a.snoozed ? (
|
||||
<span className="badge bg-azure-lt text-azure ms-2" title={`Snoozed by ${a.snoozed.by} — hidden until then, and announced again if it is still there`}>
|
||||
{snoozeWords(a.snoozed)}
|
||||
@@ -548,12 +564,22 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
Snooze…
|
||||
</button>
|
||||
)}
|
||||
{!a.silenced && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setClosing(a)} title="Dealt with, or accepted: hide it until it gets worse">
|
||||
Close…
|
||||
</button>
|
||||
)}
|
||||
{a.closed && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void reopen(a)}>
|
||||
Open again
|
||||
</button>
|
||||
)}
|
||||
{a.snoozed && (
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => void wake(a)}>
|
||||
Wake now
|
||||
</button>
|
||||
)}
|
||||
{!a.snoozed && <SilenceButton alert={a} onDone={() => void load(true)} />}
|
||||
{!a.snoozed && !a.closed && <SilenceButton alert={a} onDone={() => void load(true)} />}
|
||||
{a.target?.type === "server" && !a.silenced && <RunPlaybookButton serverName={a.target.name} />}
|
||||
</div>
|
||||
</td>
|
||||
@@ -613,6 +639,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
{bulkForm === "snooze" && <SnoozeBulkDrawer count={pickedIds.length} onSubmit={bulkSnooze} onClose={() => setBulkForm(null)} />}
|
||||
{bulkForm === "silence" && <SilenceBulkDrawer noun={pickedIds.length === 1 ? "alert" : "alerts"} count={pickedIds.length} canSilenceDependents={false} onSubmit={bulkSilence} onClose={() => setBulkForm(null)} />}
|
||||
|
||||
{closing && <CloseDrawer alert={closing} onClose={() => setClosing(null)} onSaved={() => { void load(true); reloadBadge(); }} />}
|
||||
{snoozing && <SnoozeDrawer alert={snoozing} onClose={() => setSnoozing(null)} onSaved={() => { void load(true); reloadBadge(); }} />}
|
||||
{acking && <AckDrawer alert={acking} me={user} onClose={() => setAcking(null)} onSaved={() => {
|
||||
void load(true);
|
||||
|
||||
Reference in new issue
Block a user