feat(admin): Nutzungsstatistik um "mit Websuche" je Nutzer

get_all_usage liefert total_web_searches (Summe aus web_search_usage);
Statistik-Tabelle + Gesamtzeile zeigen die neue Spalte "mit Websuche".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-06-30 09:51:29 +02:00
commit d74e94e6a4
2 changed files with 7 additions and 1 deletions

View file

@ -1826,6 +1826,7 @@ async function loadMetrics() {
if (!data.length) { container.innerHTML = '<p class="text-sm text-slate-400 py-4 text-center">Noch keine Nutzungsdaten vorhanden.</p>'; return; }
const totalReq = data.reduce((s, u) => s + (u.total_requests || 0), 0);
const totalWS = data.reduce((s, u) => s + (u.total_web_searches || 0), 0);
const maxReq = Math.max(...data.map((u) => u.total_requests || 0), 1);
const bars = data.map((u) => {
@ -1847,6 +1848,7 @@ async function loadMetrics() {
<tr class="text-xs text-slate-500 dark:text-slate-400 border-b border-slate-200 dark:border-slate-700">
<th class="text-left px-4 py-2.5">Nutzer</th>
<th class="text-right px-4 py-2.5">Anfragen gesamt</th>
<th class="text-right px-4 py-2.5">mit Websuche</th>
<th class="text-right px-4 py-2.5">Einheiten</th>
<th class="text-right px-4 py-2.5">Letzte Aktivität</th>
</tr>
@ -1856,6 +1858,7 @@ async function loadMetrics() {
<tr class="hover:bg-slate-50 dark:hover:bg-slate-700/40 transition-colors">
<td class="px-4 py-2.5 font-medium">${escHtml(u.display_name)}</td>
<td class="px-4 py-2.5 text-right font-mono text-xs">${u.total_requests ?? 0}</td>
<td class="px-4 py-2.5 text-right font-mono text-xs">${u.total_web_searches ?? 0}</td>
<td class="px-4 py-2.5 text-right font-mono text-xs">${u.total_units ?? 0}</td>
<td class="px-4 py-2.5 text-right text-xs text-slate-400">${u.last_active || "—"}</td>
</tr>`).join("")}
@ -1864,6 +1867,7 @@ async function loadMetrics() {
<tr class="text-xs font-semibold text-slate-600 dark:text-slate-300">
<td class="px-4 py-2">Gesamt</td>
<td class="px-4 py-2 text-right font-mono">${totalReq}</td>
<td class="px-4 py-2 text-right font-mono">${totalWS}</td>
<td class="px-4 py-2"></td>
<td class="px-4 py-2"></td>
</tr>