Backend:
- Servidor model: AgentToken, AgentLastSeen, MetricasJson nuevos campos
- AgentHeartbeat: endpoint público POST /agent/heartbeat (auth por token)
- GenerateAgentToken: endpoint protegido POST /app/servidor/:id/agent-token
- Ruta pública /agent/install.sh sirve el script de instalación
Agente Go (agent/):
- agent/main.go: binario independiente con gopsutil
- Recolecta RAM, CPU, Disco, Uptime, OS, Load average
- Lee agent.yml o flags --api-url / --token
- Envía POST a /agent/heartbeat cada N segundos
- Instala como servicio systemd via install.sh
- agent/go.mod: módulo independiente (usite-agent)
- agent/agent.yml.sample: configuración de ejemplo
- agent/install.sh: instalador en 1 curl para Linux (systemd)
Frontend servidor_dashboard.html:
- Cards: badge ● En línea / ● Fuera / ○ Sin agente
- Barras de progreso live: RAM%, CPU%, Disco%
- Valores: GB usado/total, núcleos, uptime, OS real
- Tiempo desde último reporte
- Botón 'Agente' en cada card → modal de configuración
- Modal agente: estado, token con copy, comando curl 1 línea,
instalación manual/avanzada con collapse, métricas actuales
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Cambia spread+reassign por mutación directa (this.pingCargando[id] = true)
para garantizar reactividad correcta en Alpine.js 3.x
- Usa (cx.ID || cx.id) en toda la plantilla para compatibilidad con
ambos formatos de serialización JSON de GORM
- Agrega type="button" y @click.stop en el botón de verificar
- Maneja respuestas HTTP no-OK con mensaje de error explícito
- Muestra mensaje de error real del catch en la UI
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Mueve el resultado del ping directamente bajo los datos de la BD
- Muestra mensaje de error cuando falla la conexión (usa campo error del backend)
- Spinner y texto 'Probando...' durante la espera
- Resultado verde/rojo inline con ✓/✗ y tiempo/mensaje de error
- Etiqueta del botón cambia a 'Verificar' (más descriptivo que 'Ping')
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- GetServidor: query conx_count per server with GROUP BY and attach to response
- servidor_dashboard.html: use conx_count from API (fallback to _conexiones.length)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Routes are registered under /app (web group), not /api/app.
The requests were hitting the JWT-protected API group causing 'Invalid Attempt' error.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Created servidor_dashboard.html with beautiful visual dashboard
- Shows all servers in grid cards with basic info
- Click button opens detailed modal with:
- Server full information (IP, CPU, RAM, Storage, OS, Expiration)
- All connected databases in a clean diagram layout
- Database connection status (active/inactive)
- Connection details (Host, Port, User, Type)
- Ping button to test connection with response time
- View Connection button to open query-runner
- Backend updates:
- Added ServidorDashboard() controller to render the dashboard view
- Added GetServidorDashboard() API endpoint to fetch server + connections
- Added PingConexion() endpoint to test database connections (TCP + DB test)
- Color-coded status badges and database type indicators
- Responsive design for mobile and desktop
- Routes:
- GET /app/servidor-dashboard (render view)
- GET /api/app/servidor-dashboard/:id (get server details API)
- GET /api/app/conx-ping/:id (ping connection endpoint)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>