Просмотр исходного кода

Alertas filtradas, nodo internet verde, cableados unidos, routers fuera de devices

- Bell → /alerts?unread=1 (el listado abre filtrado por no leídas: 2 = 2)
- 'eventos' → 'alertas' en textos UI
- Dispositivos: los routers (br-lan MAC) ya no salen como clientes
- Nodo internet: mismo lenguaje visual que los routers (círculo + anillo,
  verde cuando hay enlace)
- Topología: clientes cableados unidos con línea a su router; wifi suelto
- About: '100% privado · 0% nube'
gnacho 4 месяцев назад
Родитель
Сommit
51feede744

+ 5 - 5
app/public/locales/en/translation.json

@@ -4,7 +4,7 @@
     "allRead": "All read — the network is quiet",
     "chipCritical": "critical",
     "chipCriticalCaption": "There has never been a critical one. Touch wood.",
-    "chipToday": "events today",
+    "chipToday": "alerts today",
     "chipWarnings": "warnings",
     "chipWarningsCaption": "active · temperature and firmware",
     "days": {
@@ -15,7 +15,7 @@
     "emptyDesc": "There is nothing that requires your attention. The network is quiet.",
     "emptyTitle": "Total silence",
     "eventCount_one": "1 event",
-    "eventCount_other": "{{count}} events",
+    "eventCount_other": "{{count}} alerts",
     "filterByKind": "Filter by type",
     "filterBySeverity": "Filter by severity",
     "kinds": {
@@ -25,10 +25,10 @@
       "sistema": "System",
       "wireguard": "WireGuard"
     },
-    "loadingOld": "Loading older events…",
+    "loadingOld": "Loading older alerts…",
     "markAllRead": "Mark all as read",
     "moreActions": "More actions",
-    "noMoreEvents": "No more events (32 days of history)",
+    "noMoreEvents": "No more alerts",
     "onlyUnread": "Unread only",
     "sevAll": "All",
     "sevInfo": "Info",
@@ -437,7 +437,7 @@
       "desc": "Network control panel for OpenWRT devices. Monitors routers and APs with some services like AdGuard Home + WireGuard for now. Phase 1: read-only.",
       "footer": "React 19 · Tailwind · Recharts · Framer Motion — fonts: Space Grotesk, Inter, JetBrains Mono",
       "madeAtHome": "Support the project on Ko-fi",
-      "privacy": "Privacy: all data stays in your network",
+      "privacy": "100% private · 0% cloud",
       "title": "About",
       "versionNote": "v1.0.0"
     },

+ 5 - 5
app/public/locales/es/translation.json

@@ -4,7 +4,7 @@
     "allRead": "Todo leído — la red está tranquila",
     "chipCritical": "críticos",
     "chipCriticalCaption": "Nunca ha habido uno crítico. Toca madera.",
-    "chipToday": "eventos hoy",
+    "chipToday": "alertas hoy",
     "chipWarnings": "avisos",
     "chipWarningsCaption": "activos · temperatura y firmware",
     "days": {
@@ -15,7 +15,7 @@
     "emptyDesc": "No hay nada que requiera tu atención. La red está tranquila.",
     "emptyTitle": "Silencio total",
     "eventCount_one": "1 evento",
-    "eventCount_other": "{{count}} eventos",
+    "eventCount_other": "{{count}} alertas",
     "filterByKind": "Filtrar por tipo",
     "filterBySeverity": "Filtrar por severidad",
     "kinds": {
@@ -25,10 +25,10 @@
       "sistema": "Sistema",
       "wireguard": "WireGuard"
     },
-    "loadingOld": "Cargando eventos antiguos…",
+    "loadingOld": "Cargando alertas antiguas…",
     "markAllRead": "Marcar todo como leído",
     "moreActions": "Más acciones",
-    "noMoreEvents": "No hay más eventos (32 días de historial)",
+    "noMoreEvents": "No hay más alertas",
     "onlyUnread": "Solo no leídas",
     "sevAll": "Todas",
     "sevInfo": "Info",
@@ -437,7 +437,7 @@
       "desc": "Panel de control de red para dispositivos OpenWRT. Monitoriza routers y APs con algunos servicios como AdGuard Home + WireGuard de momento. Fase 1: solo lectura.",
       "footer": "React 19 · Tailwind · Recharts · Framer Motion — fuentes: Space Grotesk, Inter, JetBrains Mono",
       "madeAtHome": "Apoya el proyecto en Ko-fi",
-      "privacy": "Privacidad: todos los datos se quedan en tu red",
+      "privacy": "100% privado · 0% nube",
       "title": "Acerca de",
       "versionNote": "v1.0.0"
     },

+ 1 - 1
app/src/components/Layout.tsx

