You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmftools/bookscraper/templates/debug/inspect_state.html

96 lines
2.3 KiB

{# ============================================================ File:
templates/debug/inspect_state.html Purpose: Inspect SQLite vs Redis state per
book_idx. Left side: full book-card UI (same component as dashboard) Right side:
SQL / Redis / merged comparison table.
============================================================ #} {% extends
"layout.html" %} {% block content %}
<h1>State Inspection (SQL vs Redis)</h1>
<style>
.state-block {
display: grid;
grid-template-columns: 380px 1fr;
gap: 20px;
margin-bottom: 35px;
padding: 18px;
border: 1px solid #444;
background: #222;
border-radius: 8px;
}
.state-table {
width: 100%;
border-collapse: collapse;
}
.state-table th,
.state-table td {
border: 1px solid #555;
padding: 6px 10px;
}
.state-table th {
background: #333;
color: #fff;
}
.state-table td {
background: #2a2a2a;
color: #ddd;
}
.same {
color: #9f9 !important;
}
.diff {
color: #ff7b7b !important;
font-weight: bold;
}
.empty {
color: #aaa !important;
font-style: italic;
}
</style>
{% macro cmp(sqlval, redisval) %} {% if (sqlval|string) == (redisval|string) %}
<td class="same">{{ sqlval }}</td>
<td class="same">{{ redisval }}</td>
{% else %}
<td class="diff">{{ sqlval }}</td>
<td class="diff">{{ redisval }}</td>
{% endif %} {% endmacro %} {% for entry in results %}
<div class="state-block">
<!-- LEFT COLUMN: book-card preview -->
<div>
{% with b = entry.card %} {% include "components/bookcard.html" %} {%
endwith %}
</div>
<!-- RIGHT COLUMN: SQL vs Redis comparison -->
<div>
<table class="state-table">
<tr>
<th>Field</th>
<th>SQLite</th>
<th>Redis</th>
<th>Merged Result</th>
</tr>
{% set sql = entry.sqlite %} {% set redis = entry.redis %} {% set merged =
entry.would_merge_to %} {% for field in [ "status", "chapters_total",
"downloaded", "chapters_download_done", "chapters_download_skipped",
"parsed", "chapters_parsed_done", "audio_done", "audio_skipped",
"last_update" ] %}
<tr>
<th>{{ field }}</th>
<td>{{ sql.get(field, '') }}</td>
<td>{{ redis.get(field, '') }}</td>
<td>{{ merged.get(field, '') }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endfor %} {% endblock %}