fix: toggle preview display bug, add job deletion, optimize pipeline
- Fix: toggle ON now resets img display to block (was stuck on 'waiting') - Toggle OFF sends API call to stop preview file writes - Delete button on status page + jobs page cards - DELETE /api/jobs/<id> endpoint removes job + output files - PUT /api/jobs/<id>/preview endpoint toggles preview_enabled - Pipeline skips resize/encode/write when preview_enabled=False - Reduced preview defaults: 480px max, JPEG quality 60 - 62/62 tests pass
This commit is contained in:
1 parent
09a8829575
commit
163280078f
6 files changed
+140
-7
No files matched your search
+31
-1
@@ -369,7 +369,8 @@ function initStatusPage(jobId, initialStatus) {
|
||||
if (previewToggle) {
|
||||
previewToggle.addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
livePreviewImg.src = '/api/preview/' + jobId;
|
||||
livePreviewImg.style.display = 'block';
|
||||
livePreviewImg.src = '/api/preview/' + jobId + '?t=' + Date.now();
|
||||
if (previewPlaceholder) previewPlaceholder.style.display = '';
|
||||
livePreviewSection.style.display = '';
|
||||
if (toggleText) toggleText.textContent = 'ON';
|
||||
@@ -379,6 +380,10 @@ function initStatusPage(jobId, initialStatus) {
|
||||
if (previewPlaceholder) previewPlaceholder.style.display = '';
|
||||
livePreviewSection.style.display = '';
|
||||
if (toggleText) toggleText.textContent = 'OFF';
|
||||
fetch('/api/jobs/' + jobId + '/preview', {
|
||||
method: 'PUT', headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({enabled: false})
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -552,6 +557,31 @@ function initStatusPage(jobId, initialStatus) {
|
||||
if (pollInterval) { clearInterval(pollInterval); pollInterval = null; }
|
||||
}
|
||||
|
||||
/* --- Delete button --- */
|
||||
var deleteBtn = document.getElementById('delete-btn');
|
||||
if (deleteBtn) {
|
||||
deleteBtn.addEventListener('click', function() {
|
||||
if (!confirm('Delete this job and all its output files?')) return;
|
||||
deleteBtn.disabled = true;
|
||||
deleteBtn.textContent = 'Deleting...';
|
||||
fetch('/api/jobs/' + jobId, { method: 'DELETE' })
|
||||
.then(function(res) { return res.json(); })
|
||||
.then(function(data) {
|
||||
if (data.status === 'deleted') {
|
||||
window.location.href = '/jobs';
|
||||
} else {
|
||||
deleteBtn.disabled = false;
|
||||
deleteBtn.textContent = 'Delete';
|
||||
if (data.error) alert(data.error);
|
||||
}
|
||||
})
|
||||
.catch(function() {
|
||||
deleteBtn.disabled = false;
|
||||
deleteBtn.textContent = 'Delete';
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* --- Boot --- */
|
||||
updateProgressBar(0);
|
||||
if (videoThumb) {
|
||||
|
||||
Reference in new issue
Block a user