Kaynağa Gözat

feat(alerts): give every row read, snooze and details actions (#2185)

Closes #2185
Nacho 1 hafta önce
ebeveyn
işleme
4f20502a88

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ y este proyecto se adhiere a [Versionado Semántico](https://semver.org/lang/es/
 
 ### Added
 
+- Every alert row now has three explicit actions: mark as read, snooze and view more (#2185). Snoozing pauses notifications and escalation for 1 hour, 2 hours, 8 hours, until tomorrow at 9:00 or 7 days without hiding the alert: the row stays in the log with a "snoozed until" marker, monitoring continues and the resolution is still detected. Clearing a single alert moved into the expanded details.
 - The client detail and API expose the source of the selected name: DHCP, mDNS, reverse DNS, reservation, known-MAC alias, GL.iNet or manual. The attribution persists through retention and server restarts without changing name selection (#2163).
 - Remote AdGuard Home connections can use HTTPS, with an explicit opt-in for a private instance's self-signed certificate. Existing configurations keep HTTP and strict certificate verification by default, and `ADGUARD_INSECURE_SKIP_VERIFY=1` provides the same opt-in for environment-based setups (#2167, reported by @tam481).
 - mDNS TXT model and manufacturer metadata can now disambiguate products that share a service. Real fixtures distinguish LG TVs from Marantz speakers over AirPlay, and old agents keep the existing generic behavior (#2158).

+ 16 - 1
app/public/locales/en/translation.json

@@ -27,6 +27,17 @@
     "onlyUnread": "Unread only",
     "silence": "Silence",
     "silenceForever": "Forever",
+    "snoozeTitle": "Snooze this alert",
+    "snoozeDesc": "Pauses notifications and escalation for this incident. Monitoring continues and the resolution is still detected.",
+    "snooze1h": "For 1 hour",
+    "snooze2h": "For 2 hours",
+    "snooze8h": "For 8 hours",
+    "snoozeTomorrow": "Until tomorrow at 9:00",
+    "snooze7d": "For 7 days",
+    "snoozedUntil": "Snoozed until {{time}}",
+    "snoozedIndefinitely": "Snoozed indefinitely",
+    "unsnooze": "Undo snooze",
+    "approveBssidAction": "Approve as ours",
     "approveBssid": "This BSSID is ours: approve it and stop impostor alerts for it",
     "impostorRule": "SSID impostor detection",
     "impostorRuleDesc": "Alert when an unknown radio broadcasts a network name of your fleet. Turn it off if your own APs outside NetPulse (UniFi, Omada...) trigger false positives.",
@@ -321,7 +332,11 @@
     "actions": {
       "identify": "Identify device",
       "updateAgent": "Update agent",
-      "dismiss": "Clear alert"
+      "dismiss": "Clear alert",
+      "markRead": "Mark as read",
+      "snooze": "Snooze",
+      "viewMore": "View more",
+      "viewLess": "View less"
     }
   },
   "auth": {

+ 16 - 1
app/public/locales/es/translation.json

@@ -27,6 +27,17 @@
     "onlyUnread": "Solo no leídas",
     "silence": "Silenciar",
     "silenceForever": "Siempre",
+    "snoozeTitle": "Posponer esta alerta",
+    "snoozeDesc": "Pausa las notificaciones y el escalado de este incidente. La monitorización continúa y la resolución se sigue detectando.",
+    "snooze1h": "Durante 1 hora",
+    "snooze2h": "Durante 2 horas",
+    "snooze8h": "Durante 8 horas",
+    "snoozeTomorrow": "Hasta mañana a las 9:00",
+    "snooze7d": "Durante 7 días",
+    "snoozedUntil": "Pospuesta hasta las {{time}}",
+    "snoozedIndefinitely": "Pospuesta sin fecha",
+    "unsnooze": "Quitar posposición",
+    "approveBssidAction": "Aprobar como propia",
     "approveBssid": "Este BSSID es nuestro: aprobarlo y dejar de alertar de impostor por él",
     "impostorRule": "Detección de impostores de SSID",
     "impostorRuleDesc": "Avisa cuando una radio desconocida emite el nombre de una red de tu flota. Apágala si tus propios APs fuera de NetPulse (UniFi, Omada...) generan falsos positivos.",
@@ -321,7 +332,11 @@
     "actions": {
       "identify": "Identificar dispositivo",
       "updateAgent": "Actualizar agente",
-      "dismiss": "Limpiar alerta"
+      "dismiss": "Limpiar alerta",
+      "markRead": "Marcar como leído",
+      "snooze": "Posponer",
+      "viewMore": "Ver más",
+      "viewLess": "Ver menos"
     }
   },
   "auth": {

+ 16 - 1
app/public/locales/ru/translation.json

@@ -29,6 +29,17 @@
     "onlyUnread": "Только непрочитанные",
     "silence": "Заглушить",
     "silenceForever": "Навсегда",
+    "snoozeTitle": "Отложить это оповещение",
+    "snoozeDesc": "Приостанавливает уведомления и эскалацию этого инцидента. Мониторинг продолжается, восстановление отслеживается.",
+    "snooze1h": "Отложить на 1 час",
+    "snooze2h": "Отложить на 2 часа",
+    "snooze8h": "Отложить на 8 часов",
+    "snoozeTomorrow": "До завтра, 9:00",
+    "snooze7d": "Отложить на 7 дней",
+    "snoozedUntil": "Отложено до {{time}}",
+    "snoozedIndefinitely": "Отложено без срока",
+    "unsnooze": "Отменить откладывание",
+    "approveBssidAction": "Одобрить как наш",
     "approveBssid": "Этот BSSID наш: одобрите его, и ложные оповещения об этом радиомодуле прекратятся",
     "impostorRule": "Поиск самозваных SSID",
     "impostorRuleDesc": "Оповещать, когда неизвестная радиоточка вещает имя сети из вашего парка. Отключите, если ваши точки доступа вне NetPulse (UniFi, Omada...) дают ложные срабатывания.",
@@ -327,7 +338,11 @@
     "actions": {
       "identify": "Опознать устройство",
       "updateAgent": "Обновить агента",
-      "dismiss": "Закрыть оповещение"
+      "dismiss": "Закрыть оповещение",
+      "markRead": "Отметить как прочитанное",
+      "snooze": "Отложить",
+      "viewMore": "Подробнее",
+      "viewLess": "Свернуть"
     }
   },
   "auth": {

+ 16 - 1
app/public/locales/zh/translation.json

@@ -1084,6 +1084,17 @@
     "onlyUnread": "仅未读",
     "silence": "静默",
     "silenceForever": "永久",
+    "snoozeTitle": "推迟此告警",
+    "snoozeDesc": "暂停此事件的通知和升级。监控继续进行,仍会检测恢复。",
+    "snooze1h": "推迟 1 小时",
+    "snooze2h": "推迟 2 小时",
+    "snooze8h": "推迟 8 小时",
+    "snoozeTomorrow": "推迟到明天 9:00",
+    "snooze7d": "推迟 7 天",
+    "snoozedUntil": "已推迟至 {{time}}",
+    "snoozedIndefinitely": "已无限期推迟",
+    "unsnooze": "取消推迟",
+    "approveBssidAction": "批准为本网络",
     "approveBssid": "这个 BSSID 是我们自己的:批准它并停止对其的伪装告警",
     "impostorRule": "SSID 伪装检测",
     "impostorRuleDesc": "当未知射频广播你设备组的网络名时告警。若你自己在 NetPulse 之外的 AP(UniFi、Omada…)会触发误报,请关闭它。",
@@ -1378,7 +1389,11 @@
     "actions": {
       "identify": "识别设备",
       "updateAgent": "更新探针",
-      "dismiss": "清除告警"
+      "dismiss": "清除告警",
+      "markRead": "标记为已读",
+      "snooze": "推迟",
+      "viewMore": "查看更多",
+      "viewLess": "收起"
     }
   },
   "settings": {

+ 70 - 52
app/src/components/AlertItem.tsx

@@ -1,11 +1,13 @@
-import { AlertTriangle, Check, CheckCircle2, CircleArrowUp, Fingerprint, Info, OctagonX } from 'lucide-react'
+import type { MouseEvent as ReactMouseEvent } from 'react'
+import { AlertTriangle, Check, CheckCircle2, ChevronRight, Clock, Info, OctagonX } from 'lucide-react'
 import type { LucideIcon } from 'lucide-react'
 import { useTranslation } from 'react-i18next'
-import { useNavigate } from 'react-router'
 import { alertRelTime } from '@/i18n'
 import type { AlertSeverity, AlertEvent } from '@/data/mock'
 import { alertTitle } from '@/lib/alerts-i18n'
-import { RowAction } from '@/components/RowAction'
+import { SnoozeMenu } from '@/components/SnoozeMenu'
+import { snoozeLabel } from '@/lib/snooze'
+import type { SnoozeWhen } from '@/lib/snooze'
 import { cn } from '@/lib/utils'
 
 const SEVERITY: Record<AlertSeverity, { icon: LucideIcon; tile: string; dot: string; stripe: string }> = {
@@ -15,52 +17,39 @@ const SEVERITY: Record<AlertSeverity, { icon: LucideIcon; tile: string; dot: str
   ok: { icon: CheckCircle2, tile: 'bg-ok/10 text-ok', dot: 'bg-ok', stripe: 'border-l-ok' },
 }
 
+const ROW_ACTION =
+  'flex items-center justify-center rounded-md p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-accent disabled:cursor-default disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-text-muted pointer-coarse:p-2.5'
+
 interface AlertItemProps {
   alert: AlertEvent
   onClick?: () => void
-  onDismiss?: (id: string) => void
+  /** #2185: las tres acciones del ítem (leído, posponer, ver más). */
+  onMarkRead?: (id: string) => void
+  onSnooze?: (id: string, when: SnoozeWhen) => void
+  onUnsnooze?: (id: string) => void
   className?: string
 }
 
 /** Ítem de alerta del resumen (home.md §⑥): tile de severidad, título,
- *  tiempo y dot no-leído. #862: sin descripción/hint, solo el título, y con
- *  las acciones del feed (contextual + limpiar) reveladas en hover de fila.
- *  div role=button (no <button>) para poder anidar los botones de acción;
- *  Enter/Espacio como un botón real y las acciones hacen stopPropagation. */
-export function AlertItem({ alert, onClick, onDismiss, className }: AlertItemProps) {
-  const { t } = useTranslation()
-  const navigate = useNavigate()
+ *  tiempo y dot no-leído. #2185: tres acciones explícitas (marcar leído,
+ *  posponer y ver más); "ver más" abre el registro en `/alerts`, donde vive
+ *  el detalle completo. div role=button (no <button>) para poder anidar los
+ *  botones de acción; Enter/Espacio como un botón real y las acciones hacen
+ *  stopPropagation. */
+export function AlertItem({ alert, onClick, onMarkRead, onSnooze, onUnsnooze, className }: AlertItemProps) {
+  const { t, i18n } = useTranslation()
   const s = SEVERITY[alert.severity]
   const Icon = s.icon
-  // #772: la alerta de desconocido enlaza a la tarjeta de alta (intake).
-  const intakeMac = alert.type === 'unknown-device' ? alert.vars?.mac : undefined
-  // #862: acción contextual igual que en el feed (#833).
-  const action = intakeMac
-    ? {
-        icon: Fingerprint,
-        title: t('alerts.actions.identify'),
-        onClick: () => navigate(`/devices?intake=${encodeURIComponent(intakeMac)}`),
-      }
-    : alert.type === 'agent-outdated'
-      ? {
-          icon: CircleArrowUp,
-          title: t('alerts.actions.updateAgent'),
-          onClick: () => navigate('/routers#agentes'),
-        }
-      : undefined
-  const handleRowClick = () => {
-    if (intakeMac) navigate(`/devices?intake=${encodeURIComponent(intakeMac)}`)
-    onClick?.()
-  }
+  const viewMore = () => onClick?.()
   return (
     <div
       role="button"
       tabIndex={0}
-      onClick={handleRowClick}
+      onClick={clickGuard(viewMore)}
       onKeyDown={(e) => {
         if (e.key === 'Enter' || e.key === ' ') {
           e.preventDefault()
-          handleRowClick()
+          viewMore()
         }
       }}
       className={cn(
@@ -74,34 +63,52 @@ export function AlertItem({ alert, onClick, onDismiss, className }: AlertItemPro
         <Icon className="h-[18px] w-[18px]" strokeWidth={1.75} />
       </div>
       <div className="min-w-0 flex-1">
-        <div className="flex items-center justify-between gap-2 pointer-coarse:flex-wrap">
+        <div className="flex flex-wrap items-center justify-between gap-2 sm:flex-nowrap">
           <span className="truncate text-sm font-medium text-text-primary">{alertTitle(t, alert)}</span>
           <span className="flex shrink-0 items-center gap-1 pointer-coarse:basis-full">
-            {action && (
-              <RowAction
-                icon={action.icon}
-                label={action.title}
-                title={action.title}
-                iconOnly
-                onClick={(e) => { e.stopPropagation(); action.onClick() }}
-                className="text-text-muted hover:text-accent"
-              />
+            {onMarkRead && (
+              <button
+                type="button"
+                disabled={alert.read}
+                onClick={(e) => { e.stopPropagation(); onMarkRead(alert.id) }}
+                className={ROW_ACTION}
+                title={t('alerts.actions.markRead')}
+                aria-label={t('alerts.actions.markRead')}
+              >
+                <Check className="h-4 w-4 shrink-0" strokeWidth={1.75} />
+              </button>
             )}
-            {onDismiss && (
-              <RowAction
-                icon={Check}
-                label={t('alerts.actions.dismiss')}
-                title={t('alerts.actions.dismiss')}
-                iconOnly
-                onClick={(e) => { e.stopPropagation(); onDismiss(alert.id) }}
-                className="text-text-muted hover:text-ok"
+            {onSnooze && onUnsnooze && (
+              <SnoozeMenu
+                snoozed={alert.snoozed}
+                onSnooze={(when) => onSnooze(alert.id, when)}
+                onUnsnooze={() => onUnsnooze(alert.id)}
               />
             )}
+            {onClick && (
+              <button
+                type="button"
+                onClick={(e) => { e.stopPropagation(); viewMore() }}
+                className={cn(ROW_ACTION, 'hover:text-accent')}
+                title={t('alerts.actions.viewMore')}
+                aria-label={t('alerts.actions.viewMore')}
+              >
+                <ChevronRight className="h-4 w-4 shrink-0" strokeWidth={1.75} />
+              </button>
+            )}
             <span className="text-caption text-text-muted">{alertRelTime(alert)}</span>
           </span>
         </div>
+        {alert.snoozed && (
+          <p className="mt-0.5 flex items-center gap-1 truncate text-caption text-accent">
+            <Clock className="h-3 w-3 shrink-0" strokeWidth={2} />
+            {alert.snoozedUntil
+              ? t('alerts.snoozedUntil', { time: snoozeLabel(alert.snoozedUntil, i18n.language || 'es') })
+              : t('alerts.snoozedIndefinitely')}
+          </p>
+        )}
       </div>
-      {!alert.read && (
+      {!alert.read && !alert.snoozed && (
         <span className="relative flex h-1.5 w-1.5 shrink-0">
           <span className={cn('absolute inline-flex h-full w-full rounded-full opacity-75 animate-ping-soft', s.dot)} />
           <span className={cn('relative inline-flex h-1.5 w-1.5 rounded-full', s.dot)} />
@@ -110,3 +117,14 @@ export function AlertItem({ alert, onClick, onDismiss, className }: AlertItemPro
     </div>
   )
 }
+
+/** Envuelve el click de la fila para ignorar el arrastre de selección de
+ *  texto (mismo criterio que el feed, #393). */
+function clickGuard(fn: () => void) {
+  return (e: ReactMouseEvent<HTMLDivElement>) => {
+    const sel = window.getSelection()
+    if (sel && sel.toString().trim().length > 0) return
+    if ((e.target as HTMLElement).closest('button')) return
+    fn()
+  }
+}

+ 95 - 0
app/src/components/SnoozeMenu.tsx

@@ -0,0 +1,95 @@
+/**
+ * Menú "Posponer" (#2185) compartido por el feed de Alertas y la tarjeta del
+ * resumen. Posponer NO oculta la alerta: pausa avisos, escalado y
+ * re-emisiones mientras dure, y la fila queda marcada hasta que expire o se
+ * quite. Las opciones (1 h, 2 h, 8 h, mañana a las 9:00, 7 días) se resuelven
+ * en el cliente: "hasta mañana a las 9:00" depende del reloj de quien mira,
+ * no del servidor.
+ */
+import { useTranslation } from 'react-i18next'
+import type { MouseEvent as ReactMouseEvent } from 'react'
+import { BellOff, Clock } from 'lucide-react'
+import { tomorrowAtNine } from '@/lib/snooze'
+import type { SnoozeDuration, SnoozeWhen } from '@/lib/snooze'
+import {
+  DropdownMenu,
+  DropdownMenuContent,
+  DropdownMenuItem,
+  DropdownMenuLabel,
+  DropdownMenuSeparator,
+  DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { cn } from '@/lib/utils'
+
+interface SnoozeMenuProps {
+  snoozed?: boolean
+  onSnooze: (when: SnoozeWhen) => void
+  onUnsnooze: () => void
+  className?: string
+  align?: 'start' | 'end' | 'center'
+}
+
+export function SnoozeMenu({ snoozed, onSnooze, onUnsnooze, className, align = 'end' }: SnoozeMenuProps) {
+  const { t } = useTranslation()
+  const stop = (e: ReactMouseEvent) => e.stopPropagation()
+  const options: { key: SnoozeDuration | 'tomorrow'; label: string; when: SnoozeWhen }[] = [
+    { key: '1h', label: t('alerts.snooze1h'), when: { duration: '1h' } },
+    { key: '2h', label: t('alerts.snooze2h'), when: { duration: '2h' } },
+    { key: '8h', label: t('alerts.snooze8h'), when: { duration: '8h' } },
+    { key: 'tomorrow', label: t('alerts.snoozeTomorrow'), when: { until: tomorrowAtNine() } },
+    { key: '7d', label: t('alerts.snooze7d'), when: { duration: '7d' } },
+  ]
+  return (
+    <DropdownMenu>
+      <DropdownMenuTrigger asChild>
+        <button
+          type="button"
+          onPointerDown={stop}
+          onClick={stop}
+          title={t('alerts.actions.snooze')}
+          aria-label={t('alerts.actions.snooze')}
+          className={cn(
+            'flex items-center justify-center rounded-md p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-accent pointer-coarse:p-2.5',
+            snoozed && 'text-accent',
+            className,
+          )}
+        >
+          <Clock className="h-4 w-4 shrink-0" strokeWidth={1.75} />
+        </button>
+      </DropdownMenuTrigger>
+      <DropdownMenuContent
+        align={align}
+        className="w-64 border-border bg-elevated"
+        onPointerDown={stop}
+        onClick={stop}
+      >
+        <DropdownMenuLabel className="font-normal">
+          <span className="block text-sm font-medium text-text-primary">{t('alerts.snoozeTitle')}</span>
+          <span className="mt-1 block text-caption leading-snug text-text-muted">{t('alerts.snoozeDesc')}</span>
+        </DropdownMenuLabel>
+        <DropdownMenuSeparator className="bg-border" />
+        {options.map((opt) => (
+          <DropdownMenuItem
+            key={opt.key}
+            onSelect={() => onSnooze(opt.when)}
+            className="text-text-primary focus:bg-hover focus:text-text-primary"
+          >
+            {opt.label}
+          </DropdownMenuItem>
+        ))}
+        {snoozed && (
+          <>
+            <DropdownMenuSeparator className="bg-border" />
+            <DropdownMenuItem
+              onSelect={onUnsnooze}
+              className="gap-2 text-accent focus:bg-hover focus:text-accent"
+            >
+              <BellOff className="h-3.5 w-3.5" strokeWidth={1.75} />
+              {t('alerts.unsnooze')}
+            </DropdownMenuItem>
+          </>
+        )}
+      </DropdownMenuContent>
+    </DropdownMenu>
+  )
+}

+ 49 - 12
app/src/data/DataProvider.tsx

@@ -40,6 +40,8 @@ import type {
   WireGuardStats,
 } from '@/data/types'
 import { VM_SUPPORTED } from '@/data/types'
+import { snoozeUntil } from '@/lib/snooze'
+import type { SnoozeWhen } from '@/lib/snooze'
 import {
   adguard as mockAdGuard,
   alerts as mockAlerts,
@@ -191,8 +193,11 @@ export interface NetPulseApi extends NetPulseData {
   /** Acción destructiva "Vaciar registro" (#1034) - POST /api/alerts/clear
    * (live): borra el log del servidor. Demo: estado local. Optimista. */
   clearAllAlerts: () => void
-  /** POST /api/alerts/silence (live): silencia alertas con la misma dedup key. */
-  silenceAlert: (id: string, duration: '1h' | '24h' | 'forever') => void
+  /** POST /api/alerts/silence (live): pospone las alertas con la misma dedup
+   * key (#2185). La alerta sigue en el feed marcada como pospuesta. */
+  snoozeAlert: (id: string, when: SnoozeWhen) => void
+  /** POST /api/alerts/unsilence (live): quita la posposición de una alerta. */
+  unsnoozeAlert: (id: string) => void
   /** POST /api/alerts/impostor-approve (live): aprueba un BSSID como propio
    * (#1400); la alerta de impostor de ese BSSID se resuelve y no vuelve. */
   approveImpostorBssid: (bssid: string) => void
@@ -1049,17 +1054,20 @@ export function DataProvider({ children }: { children: React.ReactNode }) {
     })()
   }, [])
 
-  /** Silencia una alerta por dedup key; el backend la filtra del feed. */
-  const silenceAlert = useCallback((id: string, duration: '1h' | '24h' | 'forever') => {
-    // Optimistic: remove the alert from the local feed immediately
+  /** Pospone una alerta (#2185): la fila SIGUE en el feed con su marca, pero
+   * pausa avisos, escalado y re-emisiones hasta el fin. Optimista; en live
+   * POST /api/alerts/silence. Demo: solo estado local. */
+  const snoozeAlert = useCallback((id: string, when: SnoozeWhen) => {
+    const until = snoozeUntil(when)
     setBundle((prev) => {
       const target = prev.alerts.find((a) => a.id === id)
       if (!target) return prev
       const dedupKey = `${target.category}|${target.title}|${target.routerId ?? ''}`
-      const alerts = prev.alerts.filter((a) => {
-        const k = `${a.category}|${a.title}|${a.routerId ?? ''}`
-        return k !== dedupKey
-      })
+      const alerts = prev.alerts.map((a) =>
+        `${a.category}|${a.title}|${a.routerId ?? ''}` === dedupKey
+          ? { ...a, snoozed: true, snoozedUntil: until }
+          : a,
+      )
       const unreadAlerts =
         modeRef.current === 'live'
           ? prev.unreadAlerts
@@ -1072,7 +1080,35 @@ export function DataProvider({ children }: { children: React.ReactNode }) {
         const res = await fetch('/api/alerts/silence', {
           method: 'POST',
           headers: { 'Content-Type': 'application/json' },
-          body: JSON.stringify({ id, duration }),
+          body: JSON.stringify({ id, ...when }),
+        })
+        if (res.status === 401) redirectLogin()
+      } catch {
+        /* resync por snapshot */
+      }
+    })()
+  }, [])
+
+  /** Quita la posposición (#2185). Optimista; en live POST
+   * /api/alerts/unsilence con el id. */
+  const unsnoozeAlert = useCallback((id: string) => {
+    setBundle((prev) => {
+      const alerts = prev.alerts.map((a) =>
+        a.id === id ? { ...a, snoozed: false, snoozedUntil: 0 } : a,
+      )
+      const unreadAlerts =
+        modeRef.current === 'live'
+          ? prev.unreadAlerts
+          : countUnreadAlerts(alerts, configRef.current)
+      return { ...prev, alerts, unreadAlerts }
+    })
+    if (modeRef.current !== 'live') return
+    void (async () => {
+      try {
+        const res = await fetch('/api/alerts/unsilence', {
+          method: 'POST',
+          headers: { 'Content-Type': 'application/json' },
+          body: JSON.stringify({ id }),
         })
         if (res.status === 401) redirectLogin()
       } catch {
@@ -1474,7 +1510,8 @@ export function DataProvider({ children }: { children: React.ReactNode }) {
       markAlertsRead,
       markAllAlertsRead,
       clearAllAlerts,
-      silenceAlert,
+      snoozeAlert,
+      unsnoozeAlert,
       approveImpostorBssid,
       setPeerUrgent,
       dismissAlert,
@@ -1488,7 +1525,7 @@ export function DataProvider({ children }: { children: React.ReactNode }) {
       removeAgent,
       createAgentInstall,
     }),
-    [bundle, connectionStatus, agents, refreshAgents, isDemo, refresh, lastSnapshotAt, requestServerRefresh, getRouterDetail, getDevices, getAlerts, alertsConfig, setAlertConfig, markAlertsRead, markAllAlertsRead, clearAllAlerts, silenceAlert, approveImpostorBssid, setPeerUrgent, dismissAlert, rearmAgent, upgradeAgent, backupAgent, upgradeAllAgents, backupRouterSsh, reinstallAgent, uninstallAgent, removeAgent, createAgentInstall],
+    [bundle, connectionStatus, agents, refreshAgents, isDemo, refresh, lastSnapshotAt, requestServerRefresh, getRouterDetail, getDevices, getAlerts, alertsConfig, setAlertConfig, markAlertsRead, markAllAlertsRead, clearAllAlerts, snoozeAlert, unsnoozeAlert, approveImpostorBssid, setPeerUrgent, dismissAlert, rearmAgent, upgradeAgent, backupAgent, upgradeAllAgents, backupRouterSsh, reinstallAgent, uninstallAgent, removeAgent, createAgentInstall],
   )
 
   return <NetPulseContext.Provider value={value}>{children}</NetPulseContext.Provider>

+ 7 - 3
app/src/data/alertConfig.ts

@@ -79,7 +79,11 @@ export function isHiddenByLevel(ev: Pick<AlertEvent, 'category'>, cfg: AlertsCon
   return (cfg[ev.category] ?? 'all') === 'none'
 }
 
-/** No leídas que el motor sirve — el contador de la campana. */
-export function countUnreadAlerts(alerts: Pick<AlertEvent, 'category' | 'read'>[], cfg: AlertsConfig): number {
-  return alerts.filter((a) => !a.read && !isHiddenByLevel(a, cfg)).length
+/** No leídas que el motor sirve — el contador de la campana. Una alerta
+ *  pospuesta no cuenta como pendiente (#2185). */
+export function countUnreadAlerts(
+  alerts: (Pick<AlertEvent, 'category' | 'read'> & { snoozed?: boolean })[],
+  cfg: AlertsConfig,
+): number {
+  return alerts.filter((a) => !a.read && !a.snoozed && !isHiddenByLevel(a, cfg)).length
 }

+ 6 - 0
app/src/data/types.ts

@@ -466,6 +466,12 @@ export interface AlertEvent {
    *  Viene del server para no depender de tener el evento en la página
    *  actual del feed; si falta (servidor viejo), la UI cae a `resolves`. */
   resolved?: ResolvedAlertRef[]
+  /** #2185: la alerta está pospuesta (sigue en el feed y monitorizada, pero
+   *  sin avisos, escalado ni re-emisiones). */
+  snoozed?: boolean
+  /** #2185: unix SEGUNDOS de fin de la posposición. 0/ausente con
+   *  `snoozed` = sin fecha. */
+  snoozedUntil?: number
 }
 
 /** #1466: referencia de un evento resuelto, autocontenida. */

+ 36 - 0
app/src/lib/snooze.ts

@@ -0,0 +1,36 @@
+/**
+ * Cálculo de la posposición de alertas (#2185). Vive fuera del componente
+ * porque lo usan el provider (estado optimista) y el menú (opciones).
+ */
+
+export type SnoozeDuration = '1h' | '2h' | '8h' | '7d' | 'forever'
+
+export type SnoozeWhen = { duration: SnoozeDuration } | { until: number }
+
+const HOURS: Record<SnoozeDuration, number> = { '1h': 1, '2h': 2, '8h': 8, '7d': 7 * 24, forever: 0 }
+
+/** Unix SEGUNDOS del fin de posposición (0 = sin fecha). */
+export function snoozeUntil(when: SnoozeWhen): number {
+  if ('until' in when) return when.until
+  const hours = HOURS[when.duration]
+  if (hours === 0) return 0
+  return Math.floor(Date.now() / 1000) + hours * 3600
+}
+
+/** Mañana a las 09:00 locales, en unix SEGUNDOS. */
+export function tomorrowAtNine(now = new Date()): number {
+  const d = new Date(now)
+  d.setDate(d.getDate() + 1)
+  d.setHours(9, 0, 0, 0)
+  return Math.floor(d.getTime() / 1000)
+}
+
+/** Texto corto del fin de posposición: hora si es hoy, fecha y hora si no. */
+export function snoozeLabel(until: number, locale: string): string {
+  if (until <= 0) return ''
+  const target = new Date(until * 1000)
+  const sameDay = target.toDateString() === new Date().toDateString()
+  return sameDay
+    ? target.toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit' })
+    : target.toLocaleString(locale, { dateStyle: 'short', timeStyle: 'short' })
+}

+ 113 - 110
app/src/pages/Alerts.tsx

@@ -5,13 +5,12 @@ import { AnimatePresence, motion, useReducedMotion } from 'framer-motion'
 import {
   AlertTriangle,
   ArrowRight,
-  BellOff,
   Check,
   CheckCheck,
   CheckCircle2,
   ChevronRight,
   CircleArrowUp,
-  Fingerprint,
+  Clock,
   Globe,
   Info,
   Laptop,
@@ -31,12 +30,14 @@ import {
 import type { LucideIcon } from 'lucide-react'
 import { alertRelTime, relTime } from '@/i18n'
 import { alertDescription, alertHint, alertTitle } from '@/lib/alerts-i18n'
+import { snoozeLabel } from '@/lib/snooze'
+import type { SnoozeWhen } from '@/lib/snooze'
 import type { AlertCategory, AlertConfigLevel, AlertSeverity } from '@/data/types'
 import { ALERT_CATEGORIES, isHiddenByLevel } from '@/data/alertConfig'
 import { CountUp } from '@/components/CountUp'
 import { EmptyState } from '@/components/EmptyState'
-import { RowAction } from '@/components/RowAction'
 import { SegmentedControl } from '@/components/SegmentedControl'
+import { SnoozeMenu } from '@/components/SnoozeMenu'
 import { Switch } from '@/components/ui/switch'
 import {
   DropdownMenu,
@@ -188,8 +189,19 @@ function Fact({ label, value }: { label: string; value: string }) {
   )
 }
 
-function ContextPanel({ ev, animateIn }: { ev: FeedEvent; animateIn: boolean }) {
+function ContextPanel({
+  ev,
+  animateIn,
+  onDismiss,
+  onApproveImpostor,
+}: {
+  ev: FeedEvent
+  animateIn: boolean
+  onDismiss?: (id: string) => void
+  onApproveImpostor?: (bssid: string) => void
+}) {
   const { t } = useTranslation()
+  const navigate = useNavigate()
   const c = ev.context
   const PeerIcon = c?.wg ? PEER_ICONS[c.wg.peerType] : null
   // Unknown device: the point of the alert is finding the thing, so the
@@ -284,6 +296,43 @@ function ContextPanel({ ev, animateIn }: { ev: FeedEvent; animateIn: boolean })
           <ArrowRight className="h-3.5 w-3.5 transition-transform duration-150 group-hover:translate-x-0.5" strokeWidth={1.75} />
         </Link>
       )}
+
+      {/* #2185: las acciones secundarias viven en el detalle; la fila queda
+          con los tres botones (leído, posponer, ver más). */}
+      {(onDismiss || (onApproveImpostor && ev.type === 'wifi-ssid-impostor' && ev.vars?.bssid) || ev.type === 'agent-outdated') && (
+        <div className="flex flex-wrap items-center gap-4 border-t border-border/60 pt-3">
+          {ev.type === 'agent-outdated' && (
+            <button
+              type="button"
+              onClick={() => navigate('/routers#agentes')}
+              className="inline-flex items-center gap-1 text-caption font-semibold text-accent transition-colors hover:text-accent/80"
+            >
+              <CircleArrowUp className="h-3.5 w-3.5" strokeWidth={1.75} />
+              {t('alerts.actions.updateAgent')}
+            </button>
+          )}
+          {onApproveImpostor && ev.type === 'wifi-ssid-impostor' && ev.vars?.bssid && (
+            <button
+              type="button"
+              onClick={() => onApproveImpostor(ev.vars!.bssid!)}
+              className="inline-flex items-center gap-1 text-caption font-semibold text-ok transition-colors hover:text-ok/80"
+            >
+              <ShieldCheck className="h-3.5 w-3.5" strokeWidth={1.75} />
+              {t('alerts.approveBssidAction')}
+            </button>
+          )}
+          {onDismiss && (
+            <button
+              type="button"
+              onClick={() => onDismiss(ev.id)}
+              className="inline-flex items-center gap-1 text-caption font-semibold text-danger transition-colors hover:text-danger/80"
+            >
+              <Trash2 className="h-3.5 w-3.5" strokeWidth={1.75} />
+              {t('alerts.actions.dismiss')}
+            </button>
+          )}
+        </div>
+      )}
     </div>
   )
 }
@@ -348,11 +397,13 @@ interface FeedRowProps {
   expanded: boolean
   onToggle: () => void
   reduce: boolean
-  onSilence?: (id: string, duration: '1h' | '24h' | 'forever') => void
+  /** #2185: las tres acciones de la fila. */
+  onMarkRead: (id: string) => void
+  onSnooze: (id: string, when: SnoozeWhen) => void
+  onUnsnooze: (id: string) => void
   onDismiss?: (id: string) => void
   /** #1400: aprobar el BSSID de una alerta wifi-ssid-impostor como propio. */
   onApproveImpostor?: (bssid: string) => void
-  action?: { icon: LucideIcon; title: string; onClick: () => void }
   /** #1349: feed por id para resolver los eventos que un evento de cierre
    *  (`ev.resolves`) cerró y listarlos al expandirlo. */
   feedById?: Map<string, FeedEvent>
@@ -360,8 +411,11 @@ interface FeedRowProps {
 
 // #862: RowAction vive en components/RowAction.tsx (compartido con AlertItem).
 
-function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDismiss, onApproveImpostor, action, feedById }: FeedRowProps) {
-  const { t } = useTranslation()
+const ROW_ACTION =
+  'flex items-center justify-center rounded-md p-1.5 text-text-muted transition-colors hover:bg-hover hover:text-accent disabled:cursor-default disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-text-muted pointer-coarse:p-2.5'
+
+function FeedRow({ ev, index, read, expanded, onToggle, reduce, onMarkRead, onSnooze, onUnsnooze, onDismiss, onApproveImpostor, feedById }: FeedRowProps) {
+  const { t, i18n } = useTranslation()
   const sev = SEVERITY[ev.severity]
   const Icon = ev.icon ?? sev.icon
   // #1357: badge de categoría por fila - la fila se tiñe por severidad y la
@@ -369,7 +423,6 @@ function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDis
   // confundía a quien leía el color como categoría).
   const catMeta = CATEGORY_META[ev.category]
   const CatIcon = catMeta?.icon
-  const [showSilence, setShowSilence] = useState(false)
   // #393: posición del pointerdown para distinguir click (sin movimiento →
   // togglear) de arrastre de selección de texto (movimiento → no togglear).
   const downAt = useRef<{ x: number; y: number } | null>(null)
@@ -418,7 +471,7 @@ function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDis
         )}
       >
         <div className="min-w-0 flex-1">
-          <div className="flex items-center justify-between gap-2 pointer-coarse:flex-wrap">
+          <div className="flex flex-wrap items-center justify-between gap-2 sm:flex-nowrap">
             <span className="flex min-w-0 items-center gap-2">
               <span className="truncate text-sm font-medium text-text-primary">{alertTitle(t, ev)}</span>
               {ev.urgent && (
@@ -443,10 +496,20 @@ function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDis
                   {t(`alerts.categories.${ev.category}`)}
                 </span>
               )}
+              {/* #2185: la alerta pospuesta sigue visible; esta marca dice
+                  hasta cuándo está en pausa. */}
+              {ev.snoozed && (
+                <span className="inline-flex shrink-0 items-center gap-1 rounded-md bg-accent-soft px-1.5 py-0.5 text-[11px] font-medium text-accent">
+                  <Clock className="h-3 w-3" strokeWidth={2} />
+                  {ev.snoozedUntil
+                    ? t('alerts.snoozedUntil', { time: snoozeLabel(ev.snoozedUntil, i18n.language || 'es') })
+                    : t('alerts.snoozedIndefinitely')}
+                </span>
+              )}
             </span>
-            <span className="flex shrink-0 items-center gap-2 pointer-coarse:basis-full">
+            <span className="flex shrink-0 items-center gap-1 pointer-coarse:basis-full">
               <AnimatePresence initial={false}>
-                {!read && (
+                {!read && !ev.snoozed && (
                   <motion.span
                     key="dot"
                     exit={{ scale: 0, opacity: 0 }}
@@ -456,52 +519,39 @@ function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDis
                   />
                 )}
               </AnimatePresence>
-              {/* #1400: en alertas de impostor, aprobar el BSSID como
-                  propio (AP conocido fuera de la flota: UniFi, Omada...).
-                  Persiste en el backend y resuelve la alerta. */}
-              {onApproveImpostor && ev.type === 'wifi-ssid-impostor' && ev.vars?.bssid && (
-                <button
-                  type="button"
-                  onClick={(e) => { e.stopPropagation(); onApproveImpostor(ev.vars!.bssid!) }}
-                  className="rounded-md p-1 opacity-0 group-hover:opacity-100 transition-opacity text-text-muted hover:text-ok pointer-coarse:opacity-100 pointer-coarse:p-2"
-                  title={t('alerts.approveBssid')}
-                >
-                  <ShieldCheck className="h-4 w-4" strokeWidth={1.75} />
-                </button>
-              )}
-              {onSilence && (
-                <button
-                  type="button"
-                  onClick={(e) => { e.stopPropagation(); setShowSilence((v) => !v) }}
-                  className="rounded-md p-1 opacity-0 group-hover:opacity-100 transition-opacity text-text-muted hover:text-text-primary pointer-coarse:opacity-100 pointer-coarse:p-2"
-                  title={t('alerts.silence')}
-                >
-                  <BellOff className="h-4 w-4" strokeWidth={1.75} />
-                </button>
-              )}
-              {/* #833: acción propia de la alerta (solo cuando aplica) y
-                  limpiar alerta, siempre. #965: SOLO icono (sin etiqueta);
-                  el dismiss es un Check con hover verde. */}
-              {action && (
-                <RowAction
-                  icon={action.icon}
-                  label={action.title}
-                  title={action.title}
-                  iconOnly
-                  onClick={(e) => { e.stopPropagation(); action.onClick() }}
-                  className="text-text-muted hover:text-accent"
-                />
-              )}
-              {onDismiss && (
-                <RowAction
-                  icon={Check}
-                  label={t('alerts.actions.dismiss')}
-                  title={t('alerts.actions.dismiss')}
-                  iconOnly
-                  onClick={(e) => { e.stopPropagation(); onDismiss(ev.id) }}
-                  className="text-text-muted hover:text-ok"
+              {/* #2185: tres acciones explícitas. Marcar leído no expande ni
+                  borra; el reloj pospone sin ocultar la fila; ver más abre el
+                  detalle (igual que el click en la fila). */}
+              <button
+                type="button"
+                disabled={read}
+                onClick={(e) => { e.stopPropagation(); onMarkRead(ev.id) }}
+                className={ROW_ACTION}
+                title={t('alerts.actions.markRead')}
+                aria-label={t('alerts.actions.markRead')}
+              >
+                <Check className="h-4 w-4 shrink-0" strokeWidth={1.75} />
+              </button>
+              <SnoozeMenu
+                snoozed={ev.snoozed}
+                onSnooze={(when) => onSnooze(ev.id, when)}
+                onUnsnooze={() => onUnsnooze(ev.id)}
+              />
+              <button
+                type="button"
+                onClick={(e) => { e.stopPropagation(); onToggle() }}
+                aria-expanded={expanded}
+                className={cn(ROW_ACTION, 'gap-1 hover:text-accent')}
+                title={expanded ? t('alerts.actions.viewLess') : t('alerts.actions.viewMore')}
+              >
+                <ChevronRight
+                  className={cn('h-4 w-4 shrink-0 transition-transform duration-200', expanded && 'rotate-90')}
+                  strokeWidth={1.75}
                 />
-              )}
+                <span className="hidden text-caption font-medium md:inline">
+                  {expanded ? t('alerts.actions.viewLess') : t('alerts.actions.viewMore')}
+                </span>
+              </button>
               <span className="font-mono text-caption text-text-muted">{alertRelTime(ev)}</span>
             </span>
           </div>
@@ -515,36 +565,8 @@ function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDis
             </p>
           )}
         </div>
-        <ChevronRight
-          className={cn('h-4 w-4 shrink-0 text-text-muted transition-transform duration-200', expanded && 'rotate-90')}
-          strokeWidth={1.75}
-        />
       </div>
 
-      {/* Silence options popup */}
-      {showSilence && onSilence && (
-        <div className="absolute right-3 top-2 z-20 flex items-center gap-1 rounded-lg border border-border bg-elevated px-2 py-1 shadow-lg">
-          <span className="text-[10px] text-text-muted mr-1">{t('alerts.silence')}:</span>
-          {(['1h', '24h', 'forever'] as const).map((dur) => (
-            <button
-              key={dur}
-              type="button"
-              onClick={(e) => { e.stopPropagation(); onSilence(ev.id, dur); setShowSilence(false) }}
-              className="rounded px-2 py-0.5 text-[11px] font-medium text-text-primary hover:bg-hover"
-            >
-              {dur === 'forever' ? t('alerts.silenceForever') : dur}
-            </button>
-          ))}
-          <button
-            type="button"
-            onClick={(e) => { e.stopPropagation(); setShowSilence(false) }}
-            className="ml-1 text-text-muted hover:text-text-primary"
-          >
-            ✕
-          </button>
-        </div>
-      )}
-
       <AnimatePresence initial={false}>
         {expanded && (
           <motion.div
@@ -556,7 +578,7 @@ function FeedRow({ ev, index, read, expanded, onToggle, reduce, onSilence, onDis
             className="overflow-hidden"
           >
             <div className="mx-3 mb-2 mt-1">
-              <ContextPanel ev={ev} animateIn={!reduce} />
+              <ContextPanel ev={ev} animateIn={!reduce} onDismiss={onDismiss} onApproveImpostor={onApproveImpostor} />
               {/* #1349: el evento de cierre lista los eventos que resolvió
                   (conservados en el log marcados, no borrados).
                   #1466: el server manda `resolved` autocontenido (título,
@@ -632,7 +654,8 @@ export default function Alerts() {
     markAlertsRead,
     markAllAlertsRead,
     clearAllAlerts,
-    silenceAlert,
+    snoozeAlert,
+    unsnoozeAlert,
     dismissAlert,
     approveImpostorBssid,
   } = useNetPulse()
@@ -657,7 +680,6 @@ export default function Alerts() {
   const [sev, setSev] = useState<SevFilter>('todas')
   const [cats, setCats] = useState<ReadonlySet<AlertCategory>>(new Set())
   const [searchParams] = useSearchParams()
-  const navigate = useNavigate()
   // Persistencia de la opción de vista: sobrevive a recargas y sesiones.
   // Sin preferencia guardada (instalación nueva) arranca en "solo no
   // leídas"; ?unread=1 en la URL fuerza el estado.
@@ -711,26 +733,6 @@ export default function Alerts() {
     setExpandedId((cur) => (cur === ev.id ? null : ev.id))
   }
 
-  // #833: acción contextual por tipo de alerta (icono + tooltip). Solo los
-  // tipos con una acción real la muestran; TODAS tienen "limpiar alerta".
-  const actionOf = (ev: FeedEvent): { icon: LucideIcon; title: string; onClick: () => void } | undefined => {
-    if (ev.type === 'unknown-device' && ev.vars?.mac) {
-      return {
-        icon: Fingerprint,
-        title: t('alerts.actions.identify'),
-        onClick: () => navigate(`/devices?intake=${encodeURIComponent(ev.vars?.mac ?? '')}`),
-      }
-    }
-    if (ev.type === 'agent-outdated') {
-      return {
-        icon: CircleArrowUp,
-        title: t('alerts.actions.updateAgent'),
-        onClick: () => navigate('/routers#agentes'),
-      }
-    }
-    return undefined
-  }
-
   const toggleCat = (cat: AlertCategory) => {
     setCats((prev) => {
       const next = new Set(prev)
@@ -1182,10 +1184,11 @@ export default function Alerts() {
                     expanded={expandedId === ev.id}
                     onToggle={() => toggleEvent(ev)}
                     reduce={reduce}
-                    onSilence={silenceAlert}
+                    onMarkRead={(id) => markAlertsRead([id])}
+                    onSnooze={snoozeAlert}
+                    onUnsnooze={unsnoozeAlert}
                     onDismiss={dismissAlert}
                     onApproveImpostor={approveImpostorBssid}
-                    action={actionOf(ev)}
                     feedById={feedById}
                   />
                 ))}

+ 8 - 2
app/src/sections/RecentAlerts.tsx

@@ -13,7 +13,7 @@ import { cn } from '@/lib/utils'
 export function RecentAlerts() {
   const { t } = useTranslation()
   const navigate = useNavigate()
-  const { alerts, unreadAlerts, alertsConfig, dismissAlert } = useNetPulse()
+  const { alerts, unreadAlerts, alertsConfig, markAlertsRead, snoozeAlert, unsnoozeAlert } = useNetPulse()
   const [readIds, setReadIds] = useState<Set<string>>(new Set())
   const [spinning, setSpinning] = useState(false)
   // Timer del spin del botón de recheck: en un ref para limpiarlo en unmount
@@ -55,6 +55,7 @@ export function RecentAlerts() {
 
   const markReadAndGo = (id: string) => {
     setReadIds((prev) => new Set(prev).add(id))
+    markAlertsRead([id])
     navigate('/alerts')
   }
 
@@ -99,7 +100,12 @@ export function RecentAlerts() {
             <AlertItem
               alert={{ ...a, read: a.read || readIds.has(a.id) }}
               onClick={() => markReadAndGo(a.id)}
-              onDismiss={dismissAlert}
+              onMarkRead={(id) => {
+                setReadIds((prev) => new Set(prev).add(id))
+                markAlertsRead([id])
+              }}
+              onSnooze={snoozeAlert}
+              onUnsnooze={unsnoozeAlert}
             />
           </motion.div>
         ))}

+ 2 - 1
docs/manual.en.md

@@ -326,7 +326,8 @@ Alerts are generated by the server from what it already monitors: temperature, a
 ### Design decisions
 
 - Configuration is **per category and per level**, not per alert. **None** hides the category: its events do not enter the log, do not count on the bell and do not notify. **Urgent only** and **All** are notification policy: everything is recorded and the level decides what notifies.
-- You can **silence** a specific alert for 1 hour, 24 hours or forever.
+- You can **snooze** a specific alert for 1 hour, 2 hours, 8 hours, until tomorrow at 9:00 or 7 days. Snoozing pauses notifications and escalation without hiding it: the row stays in the log with a marker showing until when, and monitoring and resolution keep running.
+- Every row has three actions: **mark as read**, **snooze** and **view more**. **Clearing an alert** lives in its details (expand the row).
 - The **feed uses simulated infinite scroll**: reaching the bottom shows the end of history.
 
 ### Procedure: configure which alerts you want

+ 2 - 1
docs/manual.es.md

@@ -326,7 +326,8 @@ Las alertas las genera el servidor a partir de lo que ya monitoriza: temperatura
 ### Decisiones de diseño
 
 - La configuración es **por categoría y por nivel**, no alerta a alerta. **Nada** oculta la categoría: sus eventos no entran al registro, no cuentan en la campana y no notifican. **Solo urgentes** y **Todo** son política de notificación: todo se registra y el nivel decide qué avisa.
-- Puedes **silenciar** una alerta concreta 1 hora, 24 horas o para siempre.
+- Puedes **posponer** una alerta concreta 1 hora, 2 horas, 8 horas, hasta mañana a las 9:00 o 7 días. Posponer pausa avisos y escalado sin ocultarla: la fila sigue en el registro con la marca de hasta cuándo, y la monitorización y la resolución se siguen detectando.
+- Cada fila tiene tres acciones: **marcar como leída**, **posponer** y **ver más**. **Limpiar una alerta** está en su detalle (al expandirla).
 - El **feed usa scroll infinito simulado**: al llegar abajo se muestra el fin del historial.
 
 ### Procedimiento: configurar qué alertas quieres

+ 42 - 12
server-go/internal/alerts/alerts.go

@@ -94,6 +94,12 @@ type AlertEvent struct {
 	// tiene cargada, así que el payload va autocontenido y la UI no depende
 	// de buscarlo en su feed local.
 	Resolved []ResolvedEvent `json:"resolved,omitempty"`
+	// Snoozed / SnoozedUntil (#2185): la alerta esta pospuesta. La fila SIGUE
+	// en el feed (el incidente se sigue monitorizando y su cierre se sigue
+	// detectando), pero no cuenta como pendiente, no dispara avisos y no se
+	// re-emite mientras dure. SnoozedUntil 0 con Snoozed=true = sin fecha.
+	Snoozed      bool  `json:"snoozed,omitempty"`
+	SnoozedUntil int64 `json:"snoozedUntil,omitempty"`
 	// Volatile (#966): la alerta vive SOLO en memoria (no se persiste en
 	// alert_log ni sobrevive a reinicios) y desaparece del feed cuando su
 	// condicion se resuelve (engine.Remove). Uso: caida de agente, cuya
@@ -900,10 +906,11 @@ func (e *Engine) List() []AlertEvent {
 		if e.hiddenByLevelLocked(ev) {
 			continue
 		}
+		// #2185: una alerta pospuesta NO se oculta. El operador la sigue
+		// viendo (con su marca de posposicion) porque el incidente sigue
+		// monitorizado; solo se silencian avisos, escalado y re-emisiones.
 		key := ev.Category + "|" + ev.Title + "|" + ev.RouterID
-		if e.isSilencedLocked(key) {
-			continue
-		}
+		ev.Snoozed, ev.SnoozedUntil = e.snoozeStateLocked(key)
 		if hideOK && ev.Severity == "ok" {
 			continue
 		}
@@ -992,7 +999,7 @@ func (e *Engine) UnreadCount() int {
 			continue
 		}
 		key := ev.Category + "|" + ev.Title + "|" + ev.RouterID
-		if e.isSilencedLocked(key) {
+		if snoozed, _ := e.snoozeStateLocked(key); snoozed {
 			continue
 		}
 		if hideOK && ev.Severity == "ok" {
@@ -1269,9 +1276,11 @@ func (e *Engine) Remove(ids ...string) {
 	e.saveReadLocked()
 }
 
-// Silence silences alerts matching the dedup key of the given alert ID for the
-// specified duration. Duration 0 means forever. Returns the dedup key that was
-// silenced, or empty string if the alert ID was not found.
+// Silence pospone las alertas que comparten la dedup key de la alerta dada
+// durante la duracion indicada (#2185: "posponer"). Duration 0 = sin fecha.
+// La alerta NO se oculta del feed: la fila queda marcada con Snoozed y deja
+// de contar como pendiente, de notificar y de re-emitirse. Devuelve la dedup
+// key pospuesta, o cadena vacia si el ID no existe.
 func (e *Engine) Silence(id string, dur time.Duration) string {
 	e.mu.Lock()
 	var dedupKey string
@@ -1293,13 +1302,27 @@ func (e *Engine) Silence(id string, dur time.Duration) string {
 	e.saveSilenceLocked()
 	cb := e.onChange
 	e.mu.Unlock()
-	// #1434: la lista servida cambia (la alerta queda filtrada).
+	// #1434: la lista servida cambia (la alerta pasa a pospuesta).
 	if cb != nil {
 		cb()
 	}
 	return dedupKey
 }
 
+// SnoozeKey devuelve la dedup key de la alerta con ese ID (vacia si no
+// existe). Permite quitar la posposicion desde el cliente sin reconstruir
+// la clave.
+func (e *Engine) SnoozeKey(id string) string {
+	e.mu.Lock()
+	defer e.mu.Unlock()
+	for _, ev := range e.list {
+		if ev.ID == id {
+			return ev.Category + "|" + ev.Title + "|" + ev.RouterID
+		}
+	}
+	return ""
+}
+
 // Unsilence removes the silence for a dedup key.
 func (e *Engine) Unsilence(dedupKey string) {
 	e.mu.Lock()
@@ -1325,18 +1348,25 @@ func (e *Engine) Silenced() map[string]int64 {
 }
 
 func (e *Engine) isSilencedLocked(key string) bool {
+	snoozed, _ := e.snoozeStateLocked(key)
+	return snoozed
+}
+
+// snoozeStateLocked dice si la dedup key esta pospuesta y hasta cuando
+// (0 = sin fecha). Poda la entrada si ya expiro. Requiere e.mu tomado.
+func (e *Engine) snoozeStateLocked(key string) (bool, int64) {
 	expiry, ok := e.silenceMap[key]
 	if !ok {
-		return false
+		return false, 0
 	}
 	if expiry == 0 {
-		return true // forever
+		return true, 0 // sin fecha
 	}
 	if e.now().Unix() >= expiry {
 		delete(e.silenceMap, key)
-		return false
+		return false, 0
 	}
-	return true
+	return true, expiry
 }
 
 func (e *Engine) pruneSilenceLocked() {

+ 73 - 28
server-go/internal/alerts/alerts_test.go

@@ -579,35 +579,77 @@ func TestSilenceBlocksEmit(t *testing.T) {
 	}
 }
 
-// TestSilenceFiltersList (#329): silenced alerts are excluded from List().
-func TestSilenceFiltersList(t *testing.T) {
+// TestSnoozeKeepsAlertVisible (#2185): posponer ya no oculta la alerta del
+// feed; la marca como pospuesta y deja de contar como pendiente.
+func TestSnoozeKeepsAlertVisible(t *testing.T) {
+	fakeNow := time.Now()
 	e := New(nil, nil)
+	e.now = func() time.Time { return fakeNow }
 	e.SetConfig(map[string]string{"router": LevelAll, "internet": LevelAll})
 
 	e.Emit(ev("a1", "router", false))
 	e.Emit(AlertEvent{ID: "b1", Category: "internet", Urgent: false, Severity: "warn", Title: "internet-down", RouterID: "r1"})
 
-	// Both should be in the list
+	if len(e.List()) != 2 {
+		t.Fatalf("expected 2 alerts, got %d", len(e.List()))
+	}
+	if n := e.UnreadCount(); n != 2 {
+		t.Fatalf("expected 2 unread, got %d", n)
+	}
+
+	e.Silence("a1", time.Hour)
+
 	list := e.List()
 	if len(list) != 2 {
-		t.Fatalf("expected 2 alerts, got %d", len(list))
+		t.Fatalf("snoozing must keep the row in the feed, got %d", len(list))
+	}
+	var snoozed *AlertEvent
+	for i := range list {
+		if list[i].ID == "a1" {
+			snoozed = &list[i]
+		}
 	}
+	if snoozed == nil || !snoozed.Snoozed {
+		t.Fatalf("a1 should be flagged as snoozed: %+v", snoozed)
+	}
+	if want := fakeNow.Add(time.Hour).Unix(); snoozed.SnoozedUntil != want {
+		t.Fatalf("SnoozedUntil = %d, want %d", snoozed.SnoozedUntil, want)
+	}
+	if n := e.UnreadCount(); n != 1 {
+		t.Fatalf("snoozed alerts must not count as pending, got %d", n)
+	}
+}
 
-	// Silence a1
-	e.Silence("a1", time.Hour)
+// TestSnoozeBlocksReEmission (#2185): mientras dure la posposicion el mismo
+// incidente no vuelve a entrar (sin avisos ni escalado), pero la fila sigue.
+func TestSnoozeBlocksReEmission(t *testing.T) {
+	e := New(nil, nil)
+	e.SetConfig(map[string]string{"router": LevelAll})
 
-	// List should only show b1
-	list = e.List()
-	if len(list) != 1 {
-		t.Fatalf("expected 1 alert after silence, got %d", len(list))
+	if !e.Emit(ev("a1", "router", false)) {
+		t.Fatal("first emit should succeed")
 	}
-	if list[0].ID != "b1" {
-		t.Fatalf("remaining alert should be b1, got %s", list[0].ID)
+	key := e.Silence("a1", time.Hour)
+	if key == "" {
+		t.Fatal("Silence should return the dedup key")
+	}
+	e.dedup = map[string]int64{} // aislar la posposicion del dedup
+	dup := AlertEvent{ID: "a2", Category: "router", Severity: "warn", Title: "t-a1", RouterID: "r1"}
+	if e.Emit(dup) {
+		t.Fatal("emit should be blocked while snoozed")
+	}
+	if len(e.List()) != 1 {
+		t.Fatalf("the original row must stay, got %d", len(e.List()))
+	}
+	e.Unsilence(key)
+	if !e.Emit(dup) {
+		t.Fatal("emit should succeed after unsnooze")
 	}
 }
 
-// TestSilenceExpiry (#329): silenced alerts reappear after duration expires.
-func TestSilenceExpiry(t *testing.T) {
+// TestSnoozeExpiry (#2185): al expirar, la fila sigue y deja de estar
+// marcada; el incidente puede volver a emitirse.
+func TestSnoozeExpiry(t *testing.T) {
 	fakeNow := time.Now()
 	e := New(nil, nil)
 	e.now = func() time.Time { return fakeNow }
@@ -616,36 +658,39 @@ func TestSilenceExpiry(t *testing.T) {
 	e.Emit(ev("a1", "router", false))
 	e.Silence("a1", time.Hour)
 
-	// Should be filtered
-	if len(e.List()) != 0 {
-		t.Fatal("alert should be silenced")
+	if list := e.List(); len(list) != 1 || !list[0].Snoozed {
+		t.Fatalf("alert should be snoozed and visible: %+v", list)
 	}
 
-	// Advance time past expiry
 	fakeNow = fakeNow.Add(2 * time.Hour)
 
-	// Should reappear
-	if len(e.List()) != 1 {
-		t.Fatal("alert should reappear after silence expires")
+	list := e.List()
+	if len(list) != 1 {
+		t.Fatalf("alert should still be listed after expiry, got %d", len(list))
+	}
+	if list[0].Snoozed || list[0].SnoozedUntil != 0 {
+		t.Fatalf("expired snooze must clear the flag: %+v", list[0])
 	}
 }
 
-// TestSilenceForever (#329): duration 0 means forever.
-func TestSilenceForever(t *testing.T) {
+// TestSnoozeForever (#2185): duration 0 = sin fecha; la fila sigue marcada.
+func TestSnoozeForever(t *testing.T) {
 	fakeNow := time.Now()
 	e := New(nil, nil)
 	e.now = func() time.Time { return fakeNow }
 	e.SetConfig(map[string]string{"router": LevelAll})
 
 	e.Emit(ev("a1", "router", false))
-	e.Silence("a1", 0) // forever
+	e.Silence("a1", 0) // sin fecha
 
-	// Advance time a lot
 	fakeNow = fakeNow.Add(365 * 24 * time.Hour)
 
-	// Should still be silenced
-	if len(e.List()) != 0 {
-		t.Fatal("forever silence should not expire")
+	list := e.List()
+	if len(list) != 1 || !list[0].Snoozed {
+		t.Fatalf("forever snooze must keep the row flagged: %+v", list)
+	}
+	if list[0].SnoozedUntil != 0 {
+		t.Fatalf("forever snooze must not carry an expiry, got %d", list[0].SnoozedUntil)
 	}
 }
 

+ 87 - 0
server-go/internal/httpapi/alerts_api_test.go

@@ -6,10 +6,12 @@ package httpapi_test
 import (
 	"bytes"
 	"encoding/json"
+	"fmt"
 	"io"
 	"net/http"
 	"strings"
 	"testing"
+	"time"
 )
 
 func doJSON(t *testing.T, method, base, path, cookie string, body string) *http.Response {
@@ -253,3 +255,88 @@ func TestAlertsNoTrailingNewline(t *testing.T) {
 		t.Fatal("writeJSON no debe terminar en \\n")
 	}
 }
+
+// POST /api/alerts/silence (#2185): posponer deja la alerta en el feed con
+// snoozed/snoozedUntil, acepta 1h/2h/8h/7d/forever y una fecha absoluta, y
+// POST /api/alerts/unsilence {id} quita la posposicion.
+func TestAlertsSnoozeEndpoint(t *testing.T) {
+	ts := makeTestServer(t)
+	_, cookie, _ := loginCookie(t, ts.URL, "admin", "test123456")
+
+	res := doJSON(t, "POST", ts.URL, "/api/alerts/silence", cookie, `{"id":"alert-handshake-wg","duration":"2h"}`)
+	if res.StatusCode != 200 {
+		t.Fatalf("snooze: %d", res.StatusCode)
+	}
+	var snoozed struct {
+		OK  bool   `json:"ok"`
+		Key string `json:"key"`
+	}
+	if err := json.NewDecoder(res.Body).Decode(&snoozed); err != nil || !snoozed.OK || snoozed.Key == "" {
+		t.Fatalf("snooze body: %+v err=%v", snoozed, err)
+	}
+	res.Body.Close()
+
+	items := alertItems(t, get(t, ts.URL, "/api/alerts", cookie))
+	var row map[string]any
+	for _, a := range items {
+		if a["id"] == "alert-handshake-wg" {
+			row = a
+		}
+	}
+	if row == nil {
+		t.Fatal("la alerta pospuesta debe seguir en el feed")
+	}
+	if got, _ := row["snoozed"].(bool); !got {
+		t.Fatalf("snoozed ausente: %v", row)
+	}
+	until, _ := row["snoozedUntil"].(float64)
+	if until <= float64(time.Now().Unix()) {
+		t.Fatalf("snoozedUntil no está en el futuro: %v", row["snoozedUntil"])
+	}
+
+	// Quitar la posposicion por ID y ver que la marca desaparece.
+	res = doJSON(t, "POST", ts.URL, "/api/alerts/unsilence", cookie, `{"id":"alert-handshake-wg"}`)
+	if res.StatusCode != 200 {
+		t.Fatalf("unsnooze por id: %d", res.StatusCode)
+	}
+	res.Body.Close()
+	for _, a := range alertItems(t, get(t, ts.URL, "/api/alerts", cookie)) {
+		if a["id"] == "alert-handshake-wg" {
+			if got, _ := a["snoozed"].(bool); got {
+				t.Fatalf("snoozed debería haberse quitado: %v", a)
+			}
+		}
+	}
+
+	// Duraciones válidas y fecha absoluta.
+	future := time.Now().Add(3 * time.Hour).Unix()
+	for _, body := range []string{
+		`{"id":"alert-handshake-wg","duration":"1h"}`,
+		`{"id":"alert-handshake-wg","duration":"8h"}`,
+		`{"id":"alert-handshake-wg","duration":"7d"}`,
+		`{"id":"alert-handshake-wg","duration":"forever"}`,
+		fmt.Sprintf(`{"id":"alert-handshake-wg","until":%d}`, future),
+	} {
+		res = doJSON(t, "POST", ts.URL, "/api/alerts/silence", cookie, body)
+		if res.StatusCode != 200 {
+			t.Fatalf("snooze %s: %d", body, res.StatusCode)
+		}
+		res.Body.Close()
+	}
+
+	for _, body := range []string{
+		`{"id":"alert-handshake-wg","duration":"5m"}`,
+		`{"id":"alert-handshake-wg","until":1}`,
+		`{"id":"no-existe","duration":"1h"}`,
+	} {
+		res = doJSON(t, "POST", ts.URL, "/api/alerts/silence", cookie, body)
+		if body == `{"id":"no-existe","duration":"1h"}` {
+			if res.StatusCode != 404 {
+				t.Fatalf("snooze inexistente: %d, esperaba 404", res.StatusCode)
+			}
+		} else if res.StatusCode != 400 {
+			t.Fatalf("snooze %s: %d, esperaba 400", body, res.StatusCode)
+		}
+		res.Body.Close()
+	}
+}

+ 30 - 5
server-go/internal/httpapi/data.go

@@ -491,12 +491,15 @@ func (s *server) handleAlertsDismiss(w http.ResponseWriter, r *http.Request) {
 	writeJSON(w, http.StatusOK, map[string]any{"ok": true})
 }
 
-// handleAlertsSilence (POST): body {"id":"...","duration":"1h|24h|forever"} →
-// silencia alertas con la misma dedup key (category|title|routerId).
+// handleAlertsSilence (POST): body {"id":"...","duration":"1h|2h|8h|24h|7d|forever"}
+// o {"id":"...","until":<unix segundos>} → pospone las alertas con la misma
+// dedup key (category|title|routerId). Desde #2185 la alerta no se oculta:
+// queda marcada como pospuesta en el feed.
 func (s *server) handleAlertsSilence(w http.ResponseWriter, r *http.Request) {
 	var body struct {
 		ID       string `json:"id"`
-		Duration string `json:"duration"` // "1h", "24h", "forever"
+		Duration string `json:"duration"` // "1h", "2h", "8h", "24h", "7d", "forever"
+		Until    int64  `json:"until"`    // unix segundos; gana sobre duration
 	}
 	if st := readJSONBody(w, r, &body); st != 0 {
 		writeBodyError(w, st, "invalid_body", "body JSON inválido")
@@ -510,14 +513,31 @@ func (s *server) handleAlertsSilence(w http.ResponseWriter, r *http.Request) {
 	switch body.Duration {
 	case "1h":
 		dur = time.Hour
+	case "2h":
+		dur = 2 * time.Hour
+	case "8h":
+		dur = 8 * time.Hour
 	case "24h":
 		dur = 24 * time.Hour
+	case "7d":
+		dur = 7 * 24 * time.Hour
 	case "forever", "":
 		dur = 0
 	default:
-		writeError(w, http.StatusBadRequest, "invalid_input", "duration must be 1h, 24h or forever")
+		writeError(w, http.StatusBadRequest, "invalid_input", "duration must be 1h, 2h, 8h, 24h, 7d or forever")
 		return
 	}
+	if body.Until > 0 {
+		dur = time.Until(time.Unix(body.Until, 0))
+		if dur <= 0 {
+			writeError(w, http.StatusBadRequest, "invalid_input", "until must be in the future")
+			return
+		}
+		if dur > 31*24*time.Hour {
+			writeError(w, http.StatusBadRequest, "invalid_input", "until is too far away")
+			return
+		}
+	}
 	key := s.adapter.AlertsEngine().Silence(body.ID, dur)
 	if key == "" {
 		writeError(w, http.StatusNotFound, "not_found", "alert not found")
@@ -526,15 +546,20 @@ func (s *server) handleAlertsSilence(w http.ResponseWriter, r *http.Request) {
 	writeJSON(w, http.StatusOK, map[string]any{"ok": true, "key": key})
 }
 
-// handleAlertsUnsilence (POST): body {"key":"cat|title|routerId"} → quita silencio.
+// handleAlertsUnsilence (POST): body {"key":"cat|title|routerId"} o {"id":"..."}
+// → quita la posposicion.
 func (s *server) handleAlertsUnsilence(w http.ResponseWriter, r *http.Request) {
 	var body struct {
 		Key string `json:"key"`
+		ID  string `json:"id"`
 	}
 	if st := readJSONBody(w, r, &body); st != 0 {
 		writeBodyError(w, st, "invalid_body", "body JSON inválido")
 		return
 	}
+	if body.Key == "" && body.ID != "" {
+		body.Key = s.adapter.AlertsEngine().SnoozeKey(body.ID)
+	}
 	if body.Key == "" {
 		writeError(w, http.StatusBadRequest, "invalid_input", "key is required")
 		return