nas-burnin/app/templates/stats.html
Brandon Walter a8a7d99621
Some checks are pending
Security scan / pip-audit (push) Waiting to run
Security scan / bandit (push) Waiting to run
Security scan / gitleaks (push) Waiting to run
Security scan / mypy (push) Waiting to run
rename: TrueNAS Burn-In → NAS Burn-In (1.0.0-38)
Product display name only — page titles, headers, email, browser
notification, FastAPI app title. Repo, container_name, file paths,
and infrastructure identifiers (truenas-burnin everywhere) stay put
to avoid breaking deployment.
2026-05-03 14:01:40 -04:00

183 lines
6.3 KiB
HTML

{% extends "layout.html" %}
{% block title %}NAS Burn-In — Stats{% endblock %}
{% block content %}
<div class="page-toolbar">
<h1 class="page-title">Analytics</h1>
<div class="toolbar-right">
<span class="page-subtitle">{{ drives_total }} drives tracked</span>
</div>
</div>
<!-- Overall stat cards -->
<div class="stats-row" style="margin-bottom:24px">
<div class="overview-card">
<span class="ov-value">{{ overall.total or 0 }}</span>
<span class="ov-label">Total Jobs</span>
</div>
<div class="overview-card ov-green">
<span class="ov-value">{{ overall.passed or 0 }}</span>
<span class="ov-label">Passed</span>
</div>
<div class="overview-card ov-red">
<span class="ov-value">{{ overall.failed or 0 }}</span>
<span class="ov-label">Failed</span>
</div>
<div class="overview-card ov-blue">
<span class="ov-value">{{ overall.running or 0 }}</span>
<span class="ov-label">Running</span>
</div>
<div class="overview-card ov-gray">
<span class="ov-value">{{ overall.cancelled or 0 }}</span>
<span class="ov-label">Cancelled</span>
</div>
{% if overall.total and overall.total > 0 %}
<div class="overview-card ov-green">
<span class="ov-value">{{ "%.0f" | format(100 * (overall.passed or 0) / overall.total) }}%</span>
<span class="ov-label">Pass Rate</span>
</div>
{% endif %}
</div>
<div class="stats-grid">
<!-- Failure rate by model -->
<div class="stats-section">
<h2 class="section-title">Results by Drive Model</h2>
{% if by_model %}
<div class="table-wrap" style="max-height:none">
<table>
<thead>
<tr>
<th>Model</th>
<th style="text-align:right">Total</th>
<th style="text-align:right">Passed</th>
<th style="text-align:right">Failed</th>
<th style="text-align:right">Pass Rate</th>
<th style="min-width:120px">Rate Bar</th>
</tr>
</thead>
<tbody>
{% for m in by_model %}
<tr>
<td style="font-weight:500;color:var(--text-strong)">{{ m.model }}</td>
<td class="mono text-muted" style="text-align:right">{{ m.total }}</td>
<td class="mono" style="text-align:right;color:var(--green)">{{ m.passed }}</td>
<td class="mono" style="text-align:right;color:{% if m.failed > 0 %}var(--red){% else %}var(--text-muted){% endif %}">{{ m.failed }}</td>
<td class="mono" style="text-align:right;font-weight:600;color:{% if (m.pass_rate or 0) >= 90 %}var(--green){% elif (m.pass_rate or 0) >= 70 %}var(--yellow){% else %}var(--red){% endif %}">
{{ m.pass_rate or 0 }}%
</td>
<td>
<div class="rate-bar-wrap">
<div class="rate-bar-fill rate-pass" style="width:{{ m.pass_rate or 0 }}%"></div>
<div class="rate-bar-fill rate-fail" style="width:{{ 100 - (m.pass_rate or 0) }}%"></div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="empty-state" style="border:1px solid var(--border);border-radius:8px;padding:32px">
No completed burn-in jobs yet.
</div>
{% endif %}
</div>
<!-- Activity last 14 days -->
<div class="stats-section">
<h2 class="section-title">Activity — Last 14 Days</h2>
{% if by_day %}
<div class="table-wrap" style="max-height:none">
<table>
<thead>
<tr>
<th>Date</th>
<th style="text-align:right">Total</th>
<th style="text-align:right">Passed</th>
<th style="text-align:right">Failed</th>
</tr>
</thead>
<tbody>
{% for d in by_day %}
<tr>
<td class="mono text-muted">{{ d.day }}</td>
<td class="mono" style="text-align:right;color:var(--text-strong)">{{ d.total }}</td>
<td class="mono" style="text-align:right;color:var(--green)">{{ d.passed }}</td>
<td class="mono" style="text-align:right;color:{% if d.failed > 0 %}var(--red){% else %}var(--text-muted){% endif %}">{{ d.failed }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="empty-state" style="border:1px solid var(--border);border-radius:8px;padding:32px">
No activity in the last 14 days.
</div>
{% endif %}
</div>
</div>
<div class="stats-grid" style="margin-top:24px">
<!-- Average duration by drive size -->
<div class="stats-section">
<h2 class="section-title">Avg. Test Duration by Drive Size</h2>
{% if by_size %}
<div class="table-wrap" style="max-height:none">
<table>
<thead>
<tr>
<th>Size</th>
<th style="text-align:right">Jobs</th>
<th style="text-align:right">Avg Duration</th>
</tr>
</thead>
<tbody>
{% for s in by_size %}
<tr>
<td style="font-weight:500;color:var(--text-strong)">{{ s.size_tb }} TB</td>
<td class="mono text-muted" style="text-align:right">{{ s.total }}</td>
<td class="mono" style="text-align:right;color:var(--text-strong)">{{ s.avg_hours }}h</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="empty-state" style="border:1px solid var(--border);border-radius:8px;padding:32px">No completed jobs yet.</div>
{% endif %}
</div>
<!-- Failure breakdown by stage -->
<div class="stats-section">
<h2 class="section-title">Failures by Stage</h2>
{% if by_failure_stage %}
<div class="table-wrap" style="max-height:none">
<table>
<thead>
<tr>
<th>Stage</th>
<th style="text-align:right">Count</th>
</tr>
</thead>
<tbody>
{% for f in by_failure_stage %}
<tr>
<td style="font-weight:500;color:var(--red)">{{ f.failed_stage | replace('_',' ') | title }}</td>
<td class="mono" style="text-align:right;color:var(--red)">{{ f.count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="empty-state" style="border:1px solid var(--border);border-radius:8px;padding:32px">No failures recorded.</div>
{% endif %}
</div>
</div>
{% endblock %}