varaverk: add Partner card — known hosts, owner tags, Tailscale online status

This commit is contained in:
Gmer4Lfe
2026-05-24 11:36:23 -04:00
parent cbac3949e0
commit c17be8d017
3 changed files with 73 additions and 0 deletions
@@ -9,6 +9,11 @@
<div id="vv-fallback-desc"></div>
</div>
<div class="vv-card" id="vv-partner" style="flex:2;min-width:220px;">
<h3>Partner</h3>
<div id="vv-partner-body">Loading...</div>
</div>
<div class="vv-card" id="vv-cpu" style="flex:2;min-width:240px;">
<h3>CPU</h3>
<div id="vv-cpu-body">Loading...</div>
@@ -318,6 +323,34 @@ function vvPollMonitor() {
}
document.getElementById('vv-fallback-desc').innerHTML = descHtml;
// ── Partner ─────────────────────────────────────────────────────────────
const pt = d.partner ?? {};
const ptHosts = pt.hosts ?? [];
const ptStatus = pt.enabled
? `<span style="color:#4caf50;">enabled</span> · sync every ${pt.sync_min}min`
: `<span style="color:#555;">disabled</span>`;
let ptHtml = `<div style="font-size:10px;color:#666;margin-bottom:10px;">${ptStatus}</div>`;
ptHosts.forEach(h => {
const dot = h.online === null ? '#555' : h.online ? '#4caf50' : '#f44336';
const label = h.online === null ? 'unknown' : h.online ? 'online' : 'offline';
const tags = [
h.is_me ? `<span style="background:#1a3a1a;color:#4caf50;font-size:8px;padding:1px 5px;border-radius:3px;margin-left:4px;">US</span>` : '',
h.is_owner ? `<span style="background:#1a2a3a;color:#4a9eff;font-size:8px;padding:1px 5px;border-radius:3px;margin-left:4px;">OWNER</span>` : '',
].join('');
ptHtml += `<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;">
<div>
<span style="font-size:10px;color:#555;margin-right:4px;">${h.id}</span>
<span style="font-size:12px;color:#ccc;font-weight:500;">${h.owner || h.hostname}</span>
${tags}
<div style="font-size:10px;color:#666;margin-top:1px;">${h.hostname}</div>
</div>
<div style="text-align:right;">
<span style="color:${dot};font-size:10px;">● ${label}</span>
</div>
</div>`;
});
document.getElementById('vv-partner-body').innerHTML = ptHtml;
// ── CPU ─────────────────────────────────────────────────────────────────
const cpu = d.cpu ?? {};
document.getElementById('vv-cpu-body').innerHTML = vvRenderCpu(cpu);