From 1dbf09b5d52287359641e3e59fbbd800be70b51f Mon Sep 17 00:00:00 2001 From: Sleeps Date: Wed, 7 Oct 2026 13:54:18 +0100 Subject: [PATCH] Add index result drill-down to web dashboard --- scene_search/web/index.html | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/scene_search/web/index.html b/scene_search/web/index.html index 45c846f..1e805bf 100644 --- a/scene_search/web/index.html +++ b/scene_search/web/index.html @@ -90,6 +90,14 @@
Idle
+
+ + + +
+
+
+
@@ -127,6 +135,9 @@ let lastIndexRunning = false; let lastCaptionRunning = false; let captionLastStatus = null; + let reportCategory = null; + let reportOffset = 0; + let reportTotal = 0; let thumbnailUrls = []; $('apiKey').value = localStorage.getItem('sceneSearchApiKey') || ''; @@ -222,6 +233,55 @@ } } + async function refreshIndexReportSummary() { + try { + const report = await api('/api/jellyfin/index/report?limit=1'); + const summary = report.summary || {}; + $('reportFailed').textContent = 'Failed (' + (summary.failed || 0) + ')'; + $('reportRemoved').textContent = 'Removed (' + (summary.pruned || 0) + ')'; + $('reportIndexed').textContent = 'Indexed (' + (summary.indexed || 0) + ')'; + if (!report.available) { + $('indexReportMeta').textContent = 'No saved index report yet.'; + } + } catch (_) {} + } + + async function loadIndexReport(category, append=false) { + const offset = append ? reportOffset : 0; + try { + const report = await api( + '/api/jellyfin/index/report?category=' + encodeURIComponent(category) + + '&offset=' + offset + '&limit=200' + ); + reportCategory = category; + reportOffset = offset + (report.items || []).length; + reportTotal = Number(report.total || 0); + + const container = $('indexReportList'); + if (!append) container.innerHTML = ''; + + for (const item of (report.items || [])) { + const row = document.createElement('div'); + row.style.cssText = 'padding:8px 0;border-bottom:1px solid #282d36'; + row.innerHTML = + '' + escapeHtml(item.title || item.item_id || '(unnamed)') + '' + + '
' + + escapeHtml(item.library || item.library_id || '') + + (item.item_id ? ' · ' + escapeHtml(item.item_id) : '') + + '
' + + '
' + escapeHtml(item.reason || '') + '
'; + container.appendChild(row); + } + + $('indexReportMeta').textContent = + reportTotal + ' ' + category + ' item' + (reportTotal === 1 ? '' : 's') + + (report.finished_at ? ' · last run ' + report.finished_at : ''); + $('indexReportMore').style.display = reportOffset < reportTotal ? '' : 'none'; + } catch (e) { + $('indexReportMeta').textContent = e.message; + } + } + async function refreshStatus() { try { const s = await api('/api/jellyfin/index/status'); @@ -230,6 +290,7 @@ if (lastIndexRunning && !running) { loadLibraries(); refreshHealth(); + refreshIndexReportSummary(); } lastIndexRunning = running; return s; @@ -472,6 +533,12 @@ $('indexNow').onclick = startIndex; $('captionNow').onclick = startCaption; $('captionPause').onclick = toggleCaptionPause; + $('reportFailed').onclick = () => loadIndexReport('failed'); + $('reportRemoved').onclick = () => loadIndexReport('removed'); + $('reportIndexed').onclick = () => loadIndexReport('indexed'); + $('indexReportMore').onclick = () => { + if (reportCategory) loadIndexReport(reportCategory, true); + }; $('searchButton').onclick = search; $('searchQuery').addEventListener('keydown', e => { if (e.key === 'Enter') search(); }); @@ -479,6 +546,7 @@ loadLibraries(); refreshStatus(); refreshCaptionStatus(); + refreshIndexReportSummary(); statusTimer = setInterval(refreshStatus, 2000); captionTimer = setInterval(refreshCaptionStatus, 2000); })();