Files
daily-paper/app/templates/partials/summary_list.html
T

82 lines
2.9 KiB
HTML

<!-- 总结状态列表(HTMX 片段) -->
{% if results %}
<div class="admin-table-wrap">
<table class="admin-table summary-table">
<thead>
<tr>
<th>标题</th>
<th>日期</th>
<th>状态</th>
<th>重试</th>
<th>错误类型</th>
<th>错误信息</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for paper, ss in results %}
<tr>
<td class="title-cell">
<a href="/paper/{{ paper.arxiv_id }}" target="_blank">
{{ (paper.title_zh or paper.title_en)[:60] }}{% if (paper.title_zh or paper.title_en)|length > 60 %}...{% endif %}
</a>
</td>
<td class="time-cell">{{ paper.paper_date.strftime('%m-%d') if paper.paper_date else '-' }}</td>
<td>
{% set st = ss.status if ss else 'none' %}
<span class="status-badge status-{{ 'success' if st == 'done' else ('running' if st in ['pending', 'processing'] else 'failed') }}">
{% if st == 'done' %}✓ 完成
{% elif st == 'pending' %}⏳ 待总结
{% elif st == 'processing' %}⟳ 运行中
{% elif st == 'failed' %}✗ 失败
{% elif st == 'permanent_failure' %}✗ 永久失败
{% else %}○ 未开始{% endif %}
</span>
</td>
<td>{{ ss.retry_count if ss else 0 }}</td>
<td>{{ (ss.error_type or '-') if ss else '-' }}</td>
<td class="error-cell" title="{{ ss.error if ss else '' }}">
{% if ss and ss.error %}
{{ ss.error[:60] + '...' if ss.error|length > 60 else ss.error }}
{% else %}-{% endif %}
</td>
<td>
{% if st in ['failed', 'permanent_failure', 'pending', 'none'] %}
<button class="retry-btn" onclick="retrySummary('{{ paper.arxiv_id }}', this)">重试</button>
{% else %}
<span style="color: var(--ink-muted); font-size: 0.75rem;">-</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- 分页 -->
{% set total_pages = ((total + per_page - 1) // per_page) if total else 1 %}
{% if total_pages > 1 %}
<div class="pagination">
{% if page > 1 %}
<button class="page-btn" onclick="summaryPage({{ page - 1 }})">← 上一页</button>
{% endif %}
<span class="page-info">第 {{ page }} / {{ total_pages }} 页(共 {{ total }} 篇)</span>
{% if page < total_pages %}
<button class="page-btn" onclick="summaryPage({{ page + 1 }})">下一页 →</button>
{% endif %}
</div>
{% endif %}
<script>
function summaryPage(p) {
const status = document.querySelector('.summary-filters .filter-chip.active')?.dataset.status || 'all';
htmx.ajax('GET', '/admin/summary-status?status=' + status + '&page=' + p, '#summary-list');
}
</script>
{% else %}
<div class="empty-state">
<p>无匹配结果</p>
<p class="hint">调整筛选条件或触发总结任务。</p>
</div>
{% endif %}