From 6de19fd250a8ba07a5078f892f09470a548d3cb0 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Wed, 13 May 2026 11:13:09 -0400 Subject: [PATCH] webapp/reports: trim list to Serial/Model/Date/Result Drops the filename, type, and size columns from the Blancco Reports list - operators want bay-identification fields, not file metadata. Filename moves to a row hover tooltip (title attribute) so it is still recoverable for ad-hoc lookups. Adds a Result column derived from each XML report's overall erasure state: * Successful -> green badge (all erasure entries report Successful) * Failed -> red badge (any erasure entry reports a non-Successful state) * other -> grey badge with the verbatim state * blank/non-XML -> dash The state roll-up lives in the blancco_reports route's per-file parse loop next to the existing serial/model extraction. Co-Authored-By: Claude Opus 4.7 (1M context) --- webapp/app.py | 13 +++++++++++++ webapp/templates/reports.html | 21 ++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/webapp/app.py b/webapp/app.py index 3b13850..aeb44c7 100644 --- a/webapp/app.py +++ b/webapp/app.py @@ -373,12 +373,24 @@ def blancco_reports(): # negligible at fleet sizes). serial = "" model = "" + state = "" if ext == ".xml": try: data = blancco_report.parse(fpath) sysinfo = (data.get("hardware") or {}).get("system") or {} serial = sysinfo.get("serial", "") or "" model = sysinfo.get("model", "") or "" + # Overall erasure result: each erasure entry has its own + # 'state' (Successful / Failed / ...). If any drive failed + # the report rolls up to Failed; otherwise Successful. + erasures = data.get("erasures") or [] + states = [(e.get("state") or "").strip() for e in erasures if e.get("state")] + if not states: + state = "" + elif any(s.lower() != "successful" for s in states): + state = "Failed" + else: + state = "Successful" except Exception: pass reports.append({ @@ -388,6 +400,7 @@ def blancco_reports(): "type": ext.lstrip(".").upper() or "FILE", "serial": serial, "model": model, + "state": state, }) return render_template( "reports.html", diff --git a/webapp/templates/reports.html b/webapp/templates/reports.html index b42e5bf..7632001 100644 --- a/webapp/templates/reports.html +++ b/webapp/templates/reports.html @@ -16,30 +16,25 @@ - - - + {% for r in reports %} - - + - - +
Filename Serial ModelTypeSize DateResult Actions
{{ r.filename }}
{% if r.serial %}{{ r.serial }}{% else %}-{% endif %} {{ r.model or '-' }}{{ r.type }} - {% if r.size > 1048576 %} - {{ "%.1f"|format(r.size / 1048576) }} MB - {% else %} - {{ "%.1f"|format(r.size / 1024) }} KB - {% endif %} - {{ r.modified | timestamp_fmt }} + {% if r.state == 'Successful' %}Successful + {% elif r.state == 'Failed' %}Failed + {% elif r.state %}{{ r.state }} + {% else %}-{% endif %} + {% if r.filename.lower().endswith('.xml') %}