92 lines
3.6 KiB
HTML
92 lines
3.6 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
<div class="row mb-2">
|
|
<div class="col">
|
|
<h2>Threads{% if account %} for {{ account }}{% endif %}</h2>
|
|
<p class="muted">Latest updated threads. Click an ID to view details and AI analysis.</p>
|
|
{% if alerts_processed is not none %}
|
|
<div class="alert success" style="margin-bottom:12px;">
|
|
✓ Alerts processed! {{ alerts_processed }} thread(s) were checked for alerts.
|
|
</div>
|
|
<script>
|
|
// Auto-hide the success alert after a short delay with a smooth fade-out
|
|
(function() {
|
|
const alertEl = document.currentScript?.previousElementSibling;
|
|
if (!alertEl || !alertEl.classList || !alertEl.classList.contains('alert')) return;
|
|
const hideMs = 3000; // visible duration
|
|
const fadeMs = 350; // should match CSS transition
|
|
setTimeout(() => {
|
|
alertEl.classList.add('fade-out');
|
|
setTimeout(() => {
|
|
if (alertEl && alertEl.parentNode) {
|
|
alertEl.parentNode.removeChild(alertEl);
|
|
}
|
|
}, fadeMs + 25);
|
|
}, hideMs);
|
|
})();
|
|
</script>
|
|
{% endif %}
|
|
{% if status %}
|
|
<div class="muted" style="margin-top:6px;">
|
|
{% if status.sync_in_progress %}
|
|
<span class="badge brand">Syncing…</span>
|
|
{% else %}
|
|
{% if status.last_sync_status == 'ok' %}
|
|
<span class="badge success">Last sync OK</span>
|
|
{% elif status.last_sync_status == 'error' %}
|
|
<span class="badge warn">Last sync error</span>
|
|
{% else %}
|
|
<span class="badge">Idle</span>
|
|
{% endif %}
|
|
{% endif %}
|
|
<span style="margin-left:8px;">Last Sync: {{ status.last_sync_at or 'never' }}</span>
|
|
<span style="margin-left:8px;">Items: {{ status.last_sync_count }}</span>
|
|
{% if status.last_sync_error %}
|
|
<div class="muted" style="margin-top:2px;">Error: {{ status.last_sync_error }}</div>
|
|
{% endif %}
|
|
{% if status.auto_process %}
|
|
<div class="muted">Auto process enabled (every {{ status.interval }}m)</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card table-wrap" style="width: 100%; max-width: none;">
|
|
<table style="width: 100%; table-layout: auto;">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 5%;">ID</th>
|
|
<th style="width: 25%;">Subject</th>
|
|
<th style="width: 25%;">AI Summary</th>
|
|
<th style="width: 10%;">Account</th>
|
|
<th style="width: 5%;">Msgs</th>
|
|
<th style="width: 15%;">Requires Reply</th>
|
|
<th style="width: 15%;">Last Message</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for t in threads %}
|
|
<tr>
|
|
<td><a href="/thread/{{ t.thread.id }}">{{ t.frontend_id }}</a></td>
|
|
<td>{{ t.thread.subject }}</td>
|
|
<td class="muted">{{ t.thread.ai_summary or '' }}</td>
|
|
<td><span class="badge">{{ t.thread.account_email }}</span></td>
|
|
<td><span class="badge brand">{{ t.thread.messages|length }}</span></td>
|
|
<td>
|
|
{% if t.thread.requires_reply %}
|
|
<span class="badge warn">Needs reply</span>
|
|
{% else %}
|
|
<span class="badge success">Up to date</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="muted">{{ t.formatted_date }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="7">No threads yet</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endblock %}
|