@@ -271,7 +271,7 @@ function BellButton() {
   return (
     <button
       type="button"
-      onClick={() => navigate('/alerts')}
+      onClick={() => navigate('/alerts?unread=1')}
       aria-label={t('topbar.alertsUnread', { count: unreadAlerts })}
       className="relative flex h-9 w-9 items-center justify-center rounded-lg border border-border bg-elevated text-text-secondary transition-colors duration-150 hover:border-accent/40 hover:text-accent"
     >

+ 42 - 6
app/src/components/topology/TopologyMap.tsx

@@ -636,15 +636,29 @@ export function TopologyMap({ model, apiRef, showLabels, flow, hoverLink, onHove
           >
           {!reduce && (
             <motion.circle
-              r={52}
-              fill={COLOR.accent}
-              initial={{ opacity: 0.1 }}
-              animate={{ opacity: [0.08, 0.18, 0.08] }}
+              r={48}
+              fill={COLOR.ok}
+              initial={{ opacity: 0.08 }}
+              animate={{ opacity: [0.06, 0.16, 0.06] }}
               transition={{ duration: 5, repeat: Infinity, ease: 'easeInOut' }}
             />
           )}
-          <rect x={-46} y={-38} width={92} height={76} rx={18} fill="rgb(var(--elevated))" stroke="rgb(var(--border-strong))" />
-          <Cloud x={-24} y={-20} width={48} height={40} className="text-accent" strokeWidth={1.75} aria-hidden />
+          <circle
+            r={40}
+            fill="rgb(var(--elevated))"
+            stroke={COLOR.ok}
+            strokeWidth={2}
+          />
+          <circle
+            r={45}
+            fill="none"
+            stroke={COLOR.ok}
+            strokeWidth={2.5}
+            strokeDasharray={`${(2 * Math.PI * 45) * 0.85} ${(2 * Math.PI * 45) * 0.15}`}
+            strokeLinecap="round"
+            transform="rotate(-90)"
+          />
+          <Cloud x={-18} y={-15} width={36} height={30} className="text-ok" strokeWidth={1.75} aria-hidden />
           </motion.g>
         </g>
 
@@ -781,6 +795,10 @@ export function TopologyMap({ model, apiRef, showLabels, flow, hoverLink, onHove
           <ClusterGroup
             key={cluster.id}
             cluster={cluster}
+            routerPos={(() => {
+              const rn = routerNodes.find((n) => n.id === cluster.routerId)
+              return rn ? { x: rn.x, y: rn.y } : null
+            })()}
             baseDelay={(1.4 + ci * 0.15) * T}
             reduce={reduce ?? false}
             opacity={nodeOpacity(cluster.id) * nodeOpacity(cluster.routerId)}
@@ -902,6 +920,7 @@ function LabelText({
 
 const ClusterGroup = memo(function ClusterGroup({
   cluster,
+  routerPos,
   baseDelay,
   reduce,
   opacity,
@@ -910,6 +929,7 @@ const ClusterGroup = memo(function ClusterGroup({
   onDotClick,
 }: {
   cluster: Cluster
+  routerPos: { x: number; y: number } | null
   baseDelay: number
   reduce: boolean
   opacity: number
@@ -919,6 +939,22 @@ const ClusterGroup = memo(function ClusterGroup({
 }) {
   return (
     <motion.g animate={{ opacity }} transition={{ duration: 0.2 }}>
+      {/* Cableados: línea desde el router hasta cada dot (wifi va suelto) */}
+      {routerPos &&
+        cluster.dots
+          .filter((dot) => dot.band === 'cable')
+          .map((dot) => (
+            <line
+              key={`${dot.id}-link`}
+              x1={routerPos.x}
+              y1={routerPos.y}
+              x2={dot.x}
+              y2={dot.y}
+              stroke={COLOR.ok}
+              strokeWidth={1}
+              strokeOpacity={0.35}
+            />
+          ))}
       {cluster.dots.map((dot, i) => (
         <motion.circle
           key={dot.id}

+ 3 - 2
app/src/pages/Alerts.tsx

@@ -1,6 +1,6 @@
 import { useEffect, useMemo, useRef, useState } from 'react'
 import { useTranslation } from 'react-i18next'
-import { Link } from 'react-router-dom'
+import { Link, useSearchParams } from 'react-router-dom'
 import { AnimatePresence, motion, useReducedMotion } from 'framer-motion'
 import {
   AlertTriangle,
@@ -315,7 +315,8 @@ export default function Alerts() {
   const [readIds, setReadIds] = useState<ReadonlySet<string>>(new Set())
   const [sev, setSev] = useState<SevFilter>('todas')
   const [kind, setKind] = useState<KindFilter>('todos')
-  const [onlyUnread, setOnlyUnread] = useState(false)
+  const [searchParams] = useSearchParams()
+  const [onlyUnread, setOnlyUnread] = useState(() => searchParams.get('unread') === '1')
   const [expandedId, setExpandedId] = useState<string | null>(null)
   const [burst, setBurst] = useState(0)
   const [loadState, setLoadState] = useState<'idle' | 'loading' | 'done'>('idle')

+ 3 - 0
server/src/adapters/index.js

@@ -429,8 +429,11 @@ function createLiveAdapter(config, dbHandle, initialRouters) {
     }
 
     const allMacs = new Set([...leasesByMac.keys(), ...seen.keys(), ...known.keys()])
+    const routerMacs = new Set()
+    for (const [, p] of polled) if (p.brMac) routerMacs.add(p.brMac)
     const devices = []
     for (const mac of allMacs) {
+      if (routerMacs.has(mac)) continue // los routers no son clientes
       const lease = leasesByMac.get(mac)
       const s = seen.get(mac) // visto ESTE tick (assoc/FDB)
       const k = s ? null : known.get(mac) // última atribución buena