Phones: a bar under the thumb, and one-tap and swipe acknowledge and snooze

Below tablet width a bottom bar holds Dashboard, Alerts (with its count),
Servers and Menu. On the Alerts page an operator can acknowledge with one tap
or snooze for an hour, or swipe a row right to acknowledge and left to snooze;
each has an Undo, a scroll never triggers a swipe, and every swipe is also a
button.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-13 19:50:51 +01:00
1 parent a69d0a611d
commit 939ebf8d83
8 files changed
+425 -4

No files matched your search

+69 -2
View File
@@ -28,6 +28,7 @@ import IncidentHistory, { incidentPath } from "../components/IncidentHistory";
import ViewTabs from "../components/ViewTabs";
import AlertNoise from "../components/AlertNoise";
import BulkBar from "../components/BulkBar";
import SwipeRow from "../components/SwipeRow";
import { AckBulkDrawer, SilenceBulkDrawer } from "../components/BulkDrawers";
import { doBulk, plural } from "../utils/bulk";
import { t, tn } from "../i18n";
@@ -281,6 +282,54 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
toast.error(readableError(err));
}
}
/** One tap: "I'm on it" — acknowledged until the alert is gone, with no note, and an Undo for a tap that was a slip. */
async function quickAck(a: AlertItem) {
try {
await api.alerts.ack({ alertId: a.id, note: "", assigneeId: null, hours: null });
toast.success(t("Acknowledged."), {
label: t("Undo"),
onClick: async () => {
try {
await api.alerts.unack(a.id);
} catch (err) {
toast.error(readableError(err));
} finally {
await load(true);
reloadBadge();
}
},
});
await load(true);
reloadBadge();
} catch (err) {
toast.error(readableError(err));
}
}
/** One tap: snooze for an hour — hidden for now and announced again then if it is still there — with an Undo. */
async function quickSnooze(a: AlertItem) {
try {
await api.alerts.snooze(a.id, new Date(Date.now() + 3600_000).toISOString());
toast.success(t("Snoozed for an hour."), {
label: t("Undo"),
onClick: async () => {
try {
await api.alerts.unsnooze(a.id);
} catch (err) {
toast.error(readableError(err));
} finally {
await load(true);
reloadBadge();
}
},
});
await load(true);
reloadBadge();
} catch (err) {
toast.error(readableError(err));
}
}
async function wake(a: AlertItem) {
try {
await api.alerts.unsnooze(a.id);
@@ -550,7 +599,15 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
<AlertGroupRow key={a.id} group={a} colSpan={canSilence ? 5 : 4} canPick={canSilence} allPicked={a.pickable.length > 0 && a.pickable.every((id) => picked.has(id))} onToggle={() => toggleGroup(a.id)} onPick={() => pickGroup(a.pickable)} />
) : (
<Fragment key={a.id}>
<tr className={`alert-row alert-row-${a.severity}${a.silenced ? " text-secondary" : ""}`} style={a.silenced ? { opacity: 0.65 } : undefined}>
<SwipeRow
className={`alert-row alert-row-${a.severity}${a.silenced ? " text-secondary" : ""}`}
style={a.silenced ? { opacity: 0.65 } : undefined}
// On a phone: a finger swiped right acknowledges, left snoozes for an hour (both are buttons below as well). Only an alert that is live and not yet taken.
onRight={canSilence && !a.silenced && !a.closed && !a.snoozed && !a.ack?.active ? () => void quickAck(a) : undefined}
onLeft={canSilence && !a.silenced && !a.closed && !a.snoozed ? () => void quickSnooze(a) : undefined}
rightHint={`✓ ${t("I'm on it")}`}
leftHint={`💤 ${t("Snooze 1 h")}`}
>
<td>
{canSilence && (
<input type="checkbox" className="form-check-input me-2 align-middle" aria-label={`Pick: ${a.message}`} checked={picked.has(a.id)} onChange={() => togglePicked(a.id)} />
@@ -647,6 +704,16 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
{canSilence && (
<td className="text-nowrap stack-wide">
<div className="btn-list flex-nowrap">
{!a.silenced && !a.closed && !a.snoozed && !a.ack?.active && (
<button type="button" className="btn btn-sm btn-primary d-md-none" onClick={() => void quickAck(a)}>
✓ {t("I'm on it")}
</button>
)}
{!a.silenced && !a.closed && !a.snoozed && (
<button type="button" className="btn btn-sm btn-outline-secondary d-md-none" onClick={() => void quickSnooze(a)}>
{t("Snooze 1 h")}
</button>
)}
{!a.silenced && (
<button type="button" className={`btn btn-sm ${a.ack?.active ? "btn-outline-primary" : "btn-outline-secondary"}`} onClick={() => setAcking(a)}>
{a.ack?.active ? t("Acknowledged") : t("Acknowledge…")}
@@ -677,7 +744,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
</div>
</td>
)}
</tr>
</SwipeRow>
{open.has(a.id) &&
(childrenOf.get(a.id) ?? []).map((c) => (
<tr key={c.id} className="alert-row alert-row-child text-secondary">