Update web/templates/normalize_source_result.html

This commit is contained in:
Joshua Laymon 2025-08-14 19:39:35 +00:00
parent a91729ca06
commit e77b9e81ff

View File

@ -3,44 +3,86 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<div class="search-form"> <h1 class="page-title">Source Normalizer — Results</h1>
<h2 style="margin:0 0 10px;">Source Normalizer — {{ applied|yesno:"Applied,Dryrun Preview" }}</h2>
<p class="small muted" style="margin:0 0 12px;">
{{ changed }} {{ applied|yesno:"entries changed,entries would change" }}; {{ warnings_total }} warnings.
{% if limit %} (Limited to first {{ limit }} entries){% endif %}
</p>
<div class="card" style="padding:16px; margin-bottom:16px;">
<div class="meta-grid">
<div>
<div class="meta-label">Mode</div>
<div class="subject-title" style="margin:0">
{% if applied %}Applied to Database{% else %}Preview (dryrun){% endif %}
</div>
</div>
<div>
<div class="meta-label">Entries {% if applied %}changed{% else %}that would change{% endif %}</div>
<div class="subject-title" style="margin:0">{{ changed }}</div>
</div>
<div>
<div class="meta-label">Preview Count</div>
<div class="subject-title" style="margin:0">{{ preview|length }}</div>
</div>
</div>
{% if limit %}
<div class="small muted" style="margin-top:8px;">
Preview limited to first {{ limit }} entries matched.
</div>
{% endif %}
</div>
<div class="card" style="padding:16px; margin-bottom:16px;">
<div class="meta-label">Preview of Changes (first {{ preview|length }})</div>
{% if preview %} {% if preview %}
<div style="overflow:auto;"> <div style="overflow:auto; border:1px solid var(--border); border-radius:12px;">
<table style="width:100%; border-collapse:collapse; font-size:14px;"> <table style="width:100%; border-collapse:collapse; min-width:720px;">
<thead> <thead>
<tr> <tr style="background:#f8fafc;">
<th style="text-align:left; border-bottom:1px solid var(--border); padding:8px;">ID</th> <th style="text-align:left; padding:10px 12px; border-bottom:1px solid var(--border); width:80px;">ID</th>
<th style="text-align:left; border-bottom:1px solid var(--border); padding:8px;">Original</th> <th style="text-align:left; padding:10px 12px; border-bottom:1px solid var(--border);">Original</th>
<th style="text-align:left; border-bottom:1px solid var(--border); padding:8px;">Normalized</th> <th style="text-align:left; padding:10px 12px; border-bottom:1px solid var(--border);">Normalized</th>
<th style="text-align:left; padding:10px 12px; border-bottom:1px solid var(--border); width:110px;">View</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for id, orig, norm in preview %} {% for id, original, normalized in preview %}
<tr> <tr>
<td style="border-bottom:1px solid var(--border); padding:8px;">{{ id }}</td> <td style="padding:10px 12px; border-bottom:1px solid var(--border); color:#64748b;">{{ id }}</td>
<td style="border-bottom:1px solid var(--border); padding:8px;">{{ orig }}</td> <td style="padding:10px 12px; border-bottom:1px solid var(--border); font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;">
<td style="border-bottom:1px solid var(--border); padding:8px; font-weight:600;">{{ norm }}</td> {{ original|default:"—" }}
</td>
<td style="padding:10px 12px; border-bottom:1px solid var(--border); font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-weight:600;">
{{ normalized|default:"—" }}
</td>
<td style="padding:10px 12px; border-bottom:1px solid var(--border);">
<a class="btn btn-secondary" href="{% url 'entry_view' id %}">Open</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="small muted" style="margin-top:8px;">
Table shows up to the first 100 changes for readability.
</div>
{% else %} {% else %}
<div class="empty-state"> <div class="empty-state">
<div class="empty-title">No changes found</div> <div class="empty-title">No differences found</div>
<div class="empty-subtitle">Nothing to preview for this selection.</div> <div class="empty-subtitle">Nothing would change with the current normalization rules.</div>
</div> </div>
{% endif %} {% endif %}
</div>
<div style="margin-top:12px; display:flex; gap:10px; flex-wrap:wrap;"> <div style="display:flex; gap:10px; flex-wrap:wrap;">
<a class="btn" href="{% url 'stats' %}">Back to Stats</a> <a class="btn btn-secondary" href="{% url 'stats' %}">← Back to Statistics</a>
</div>
{% if not applied %}
<form method="post" action="{% url 'normalize_source' %}">
{% csrf_token %}
<button class="btn btn-danger"
onclick="return confirm('Apply normalization to ALL entries? This will modify source fields. Make a backup first.');">
Apply to all
</button>
</form>
{% endif %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}