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) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-13 11:13:09 -04:00
parent 4e018feaa0
commit 6de19fd250
2 changed files with 21 additions and 13 deletions

View File

@@ -373,12 +373,24 @@ def blancco_reports():
# negligible at fleet sizes). # negligible at fleet sizes).
serial = "" serial = ""
model = "" model = ""
state = ""
if ext == ".xml": if ext == ".xml":
try: try:
data = blancco_report.parse(fpath) data = blancco_report.parse(fpath)
sysinfo = (data.get("hardware") or {}).get("system") or {} sysinfo = (data.get("hardware") or {}).get("system") or {}
serial = sysinfo.get("serial", "") or "" serial = sysinfo.get("serial", "") or ""
model = sysinfo.get("model", "") 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: except Exception:
pass pass
reports.append({ reports.append({
@@ -388,6 +400,7 @@ def blancco_reports():
"type": ext.lstrip(".").upper() or "FILE", "type": ext.lstrip(".").upper() or "FILE",
"serial": serial, "serial": serial,
"model": model, "model": model,
"state": state,
}) })
return render_template( return render_template(
"reports.html", "reports.html",

View File

@@ -16,30 +16,25 @@
<table class="table table-hover mb-0"> <table class="table table-hover mb-0">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th>Filename</th>
<th>Serial</th> <th>Serial</th>
<th>Model</th> <th>Model</th>
<th>Type</th>
<th>Size</th>
<th>Date</th> <th>Date</th>
<th>Result</th>
<th class="text-end">Actions</th> <th class="text-end">Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for r in reports %} {% for r in reports %}
<tr> <tr title="{{ r.filename }}">
<td><code>{{ r.filename }}</code></td>
<td>{% if r.serial %}<code>{{ r.serial }}</code>{% else %}<span class="text-muted small">-</span>{% endif %}</td> <td>{% if r.serial %}<code>{{ r.serial }}</code>{% else %}<span class="text-muted small">-</span>{% endif %}</td>
<td class="small">{{ r.model or '-' }}</td> <td class="small">{{ r.model or '-' }}</td>
<td><span class="badge bg-info text-dark">{{ r.type }}</span></td>
<td>
{% if r.size > 1048576 %}
{{ "%.1f"|format(r.size / 1048576) }} MB
{% else %}
{{ "%.1f"|format(r.size / 1024) }} KB
{% endif %}
</td>
<td>{{ r.modified | timestamp_fmt }}</td> <td>{{ r.modified | timestamp_fmt }}</td>
<td>
{% if r.state == 'Successful' %}<span class="badge bg-success">Successful</span>
{% elif r.state == 'Failed' %}<span class="badge bg-danger">Failed</span>
{% elif r.state %}<span class="badge bg-secondary">{{ r.state }}</span>
{% else %}<span class="text-muted small">-</span>{% endif %}
</td>
<td class="text-end text-nowrap"> <td class="text-end text-nowrap">
{% if r.filename.lower().endswith('.xml') %} {% if r.filename.lower().endswith('.xml') %}
<a href="{{ url_for('blancco_view_report', filename=r.filename) }}" <a href="{{ url_for('blancco_view_report', filename=r.filename) }}"