a7a281cb11
First-party plugins (host_agent, http, snmp, traefik, unifi, docker) are now tracked under plugins/ and baked into the image, so they version atomically with core — ending the cross-repo import drift the roundtable->steward rename exposed. History for these files is preserved in the archived Roundtable-plugins repo. Plugin discovery becomes multi-root: PLUGIN_DIR (single) -> PLUGIN_DIRS (bundled first, then external) + PLUGIN_INSTALL_DIR. Bundled ships in the image; third-party plugins still mount at runtime into the external root (STEWARD_PLUGIN_DIR, default /data/plugins) and downloads/installs land there. Bundled shadows external on a name collision. - config.py: load_bootstrap returns plugin_dirs + plugin_install_dir - app.py: iterate PLUGIN_DIRS at the migration + load sites - migration_runner.py: discover_all_in() unions every plugin root - plugin_manager.py: resolve_plugin_path() (pure, first-root-wins); load / install / hot-reload span all roots; installs target the external root - settings/routes.py: _discover_plugins scans all roots, dedup bundled-first - Dockerfile: COPY plugins/ ; docker-compose: drop host bind, document external - tests/test_plugin_dirs.py: resolution, multi-root discovery, bootstrap split Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
96 lines
3.9 KiB
HTML
96 lines
3.9 KiB
HTML
{# plugins/unifi/templates/unifi/widget.html #}
|
|
|
|
{# Active alarms #}
|
|
{% for al in active_alarms %}
|
|
<div style="display:flex;justify-content:space-between;font-size:0.8rem;color:var(--red);padding:0.15rem 0;">
|
|
<span>⚠ {{ al.alarm_key }}</span>
|
|
<span style="color:var(--text-dim);font-size:0.75rem;">alarm</span>
|
|
</div>
|
|
{% endfor %}
|
|
{# Offline device alerts #}
|
|
{% for d in offline_devices %}
|
|
<div style="display:flex;justify-content:space-between;font-size:0.8rem;color:var(--red);padding:0.15rem 0;">
|
|
<span>⚠ {{ d.name or d.mac }}</span>
|
|
<span>offline</span>
|
|
</div>
|
|
{% endfor %}
|
|
{% if active_alarms or offline_devices %}<div style="height:0.4rem;"></div>{% endif %}
|
|
|
|
{% if latest_wan %}
|
|
<div class="ping-row">
|
|
<div class="ping-meta">
|
|
<span class="ping-name" style="font-size:0.8rem;">WAN</span>
|
|
</div>
|
|
<div style="flex:1;display:flex;gap:1.5rem;font-size:0.82rem;font-variant-numeric:tabular-nums;">
|
|
<span style="color:{% if latest_wan.is_up %}var(--green){% else %}var(--red){% endif %};">
|
|
{% if latest_wan.is_up %}Up{% else %}Down{% endif %}
|
|
</span>
|
|
{% if latest_wan.latency_ms is not none %}
|
|
<span>
|
|
<span style="color:var(--text-muted);">lat</span>
|
|
<span style="margin-left:0.2rem;{% if latest_wan.latency_ms > 100 %}color:var(--red){% elif latest_wan.latency_ms > 50 %}color:var(--yellow){% endif %};">
|
|
{{ "%.0f"|format(latest_wan.latency_ms) }}ms
|
|
</span>
|
|
</span>
|
|
{% endif %}
|
|
{% if latest_wan.rx_bytes_rate is not none %}
|
|
<span>
|
|
<span style="color:var(--text-muted);">↓</span>
|
|
{% set bps = latest_wan.rx_bytes_rate %}
|
|
{% if bps >= 1048576 %}{{ "%.1f"|format(bps / 1048576) }}MB/s
|
|
{% elif bps >= 1024 %}{{ "%.0f"|format(bps / 1024) }}KB/s
|
|
{% else %}{{ "%.0f"|format(bps) }}B/s{% endif %}
|
|
</span>
|
|
<span>
|
|
<span style="color:var(--text-muted);">↑</span>
|
|
{% set bps = latest_wan.tx_bytes_rate %}
|
|
{% if bps >= 1048576 %}{{ "%.1f"|format(bps / 1048576) }}MB/s
|
|
{% elif bps >= 1024 %}{{ "%.0f"|format(bps / 1024) }}KB/s
|
|
{% else %}{{ "%.0f"|format(bps) }}B/s{% endif %}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if latest_clients %}
|
|
<div class="ping-row">
|
|
<div class="ping-meta">
|
|
<span class="ping-name" style="font-size:0.8rem;">Clients</span>
|
|
</div>
|
|
<div style="flex:1;display:flex;gap:1rem;font-size:0.82rem;">
|
|
<span style="font-weight:600;">{{ latest_clients.total_clients }}</span>
|
|
<span style="color:var(--text-muted);">{{ latest_clients.wireless_clients }}w / {{ latest_clients.wired_clients }}e</span>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if top_clients %}
|
|
<div style="margin-top:0.4rem;border-top:1px solid var(--border);padding-top:0.4rem;">
|
|
{% for c in top_clients %}
|
|
<div class="ping-row" style="padding:0.1rem 0;">
|
|
<div class="ping-meta" style="min-width:0;flex:1;">
|
|
<span style="font-size:0.78rem;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{ c.hostname }}</span>
|
|
</div>
|
|
<div style="font-size:0.78rem;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--text-muted);">
|
|
{% set total_bps = c.tx_rate + c.rx_rate %}
|
|
<span style="color:var(--text-muted);">↓</span>
|
|
{% set rx = c.rx_rate %}
|
|
{% if rx >= 1048576 %}{{ "%.1f"|format(rx / 1048576) }}M
|
|
{% elif rx >= 1024 %}{{ "%.0f"|format(rx / 1024) }}K
|
|
{% else %}{{ "%.0f"|format(rx) }}B{% endif %}
|
|
<span style="color:var(--text-muted);margin-left:0.4rem;">↑</span>
|
|
{% set tx = c.tx_rate %}
|
|
{% if tx >= 1048576 %}{{ "%.1f"|format(tx / 1048576) }}M
|
|
{% elif tx >= 1024 %}{{ "%.0f"|format(tx / 1024) }}K
|
|
{% else %}{{ "%.0f"|format(tx) }}B{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not latest_wan and not latest_clients and not active_alarms and not offline_devices %}
|
|
<p class="empty" style="padding:0.5rem 0;font-size:0.85rem;">No UniFi data yet.</p>
|
|
{% endif %}
|