Files
family_home_lab/portal/templates/admin_pi.html

55 lines
2.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Pi Dashboard — {{ settings.APP_NAME }}{% endblock %}
{% block content %}
<div class="page">
<div style="display:flex;align-items:center;justify-content:space-between;gap:12px">
<h1 class="greeting">Pi Dashboard</h1>
<a class="button-utility" href="/admin">← Admin</a>
</div>
<p class="muted" style="max-width:720px">
Agent sessions synced from the pi host (<code>{{ sessions|length }}</code> known).
<br>Directory (portal view): <code><strong>{{ pi_dir }}</strong></code> — mounted from <code>/mnt/data/family-home-lab/pi-dashboard</code> on .13, synced from <code>~/.pi/agent/dashboard</code> on the pi host.
</p>
<div class="admin-panel">
<section class="stack">
<h2 class="section-title">Sessions</h2>
{% if sessions %}
<div class="table-wrap">
<table class="user-table">
<thead>
<tr>
<th>Session</th><th>Directory</th><th>Machine</th><th>Status</th><th>Model</th>
<th>Last tool</th><th>Last seen</th><th>Cost</th>
</tr>
</thead>
<tbody>
{% for s in sessions %}
<tr>
<td><strong>{{ s.get("session") or s.get("connection_name") or "?" }}</strong></td>
<td class="faint" title="{{ s.get('cwd', '') }}"><code style="font-size:11px">{{ s.get("cwd", "—") or "—" }}</code></td>
<td class="faint">{{ s.get("machine", "?") }}</td>
<td>
{% set st = s.get("status", "") %}
{% if st == "idle" %}<span class="badge">idle</span>
{% elif st == "busy" or st == "working" %}<span class="badge badge-admin">busy</span>
{% else %}<span class="badge badge-{{ st }}">{{ st }}</span>{% endif %}
</td>
<td class="faint">{{ s.get("model", "?") }}</td>
<td class="faint">{{ s.get("last_tool", "—") }}</td>
<td class="faint">
{% if s.get("last_seen_at") %} {{ s["last_seen_at"][:19].replace("T"," ") }} {% else %} — {% endif %}
</td>
<td class="faint">${{ "%.2f"|format(s.get("cost_estimate") or 0) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="faint">No pi dashboard files found in <code>{{ pi_dir }}</code>. Run the sync script on the pi host to populate it.</p>
{% endif %}
</section>
</div>
</div>
{% endblock %}