From e876d3c63a8df53fa94899ccd6ffe10b50fbf13c Mon Sep 17 00:00:00 2001 From: hbrain Date: Wed, 27 May 2026 12:04:19 +0200 Subject: [PATCH] Disable edit buttons for running jobs --- new.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/new.php b/new.php index 0a68a2b..c3b10c5 100644 --- a/new.php +++ b/new.php @@ -407,7 +407,7 @@ if ($editName !== '') { try { $editDir = safe_input_dir($config['uploads_dir'],

Videos without input dir

No orphan videos.


MB
-

Existing input dirs

No input directories yet.

No video yet

No videoPreview video

· files · · ·

+

Existing input dirs

No input directories yet.

No video yet
RenderingEdit

No videoPreview video

· files · · ·

Edit input dir

in-dir/

This input directory is . Editing is disabled until the job completes.

Edit input dir

in-dir/

Files and captions

No caption for audio files

Add new movie input

@@ -467,12 +467,40 @@ document.querySelectorAll('.admin-switches input[type="checkbox"]').forEach(func const name=(job.name||'job').replace(/_/g,' '); return ''+name+''; } + function syncEditButtons(runningJobs){ + document.querySelectorAll('.admin-video-row[data-job]').forEach(function(row){ + const job=row.dataset.job || ''; + const edit=row.querySelector('[data-edit-action="1"]'); + if(!edit) return; + const running=runningJobs.has(job); + if(edit.tagName === 'A'){ + if(running){ + if(!edit.dataset.editHref) edit.dataset.editHref = edit.getAttribute('href') || ''; + edit.removeAttribute('href'); + edit.classList.add('disabled'); + edit.setAttribute('aria-disabled', 'true'); + edit.title='Rendering now'; + }else{ + const href=edit.dataset.editHref || ('?edit=' + encodeURIComponent(job)); + edit.setAttribute('href', href); + edit.classList.remove('disabled'); + edit.removeAttribute('aria-disabled'); + edit.title='Edit'; + } + }else{ + edit.classList.toggle('disabled', running); + edit.title=running ? 'Rendering now' : ''; + } + }); + } async function updateJobs(){ try{ const r=await fetch('job_status.php',{cache:'no-store'}); if(!r.ok) throw new Error('status failed'); const data=await r.json(); const jobs=data.jobs||[]; + const runningJobs=new Set(jobs.map(function(job){ return job && job.name ? String(job.name) : ''; }).filter(Boolean)); + syncEditButtons(runningJobs); if(!jobs.length){box.hidden=true;box.innerHTML='';return;} box.hidden=false; box.innerHTML='Running'+jobs.map(fmt).join('');