This commit is contained in:
Lizandro Guarnizo
2026-05-21 23:49:37 -05:00
parent d80c7a86d3
commit 1a96caeb83
7 changed files with 324 additions and 13 deletions
+32 -11
View File
@@ -46,10 +46,9 @@
<span x-show="agentOnline(servidor)">● En línea</span>
<span x-show="!agentOnline(servidor) && servidor.agent_token">● Fuera</span>
<span x-show="!servidor.agent_token">○ Sin agente</span>
</span> <!-- Badge estado Hostinger -->
<span x-show="servidor.hostinger_vps_id" class="text-xs px-2 py-0.5 rounded-full font-bold"
:class="servidor.hostinger_state === 'running' ? 'bg-emerald-200 text-emerald-900' : (servidor.hostinger_state ? 'bg-amber-200 text-amber-900' : 'bg-slate-200 text-slate-600')">
<span x-text="servidor.hostinger_state || 'Hostinger'" class="capitalize"></span>
</span> <!-- Badge estado Hostinger: solo mostrar cuando NO es running (estados críticos como stopped/error) -->
<span x-show="servidor.hostinger_vps_id && servidor.hostinger_state && servidor.hostinger_state !== 'running'" class="text-xs px-2 py-0.5 rounded-full font-bold bg-amber-200 text-amber-900">
<span x-text="servidor.hostinger_state" class="capitalize"></span>
</span> </div>
</div>
</div>
@@ -129,13 +128,23 @@
</div>
</template>
<!-- Provider & Conexiones -->
<div class="flex items-center justify-between text-xs text-slate-500 pt-1">
<span x-text="servidor.prov_servidor?.nombre || 'Sin proveedor'"></span>
<span>
<span class="font-bold text-blue-600" x-text="servidor.conx_count ?? servidor._conexiones?.length ?? 0"></span>
BD
</span>
<!-- Provider, Vencimiento & Conexiones -->
<div class="space-y-1.5 pt-1">
<!-- Vencimiento -->
<template x-if="servidor.vencimiento">
<div x-data="{ info: vencimientoInfo(servidor.vencimiento) }">
<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full"
:class="info.clase"
x-text="'📅 ' + info.texto"></span>
</div>
</template>
<div class="flex items-center justify-between text-xs text-slate-500">
<span x-text="servidor.prov_servidor?.nombre || 'Sin proveedor'"></span>
<span>
<span class="font-bold text-blue-600" x-text="servidor.conx_count ?? servidor._conexiones?.length ?? 0"></span>
BD
</span>
</div>
</div>
<!-- Action Buttons -->
@@ -608,6 +617,18 @@
return diffMs < 3 * 60 * 1000; // online si reportó en últimos 3 minutos
},
vencimientoInfo(fecha) {
if (!fecha) return null;
const hoy = new Date(); hoy.setHours(0,0,0,0);
const vence = new Date(fecha); vence.setHours(0,0,0,0);
const dias = Math.round((vence - hoy) / 86400000);
if (dias < 0) return { texto: 'Vencido', clase: 'bg-red-100 text-red-700' };
if (dias === 0) return { texto: 'Vence hoy', clase: 'bg-red-100 text-red-700' };
if (dias <= 7) return { texto: `Vence en ${dias}d`, clase: 'bg-red-100 text-red-700' };
if (dias <= 30) return { texto: `Vence en ${dias}d`, clase: 'bg-amber-100 text-amber-700' };
return { texto: fecha, clase: 'bg-slate-100 text-slate-500' };
},
tiempoDesde(isoStr) {
if (!isoStr) return '—';
const diff = Math.floor((Date.now() - new Date(isoStr).getTime()) / 1000);