diff --git a/.last-branch b/.last-branch index ac95a8e..cd87137 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260109-03-preserve-ampersand-errors +v20260109-04-parsers-page-all-parsers diff --git a/containers/backupchecks/src/backend/app/main/routes_parsers.py b/containers/backupchecks/src/backend/app/main/routes_parsers.py index ec6920b..b9ee6f4 100644 --- a/containers/backupchecks/src/backend/app/main/routes_parsers.py +++ b/containers/backupchecks/src/backend/app/main/routes_parsers.py @@ -1,106 +1,16 @@ from .routes_shared import * # noqa: F401,F403 +# Keep the parser overview page in sync with the actual parser registry. +from app.parsers.registry import PARSER_DEFINITIONS + @main_bp.route("/parsers") @login_required @roles_required("admin") def parsers_overview(): - # Only show what is currently implemented in code. - # Currently implemented parsers: - # - 3CX (Backup Complete notifications) - # - Veeam (status mails in multiple variants) - parsers = [ - { - "name": "3CX backup complete", - "backup_software": "3CX", - "backup_types": [], - "order": 10, - "enabled": True, - "match": { - "subject_regex": r"^3CX Notification:\\s*Backup Complete\\s*-\\s*(.+)$", - }, - "description": "Parses 3CX backup notifications (Backup Complete).", - "examples": [ - { - "subject": "3CX Notification: Backup Complete - PBX01", - "from_address": "noreply@3cx.local", - "body_snippet": "Backup name: PBX01_2025-12-17.zip", - "parsed_result": { - "backup_software": "3CX", - "backup_type": "", - "job_name": "PBX01", - "objects": [ - { - "name": "PBX01_2025-12-17.zip", - "status": "Success", - "error_message": "", - } - ], - }, - } - ], - }, - { - "name": "3CX SSL certificate renewal", - "backup_software": "3CX", - "backup_types": ["SSL Certificate"], - "order": 11, - "enabled": True, - "match": { - "subject_regex": r"^3CX Notification:\\s*SSL Certificate Renewal\\s*-\\s*(.+)$", - }, - "description": "Parses 3CX SSL certificate renewal notifications (informational) so they are tracked and included in reporting.", - "examples": [], - }, - { - "name": "Veeam status mails", - "backup_software": "Veeam", - "backup_types": [ - "Backup Job", - "Backup Copy Job", - "Replica Job", - "Replication job", - "Configuration Backup", - "Agent Backup job", - "Veeam Backup for Microsoft 365", - "Scale Out Back-up Repository", - ], - "order": 20, - "enabled": True, - "match": { - "subject_regex": r"\\[(Success|Warning|Failed)\\]\\s*(.+)$", - }, - "description": "Parses Veeam status mails. Job name/type are preferably extracted from the HTML header to avoid subject suffix noise.", - "examples": [ - { - "subject": "[Warning] Daily-VM-Backup (3 objects) 1 warning", - "from_address": "veeam@customer.local", - "body_snippet": "Backup job: Daily-VM-Backup\\n...", - "parsed_result": { - "backup_software": "Veeam", - "backup_type": "Backup job", - "job_name": "Daily-VM-Backup", - "objects": [ - {"name": "VM-APP01", "status": "Success", "error_message": ""}, - {"name": "VM-DB01", "status": "Warning", "error_message": "Low disk space"}, - ], - }, - }, - { - "subject": "[Success] Offsite-Repository", - "from_address": "veeam@customer.local", - "body_snippet": "Backup Copy job: Offsite-Repository\\n...", - "parsed_result": { - "backup_software": "Veeam", - "backup_type": "Backup Copy job", - "job_name": "Offsite-Repository", - "objects": [ - {"name": "Backup Copy Chain", "status": "Success", "error_message": ""} - ], - }, - }, - ], - }, - ] + parsers = sorted( + PARSER_DEFINITIONS, + key=lambda p: (p.get("order", 9999), p.get("backup_software", ""), p.get("name", "")), + ) return render_template( "main/parsers.html", diff --git a/docs/changelog.md b/docs/changelog.md index 2b9212f..6148504 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -22,6 +22,15 @@ - Decode HTML entities (e.g. &) in parsed object fields (name/type/status/error_message) before storing them. - Ensures ampersands and other entities are displayed correctly in the UI error messages. +--- + +## v20260109-04-parsers-page-all-parsers + +- Updated the Parsers overview page to use the central parser registry instead of a static list. +- All currently available parsers are now automatically displayed on the page. +- Ensures the Parsers page stays in sync with newly added or removed parsers without manual template updates. +- Improved maintainability by removing hardcoded parser definitions from the template. + ================================================================================================================================================ ## v0.1.19 This release delivers a broad set of improvements focused on reliability, transparency, and operational control across mail processing, administrative auditing, and Run Checks workflows. The changes aim to make message handling more robust, provide better insight for administrators, and give operators clearer and more flexible control when reviewing backup runs.