Jun 26 - Update AI Analysis History viewable for every user, removable only for Admin

This commit is contained in:
2026-06-26 13:48:47 -04:00
parent adb39a4aa8
commit fedb782b69
2 changed files with 12 additions and 13 deletions
+8 -4
View File
@@ -128,7 +128,7 @@
<thead>
<tr>
<th>Date</th>
{% if is_admin %}<th>User</th>{% endif %}
<th>User</th>
<th>Files</th>
<th>Verdict</th>
</tr>
@@ -137,7 +137,7 @@
{% for h in history %}
<tr class="history-row" data-id="{{ h.id }}" style="cursor:pointer" title="Click to view result">
<td class="nowrap text-muted">{{ h.analyzed_at.strftime('%Y-%m-%d %H:%M') if h.analyzed_at else '—' }}</td>
{% if is_admin %}<td class="text-muted">{{ h.username or '—' }}</td>{% endif %}
<td class="text-muted">{{ h.username or '—' }}</td>
<td class="text-muted">{{ h.file_names[:50] }}{% if h.file_names|length > 50 %}…{% endif %}</td>
<td>
{% if h.verdict %}
@@ -148,7 +148,7 @@
</td>
</tr>
{% else %}
<tr><td colspan="{{ 5 if is_admin else 4 }}" style="padding:2.5rem 1rem;text-align:center">
<tr><td colspan="4" style="padding:2.5rem 1rem;text-align:center">
<div style="font-size:2rem;margin-bottom:.5rem">🤖</div>
<p class="text-muted" style="margin:0 0 .75rem">No analyses yet. Upload a document above to get started.</p>
<button class="btn btn-primary btn-sm" onclick="document.getElementById('ai-files').scrollIntoView({behavior:'smooth'});document.getElementById('ai-files').focus()">Start Analyzing</button>
@@ -256,6 +256,8 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/9.1.6/marked.min.js"></script>
<script>
var IS_ADMIN = {{ 'true' if is_admin else 'false' }};
/* ─── Markdown renderer config ──────────────────────────────── */
marked.setOptions({ breaks: true, gfm: true });
@@ -483,7 +485,9 @@ document.querySelectorAll('.history-row').forEach(function(row) {
document.getElementById('hist-body').innerHTML =
renderAI(d.summary_text || '');
document.getElementById('btn-delete-analysis').style.display = '';
if (IS_ADMIN) {
document.getElementById('btn-delete-analysis').style.display = '';
}
})
.catch(function() {
document.getElementById('hist-body').textContent = 'Failed to load analysis.';