mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-17 23:41:28 +00:00
Add index result drill-down to web dashboard
This commit is contained in:
@@ -90,6 +90,14 @@
|
||||
<progress id="overallProgress" max="100" value="0"></progress>
|
||||
<div id="indexStatus" class="status muted">Idle</div>
|
||||
<div id="indexDetail" class="muted"></div>
|
||||
<div id="indexReportActions" class="row" style="margin-top:12px">
|
||||
<button id="reportFailed" type="button" class="secondary">Failed</button>
|
||||
<button id="reportRemoved" type="button" class="secondary">Removed</button>
|
||||
<button id="reportIndexed" type="button" class="secondary">Indexed</button>
|
||||
</div>
|
||||
<div id="indexReportMeta" class="muted" style="margin-top:10px"></div>
|
||||
<div id="indexReportList" style="margin-top:8px;max-height:320px;overflow:auto"></div>
|
||||
<button id="indexReportMore" type="button" class="secondary" style="margin-top:8px;display:none">Show more</button>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
@@ -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 =
|
||||
'<strong>' + escapeHtml(item.title || item.item_id || '(unnamed)') + '</strong>' +
|
||||
'<div class="muted">' +
|
||||
escapeHtml(item.library || item.library_id || '') +
|
||||
(item.item_id ? ' · ' + escapeHtml(item.item_id) : '') +
|
||||
'</div>' +
|
||||
'<div>' + escapeHtml(item.reason || '') + '</div>';
|
||||
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);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user