165a202ba4
- Replace base.html style block with full CSS design system using custom properties (dark theme, cards, tables, badges, dots, widgets) - Add DNS blueprint (fablednetmon/dns/) with /dns/ and /dns/rows routes + templates - Add Traefik /widget route and widget.html fragment for dashboard - Update dashboard: DNS + Traefik widgets, traefik_enabled config detection - Update all templates to use new CSS classes (page-title, section-title, card-flush, table, badge-*, dot-*, btn-*) - Register dns_bp in app.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
123 lines
6.4 KiB
HTML
123 lines
6.4 KiB
HTML
{# fablednetmon/templates/settings/index.html #}
|
|
{% extends "base.html" %}
|
|
{% block title %}Settings — FabledNetMon{% endblock %}
|
|
{% block content %}
|
|
<h1 class="page-title">Settings</h1>
|
|
<form method="post" action="/settings/">
|
|
<div style="display:grid;gap:1.5rem;">
|
|
|
|
{# ── General ──────────────────────────────────────────────────────────── #}
|
|
<div class="card">
|
|
<h2 class="section-title" style="margin-bottom:1rem;">General</h2>
|
|
<div class="form-group">
|
|
<label>Session lifetime (hours)</label>
|
|
<input type="number" name="session.lifetime_hours" min="1" max="720"
|
|
value="{{ settings['session.lifetime_hours'] }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Data retention (days)</label>
|
|
<input type="number" name="data.retention_days" min="1"
|
|
value="{{ settings['data.retention_days'] }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Monitor poll interval (seconds)</label>
|
|
<input type="number" name="monitors.poll_interval_seconds" min="10"
|
|
value="{{ settings['monitors.poll_interval_seconds'] }}">
|
|
</div>
|
|
</div>
|
|
|
|
{# ── SMTP ─────────────────────────────────────────────────────────────── #}
|
|
<div class="card">
|
|
<h2 class="section-title" style="margin-bottom:1rem;">Email (SMTP)</h2>
|
|
<div class="form-group">
|
|
<label>SMTP host</label>
|
|
<input type="text" name="smtp.host" value="{{ settings['smtp.host'] }}" placeholder="mail.example.com">
|
|
</div>
|
|
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1rem;">
|
|
<div class="form-group">
|
|
<label>Port</label>
|
|
<input type="number" name="smtp.port" value="{{ settings['smtp.port'] }}">
|
|
</div>
|
|
<div class="form-group" style="display:flex;align-items:center;gap:0.5rem;padding-top:1.5rem;">
|
|
<input type="checkbox" name="smtp.tls" id="smtp-tls"
|
|
{% if settings['smtp.tls'] %}checked{% endif %}>
|
|
<label for="smtp-tls" style="margin:0;">Use TLS</label>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Username</label>
|
|
<input type="text" name="smtp.username" value="{{ settings['smtp.username'] }}" autocomplete="off">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Password <span style="color:#606080;font-size:0.8rem;">(leave blank to keep current)</span></label>
|
|
<input type="password" name="smtp.password" placeholder="••••••••" autocomplete="new-password">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Recipients <span style="color:#606080;font-size:0.8rem;">(comma-separated)</span></label>
|
|
<input type="text" name="smtp.recipients"
|
|
value="{{ settings['smtp.recipients'] | join(', ') }}"
|
|
placeholder="admin@example.com, ops@example.com">
|
|
</div>
|
|
</div>
|
|
|
|
{# ── Webhook ──────────────────────────────────────────────────────────── #}
|
|
<div class="card">
|
|
<h2 class="section-title" style="margin-bottom:1rem;">Webhook</h2>
|
|
<div class="form-group">
|
|
<label>Webhook URL <span style="color:#606080;font-size:0.8rem;">(leave blank to disable)</span></label>
|
|
<input type="text" name="webhook.url" value="{{ settings['webhook.url'] }}"
|
|
placeholder="https://discord.com/api/webhooks/...">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Payload template <span style="color:#606080;font-size:0.8rem;">(Jinja2, must produce valid JSON)</span></label>
|
|
<textarea name="webhook.template" rows="3" style="font-family:ui-monospace,monospace;font-size:0.85rem;">{{ settings['webhook.template'] }}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
{# ── Ansible Sources ──────────────────────────────────────────────────── #}
|
|
<div class="card">
|
|
<h2 class="section-title" style="margin-bottom:1rem;">Ansible Sources</h2>
|
|
<p style="color:#606080;font-size:0.85rem;margin-bottom:0.75rem;">JSON array of source objects. Each requires <code>name</code>, <code>type</code> (git or local), and either <code>url</code> or <code>path</code>.</p>
|
|
<textarea name="ansible.sources" rows="8" style="font-family:ui-monospace,monospace;font-size:0.85rem;">{{ settings['ansible.sources'] | tojson(indent=2) }}</textarea>
|
|
</div>
|
|
|
|
{# ── Plugins ──────────────────────────────────────────────────────────── #}
|
|
{% if discovered_plugins %}
|
|
<div class="card">
|
|
<h2 class="section-title" style="margin-bottom:1rem;">Plugins</h2>
|
|
{% for plugin in discovered_plugins %}
|
|
<div style="border:1px solid #2a2a4a;border-radius:4px;padding:1rem;margin-bottom:0.75rem;">
|
|
<div style="display:flex;align-items:center;gap:0.75rem;margin-bottom:0.75rem;">
|
|
<input type="checkbox" name="plugin.{{ plugin._dir }}.enabled"
|
|
id="plugin-{{ plugin._dir }}-enabled"
|
|
{% if plugin._enabled %}checked{% endif %}>
|
|
<label for="plugin-{{ plugin._dir }}-enabled"
|
|
style="margin:0;font-weight:bold;color:#c0c0e0;">
|
|
{{ plugin.get('name', plugin._dir) }}
|
|
<span style="color:#606080;font-size:0.8rem;font-weight:normal;">
|
|
v{{ plugin.get('version', '?') }} — {{ plugin.get('description', '') }}
|
|
</span>
|
|
</label>
|
|
</div>
|
|
{% for cfg_key, cfg_default in plugin.get('config', {}).items() %}
|
|
<div class="form-group" style="margin-left:1.5rem;">
|
|
<label style="font-size:0.85rem;">{{ cfg_key }}</label>
|
|
<input type="text" name="plugin.{{ plugin._dir }}.{{ cfg_key }}"
|
|
value="{{ plugin._config.get(cfg_key, cfg_default) }}">
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
<div style="margin-top:1.5rem;">
|
|
<button type="submit" class="btn">Save Settings</button>
|
|
<span style="color:#606080;font-size:0.85rem;margin-left:1rem;">
|
|
Changes take effect immediately. Monitor interval, plugin enable/disable require a restart.
|
|
</span>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|