Render chkbox turns off once rendering job starts
This commit is contained in:
parent
55b2da4ed9
commit
2d38a1673b
2 changed files with 11 additions and 1 deletions
|
|
@ -2256,6 +2256,9 @@ document.addEventListener('DOMContentLoaded', function(){
|
|||
if(!r.ok) throw new Error('status failed');
|
||||
const data=await r.json();
|
||||
const jobs=(data.jobs||[]).filter(function(job){ return job && (job.name || job.id); });
|
||||
if (Array.isArray(data.switches) && typeof applySwitchPayload === 'function') {
|
||||
data.switches.forEach(function(payload){ applySwitchPayload(payload); });
|
||||
}
|
||||
const runningIds=new Set(jobs.map(function(job){ return String(job.id || ''); }).filter(function(v){ return v !== ''; }));
|
||||
const runningJobs=new Set(jobs.map(function(job){ return String(job.name || ''); }).filter(function(v){ return v !== ''; }));
|
||||
syncEditButtons(runningIds, runningJobs);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ $config = require __DIR__ . '/config.php';
|
|||
header('Content-Type: application/json; charset=UTF-8');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
||||
$jobs = [];
|
||||
$switches = [];
|
||||
$dirs = glob($config['uploads_dir'] . '/*', GLOB_ONLYDIR) ?: [];
|
||||
foreach ($dirs as $dir) {
|
||||
$name = basename($dir);
|
||||
|
|
@ -16,6 +17,12 @@ foreach ($dirs as $dir) {
|
|||
$articleId = is_array($state) ? strtolower((string)($state['article_id'] ?? '')) : '';
|
||||
if ($articleId === '' && is_file($idFile)) $articleId = strtolower(trim((string)file_get_contents($idFile)));
|
||||
if (!preg_match('/^[0-9]{14}[a-f0-9]{16}$/', $articleId)) $articleId = '';
|
||||
$switches[] = [
|
||||
'dir' => $name,
|
||||
'id' => $articleId,
|
||||
'enabled' => is_file($dir . '/.movmaker-enabled'),
|
||||
'preview' => is_file($dir . '/.movmaker-preview'),
|
||||
];
|
||||
$locked = is_dir($lockDir);
|
||||
if ($locked || $status === 'processing') {
|
||||
$started = '';
|
||||
|
|
@ -29,4 +36,4 @@ foreach ($dirs as $dir) {
|
|||
];
|
||||
}
|
||||
}
|
||||
echo json_encode(['jobs' => $jobs, 'checked_at' => date('c')], JSON_UNESCAPED_UNICODE);
|
||||
echo json_encode(['jobs' => $jobs, 'switches' => $switches, 'checked_at' => date('c')], JSON_UNESCAPED_UNICODE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue