Files
checkbot/app/web/retention_section.py
patrickandClaude Sonnet 5.5 f34fc6d686 feat: Ausgangslog für Messenger-Nachrichten
- LoggingAdapter protokolliert send/edit (Matrix zusätzlich reply) inkl. Fehlversuche
- Tabelle outbound_log (Migration 10), Aufbewahrung retention.outbound_days (30 Tage)
- Seite /messages und CLI checkbot messages mit Filtern
- Text gekappt (4000) und Secrets maskiert

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 23:38:07 +01:00

44 lines
1.2 KiB
Python

from ..retention import COUNT_KEYS, SETTINGS, validate_values
from .sections import Field, Section
SLUG = "retention"
RUN_PATH = "/retention/run"
COUNT_LABELS = {
"alerts": "Alarme",
"deliveries": "Zustellungen",
"agent_runs": "Agenten-Läufe",
"state_log": "Statusverlauf",
"audit": "Audit-Einträge",
"mutes": "Stummschaltungen",
"outbound_log": "Ausgangslog-Einträge",
}
def format_counts(counts: dict[str, int]) -> str:
return ", ".join(f"{COUNT_LABELS[key]}: {counts.get(key, 0)}" for key in COUNT_KEYS)
def context(state) -> dict:
last = state.runtime.retention.last_run()
return {
"retention_last": last,
"retention_counts": format_counts(last.counts) if last else "",
"retention_settings": SETTINGS,
"retention_run_path": RUN_PATH,
}
SECTION = Section(
slug=SLUG,
title="Aufbewahrung",
fields=tuple(
Field(s.key, f"{s.label} in Tagen ({s.minimum} bis {s.maximum})", default=str(s.default),
placeholder=f"{s.minimum} bis {s.maximum}")
for s in SETTINGS
),
validate=validate_values,
optional=True,
extra_template="_retention_extra.html",
extra_context=context,
)