useAgentFor.ts 511 B

1234567891011
  1. import { useNetPulse } from '@/data/DataProvider'
  2. import type { AgentInfo } from '@/data/types'
  3. import { findAgentFor } from '@/lib/agentMatch'
  4. /** Agente nativo registrado en un router. El backend resuelve la asociación
  5. * por slug/hostname/MAC, así que preferimos `routerId` y caemos a `slug`
  6. * para compatibilidad con configuraciones antiguas (#282). */
  7. export function useAgentFor(routerId: string): AgentInfo | undefined {
  8. const { agents } = useNetPulse()
  9. return findAgentFor(agents, routerId)
  10. }