fixed some errors with archive handling
This commit is contained in:
@@ -99,6 +99,7 @@
|
||||
<button id="triggerImportBtn" class="btn primary-btn">Quick Scan</button>
|
||||
<button id="triggerDeepScanBtn" class="btn warning-btn" title="Full reprocessing: re-extracts metadata, runs pHash comparison, merges archive tags">Deep Scan</button>
|
||||
<button id="retryFailedBtn" class="btn warning-btn">Retry Failed Tasks</button>
|
||||
<button id="clearQueueBtn" class="btn danger-btn" title="Remove all pending and queued tasks from the queue">Clear Queue</button>
|
||||
</div>
|
||||
|
||||
<!-- Task Cleanup Controls -->
|
||||
@@ -1090,6 +1091,44 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Clear Queue (pending/queued tasks)
|
||||
document.getElementById('clearQueueBtn').addEventListener('click', async () => {
|
||||
const pendingCount = parseInt(document.getElementById('queuePending').textContent) || 0;
|
||||
const queuedCount = parseInt(document.getElementById('queueQueued').textContent) || 0;
|
||||
const totalQueued = pendingCount + queuedCount;
|
||||
|
||||
if (totalQueued === 0) {
|
||||
alert('No pending or queued tasks to clear.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm(`Are you sure you want to clear ${totalQueued} pending/queued task(s) from the import queue?\n\nThis will stop these tasks from being processed.`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = document.getElementById('clearQueueBtn');
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Clearing...';
|
||||
|
||||
try {
|
||||
const r = await fetch('/api/import/clear-queue', { method: 'POST' });
|
||||
const data = await r.json();
|
||||
|
||||
if (data.ok) {
|
||||
alert(`Cleared ${data.deleted} task(s) from the queue.`);
|
||||
loadQueueStatus();
|
||||
loadTaskList();
|
||||
} else {
|
||||
alert('Failed to clear queue: ' + (data.error || 'Unknown error'));
|
||||
}
|
||||
} catch (e) {
|
||||
alert('Failed to clear queue: ' + e.message);
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Clear Queue';
|
||||
}
|
||||
});
|
||||
|
||||
// Clear Tasks with age/status options
|
||||
document.getElementById('clearTasksBtn').addEventListener('click', async () => {
|
||||
const btn = document.getElementById('clearTasksBtn');
|
||||
|
||||
Reference in New Issue
Block a user