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

feat(router): show the agent version in the unit information card (#2026)

Nacho 3 недель назад
Родитель
Сommit
e82831cb0f

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

@@ -1023,7 +1023,9 @@
       "netgripTip": "The NetGrip panel runs on port 8080",
       "timezone": "Timezone",
       "title": "Information",
-      "updated": "Up to date"
+      "updated": "Up to date",
+      "agent": "Agent",
+      "agentExternal": "External"
     },
     "latency": {
       "24h": "Latency 24 h",

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

@@ -1023,7 +1023,9 @@
       "netgripTip": "El panel NetGrip corre en el puerto 8080",
       "timezone": "Zona horaria",
       "title": "Información",
-      "updated": "Actualizado"
+      "updated": "Actualizado",
+      "agent": "Agente",
+      "agentExternal": "Externo"
     },
     "latency": {
       "24h": "Latencia 24 h",

+ 22 - 0
app/src/components/routers/RouterInfo.tsx

@@ -49,6 +49,10 @@ export function RouterInfo({ router, extras }: { router: Router; extras?: Router
   // acierta solo en los routers que usan el de por defecto, y en las placas
   // GL.iNet el 8080 es la web de fábrica, así que el panel vive en otro.
   const netgripAgent = useAgentFor(router.id)
+  // #2007: el mismo agente que decide el panel NetGrip sirve para enseñar su
+  // versión en la ficha: la fila de inventario dice "agent" sin decir qué
+  // agente, y el badge de flota solo la tiene en el tooltip.
+  const agent = netgripAgent
   const hasNetgrip = netgripAgent?.kind === 'netgrip'
   const netgripPort = netgripAgent?.panelPort || 8090
   const ex = extras ?? (isDemo ? getRouterExtras(router.id) : EMPTY_EXTRAS)
@@ -113,6 +117,24 @@ export function RouterInfo({ router, extras }: { router: Router; extras?: Router
         '—'
       ),
     },
+    {
+      // #2007: versión del agente instalado, si lo hay. Cierra "cómo se
+      // recoge esta unidad" junto a la fila de inventario.
+      label: t('routerDetail.info.agent'),
+      node: agent ? (
+        <span className="inline-flex flex-wrap items-center justify-end gap-1.5">
+          <span>{agent.version || '—'}</span>
+          {agent.kind && agent.kind !== 'native' && (
+            <span className="text-text-muted">
+              {agent.kind === 'netgrip' ? 'NetGrip' : t('routerDetail.info.agentExternal')}
+            </span>
+          )}
+          {!agent.fresh && <StatusPill tone="danger" label={t('routers.agent.stale')} />}
+        </span>
+      ) : (
+        '—'
+      ),
+    },
     {
       label: t('routerDetail.info.access'),
       node: router.type === 'managed-switch' || router.type === 'external' ? (