Bulk snooze, alert rules judged on report, photos on notes
Bulk snooze: Snooze... and Wake on the ticked alerts, with undo that puts back each alert's earlier snooze exactly. Alert rules are judged for a server right after its agent reports, instead of at the next 15-minute pass; only that server's rule findings change, and the check is serialized with the pass so neither overwrites the other's state. Photos on server and device notes: up to 12 each, shrunk in the browser, accepted by their own bytes (JPEG/PNG/GIF/WebP, 4 MB), kept in the database and removed with the server or device. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
251a4a9d73
commit
a16996d975
27 files changed
+8442
-54
No files matched your search
@@ -16,7 +16,7 @@ import SilenceButton from "../components/SilenceButton";
|
||||
import RunPlaybookButton from "../components/RunPlaybookButton";
|
||||
import RunbookEntry from "../components/RunbookEntry";
|
||||
import AckDrawer, { ackWords } from "../components/AckDrawer";
|
||||
import SnoozeDrawer, { snoozeWords } from "../components/SnoozeDrawer";
|
||||
import SnoozeDrawer, { SnoozeBulkDrawer, snoozeWords } from "../components/SnoozeDrawer";
|
||||
import { useAlertsReport } from "../hooks/useAlertsReport";
|
||||
import { summariseAlerts } from "../utils/alertSummary";
|
||||
import { EmptyRow } from "../components/EmptyState";
|
||||
@@ -99,7 +99,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
const [snoozing, setSnoozing] = 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" | null>(null);
|
||||
const [bulkForm, setBulkForm] = useState<"ack" | "silence" | "snooze" | null>(null);
|
||||
// Held-back alerts are nested under the one that explains them (on by default; remembered), and each parent opens to show them.
|
||||
const [grouped, setGrouped] = useState(() => {
|
||||
try {
|
||||
@@ -220,6 +220,17 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "unacknowledge", alertIds: pickedIds }, done: (r) => `${plural(r.changed, "acknowledgement")} removed.`, reload: afterBulk });
|
||||
if (ok) setPicked(new Set());
|
||||
}
|
||||
async function bulkSnooze(when: Date) {
|
||||
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "snooze", alertIds: pickedIds, until: when.toISOString() }, done: (r) => `${plural(r.changed, "alert")} snoozed until ${formatDateTime(when)}.`, reload: afterBulk });
|
||||
if (ok) {
|
||||
setBulkForm(null);
|
||||
setPicked(new Set());
|
||||
}
|
||||
}
|
||||
async function bulkWake() {
|
||||
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "unsnooze", alertIds: pickedIds }, done: (r) => `${plural(r.changed, "alert")} woken.`, reload: afterBulk });
|
||||
if (ok) setPicked(new Set());
|
||||
}
|
||||
async function bulkSilence(v: { minutes: number; reason: string }) {
|
||||
const ok = await doBulk({ call: api.bulk.alerts, body: { action: "silence", alertIds: pickedIds, minutes: v.minutes, reason: v.reason }, done: (r) => `${plural(r.changed, "thing")} put under maintenance.`, reload: afterBulk });
|
||||
if (ok) {
|
||||
@@ -586,6 +597,12 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<button type="button" className="btn btn-sm" onClick={() => void bulkUnack()}>
|
||||
Remove acknowledgement
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("snooze")}>
|
||||
Snooze…
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => void bulkWake()}>
|
||||
Wake
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm" onClick={() => setBulkForm("silence")}>
|
||||
Silence…
|
||||
</button>
|
||||
@@ -593,6 +610,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
</>
|
||||
)}
|
||||
{bulkForm === "ack" && <AckBulkDrawer count={pickedIds.length} onSubmit={bulkAck} onClose={() => setBulkForm(null)} />}
|
||||
{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)} />}
|
||||
|
||||
{snoozing && <SnoozeDrawer alert={snoozing} onClose={() => setSnoozing(null)} onSaved={() => { void load(true); reloadBadge(); }} />}
|
||||
|
||||
Reference in new issue
Block a user