pfannkuchen/stream-control/templates/dashboard.html

58 lines
5 KiB
HTML

{% extends 'base.html' %}{% block content %}
{% set limits=state.get('limits',{}) %}{% set tc=state.get('tc',{}) %}{% set policy=state.get('policy',{}) %}
<section class="kpi-grid">
<article class="kpi"><span>REGION-PROFIL</span><strong>{{ limits.get('ch','—') }} Mbit</strong><small>tc: {{ tc.get('ch','—') }} Mbit</small></article>
<article class="kpi"><span>CLOUD-PROFIL</span><strong>{{ limits.get('vpn','—') }} Mbit</strong><small>tc: {{ tc.get('vpn','—') }} Mbit</small></article>
<article class="kpi"><span>SESSIONS</span><strong>{{ state.get('active_sessions','—') }}</strong><small>{{ state.get('active_blocks',0) }} aktive Sperren</small></article>
<article class="kpi"><span>POLICY</span><strong>{{ ('AUS' if not policy.get('enabled') else policy.get('mode','—')|upper) }}</strong><small>ab {{ policy.get('min_sessions','—') }} Streams</small></article>
</section>
<section class="panel"><div class="panel-head"><div><p class="eyebrow">SCHNELLWAHL</p><h2>Traffic-Profile</h2></div><small>Wirkt sofort auf die aktiven tc-Klassen am OVH</small></div>
<div class="profile-grid control-profiles">
{% for key,p in profiles.items() %}
<form method="post" action="{{ url_for('apply_profile',name=key) }}" class="profile-card" style="--accent:{{ p.color }}">
<input type="hidden" name="csrf" value="{{ csrf_token() }}"><span class="profile-dot"></span><h3>{{ p.label }}</h3><strong>{{ p.ch }} / {{ p.vpn }} Mbit</strong><small>Region / Cloud</small><button type="submit">Aktivieren</button>
</form>
{% endfor %}
</div>
</section>
<section class="grid two">
<article class="panel"><div class="panel-head"><div><p class="eyebrow">MANUELL</p><h2>Bandbreiten</h2></div></div>
<form method="post" action="{{ url_for('custom_limits') }}" class="form-grid compact-form">
<input type="hidden" name="csrf" value="{{ csrf_token() }}">
<label>Region Mbit<input type="number" name="ch" min="0.1" max="100" step="0.1" value="{{ limits.get('ch',1) }}" required></label>
<label>Cloud Mbit<input type="number" name="vpn" min="0.1" max="100" step="0.1" value="{{ limits.get('vpn',1) }}" required></label>
<button class="full" type="submit">Limits anwenden</button>
</form>
</article>
<article class="panel"><div class="panel-head"><div><p class="eyebrow">SESSION POLICY</p><h2>Mehrfachnutzung</h2></div></div>
<form method="post" action="{{ url_for('policy') }}" class="form-grid compact-form">
<input type="hidden" name="csrf" value="{{ csrf_token() }}">
<label>Modus<select name="mode"><option value="off" {{ 'selected' if not policy.get('enabled') }}>Aus</option><option value="monitor" {{ 'selected' if policy.get('enabled') and policy.get('mode')=='monitor' }}>Nur beobachten</option><option value="block" {{ 'selected' if policy.get('enabled') and policy.get('mode')=='block' }}>Blockieren</option></select></label>
<label>Ab Streams<input type="number" name="min_sessions" min="2" max="8" value="{{ policy.get('min_sessions',2) }}"></label>
<label>Sperre Minuten<input type="number" name="block_minutes" min="1" max="1440" value="{{ policy.get('block_minutes',10) }}"></label>
<button class="full" type="submit">Policy speichern</button>
</form>
</article>
</section>
<section class="grid two">
<article class="panel"><div class="panel-head"><div><p class="eyebrow">RUNTIME</p><h2>Dienste & Regeln</h2></div></div>
<div class="table-wrap"><table><tbody>
{% for name,status in state.get('services',{}).items() %}<tr><td>{{ name }}</td><td><span class="badge {{ 'active' if status=='active' else 'danger' }}">{{ status }}</span></td></tr>{% endfor %}
<tr><td>Markierungsregeln</td><td><strong>{{ state.get('mark_rules','—') }}</strong></td></tr>
<tr><td>Region-Netze</td><td><strong>{{ state.get('ipsets',{}).get('geo-a-v4',0)+state.get('ipsets',{}).get('geo-a-v6',0) }}</strong></td></tr>
<tr><td>Cloud-Netze</td><td><strong>{{ state.get('ipsets',{}).get('cloud-v4',0)+state.get('ipsets',{}).get('cloud-v6',0) }}</strong></td></tr>
</tbody></table></div>
<div class="action-row">
{% for action,label,cls in [('refresh','Netzlisten aktualisieren','ghost'),('worker','Worker neu starten','ghost'),('admin','Admin neu starten','ghost')] %}<form method="post" action="{{ url_for('maintenance',action=action) }}"><input type="hidden" name="csrf" value="{{ csrf_token() }}"><button class="{{ cls }}">{{ label }}</button></form>{% endfor %}
</div>
</article>
<article class="panel"><div class="panel-head"><div><p class="eyebrow">EREIGNISSE</p><h2>Letzte Policy-Aktionen</h2></div></div>
<div class="event-list">{% for e in state.get('recent_events',[]) %}<div class="event"><span class="event-kind">{{ e.kind }}</span><div><strong>{{ e.user_name or 'System' }}</strong><small>{{ e.detail }}</small></div></div>{% else %}<p class="muted">Keine Ereignisse vorhanden.</p>{% endfor %}</div>
</article>
</section>
{% if state.get('error') %}<div class="notice error"><strong>!</strong><p>{{ state.error }}</p></div>{% endif %}
{% endblock %}