Rename unspecified coverage table title

This commit is contained in:
2026-05-31 07:47:07 +02:00
parent 95ef28065a
commit c0933bc3a1
5 changed files with 19 additions and 4 deletions
+1
View File
@@ -137,6 +137,7 @@ Backup tables are grouped under a level 1 title `VM/CT backups`.
VM/CT are displayed in multiple tables, one table per namespace.
The title of each table indicates the relevant namespace.
When the namespace is not specified, the table is titled `VM/CT without backup`.
Expected columns:
+1
View File
@@ -137,6 +137,7 @@ Les tableaux de sauvegarde sont regroupes sous un titre de niveau 1 `Sauvegarde
Les VM/CT sont affichees dans plusieurs tableaux, un tableau par namespace.
Le titre de chaque tableau indique la namespace concernee.
Lorsque la namespace n'est pas renseignee, le tableau est titre `VM/CT non sauvegardée`.
Colonnes attendues :
+2
View File
@@ -82,6 +82,7 @@ TRANSLATIONS = {
"missing_guests": "VM/CT non sauvegardees",
"coverage_group": "Sauvegarde des VM/CT",
"coverage_title": "Sauvegarde des VM/CT - {namespace}",
"coverage_unspecified_title": "VM/CT non sauvegardée",
"retention_group": "Retention des sauvegardes VM/CT",
"retention_title": "Retention des sauvegardes VM/CT {server_name} - {namespace}",
"issues": "Anomalies",
@@ -116,6 +117,7 @@ TRANSLATIONS = {
"missing_guests": "VM/CT without backup",
"coverage_group": "VM/CT backups",
"coverage_title": "VM/CT backups - {namespace}",
"coverage_unspecified_title": "VM/CT without backup",
"retention_group": "VM/CT backup retention",
"retention_title": "VM/CT backup retention {server_name} - {namespace}",
"issues": "Anomalies",
+8 -4
View File
@@ -345,9 +345,7 @@ def build_coverage_sections(
return [
ReportSection(
section_id="sauvegarde-vmct",
title=translator.text("coverage_title").format(
namespace=translator.cell("non renseigne")
),
title=coverage_section_title("non renseigne", translator),
headers=coverage_headers_without_namespace(translator),
rows=[],
empty_message=translator.text("no_guest"),
@@ -374,7 +372,7 @@ def build_coverage_sections(
sections.append(
ReportSection(
section_id=f"sauvegarde-vmct-{section_id_fragment(namespace)}",
title=translator.text("coverage_title").format(namespace=translator.cell(namespace)),
title=coverage_section_title(namespace, translator),
headers=coverage_headers_without_namespace(translator),
rows=rows,
empty_message=translator.text("no_guest"),
@@ -384,6 +382,12 @@ def build_coverage_sections(
return sections
def coverage_section_title(namespace: str, translator: Translator) -> str:
if namespace == "non renseigne":
return translator.text("coverage_unspecified_title")
return translator.text("coverage_title").format(namespace=translator.cell(namespace))
def coverage_headers_without_namespace(translator: Translator) -> list[str]:
return translator.row([
"VMID",
+7
View File
@@ -13,7 +13,9 @@ from pve_backup_report.models import (
ReportData,
ReportSummary,
)
from pve_backup_report.i18n import Translator
from pve_backup_report.report_weasy_pdf import build_template_context
from pve_backup_report.report_weasy_pdf import coverage_section_title
from pve_backup_report.report_weasy_pdf import render_html
@@ -235,6 +237,11 @@ def test_render_html_keeps_css_unescaped() -> None:
assert '<h1 class="section-group-title">Retention des sauvegardes VM/CT</h1>' not in html
def test_coverage_section_title_renames_unspecified_namespace() -> None:
assert coverage_section_title("non renseigne", Translator("fr")) == "VM/CT non sauvegardée"
assert coverage_section_title("serveurs", Translator("fr")) == "Sauvegarde des VM/CT - serveurs"
def test_render_html_supports_english_labels() -> None:
report_data = ReportData(
coverage=[