mirror of
https://github.com/zvx-echo6/central.git
synced 2026-05-22 02:24:38 +02:00
Add streams list and edit routes with live JetStream data:
- GET /streams: list all streams with live size/messages
- POST /streams/{name}: update max_age_s with validation
Features:
- Live data from JetStream (bytes, messages, timestamps)
- Graceful degradation when NATS unavailable
- Preset chip buttons (1d, 7d, 14d, 30d, 365d)
- Custom days input with Save button
- Current selection highlighted
- Managed by supervisor badge
- Audit logging with before/after max_age_s
Files:
- src/central/gui/audit.py: add STREAM_UPDATE constant
- src/central/gui/routes.py: add streams_list and streams_update handlers
- src/central/gui/templates/base.html: add Streams nav link
- src/central/gui/templates/streams_list.html: new template
- tests/test_streams.py: 9 tests covering all requirements
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.7 KiB
HTML
48 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" data-theme="light">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% block title %}Central{% endblock %}</title>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
|
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
|
{% block head %}{% endblock %}
|
|
</head>
|
|
<body>
|
|
<nav class="container">
|
|
<ul>
|
|
<li><strong>Central</strong></li>
|
|
</ul>
|
|
<ul>
|
|
{% if operator %}
|
|
<li><a href="/">Dashboard</a></li>
|
|
<li><a href="/adapters">Adapters</a></li>
|
|
<li><a href="/streams">Streams</a></li>
|
|
<li>{{ operator.username }}</li>
|
|
<li><a href="/change-password">Change Password</a></li>
|
|
<li>
|
|
<form action="/logout" method="post" style="margin: 0;">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button type="submit" class="outline">Logout</button>
|
|
</form>
|
|
</li>
|
|
{% else %}
|
|
<li><a href="/login">Login</a></li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
<main class="container">
|
|
{% if error %}
|
|
<article aria-label="Error">
|
|
<p style="color: var(--pico-color-red-500);">{{ error }}</p>
|
|
</article>
|
|
{% endif %}
|
|
{% if success %}
|
|
<article aria-label="Success">
|
|
<p style="color: var(--pico-color-green-500);">{{ success }}</p>
|
|
</article>
|
|
{% endif %}
|
|
{% block content %}{% endblock %}
|
|
</main>
|
|
</body>
|
|
</html>
|