This commit is contained in:
2025-10-25 18:12:15 +11:00
parent 90b3fe4c2f
commit 392708bad9

View File

@@ -71,16 +71,15 @@ function SetActiveJobsBadge(num_jobs)
// after a 1 second timeout // after a 1 second timeout
function CheckForJobs() function CheckForJobs()
{ {
$.ajax( $.ajax( {
{ type: 'POST', url: '/check_for_jobs',
type: 'POST', url: '/check_for_jobs', success: function(data) {
success: function(data) { // for each status, handle it/make toast in UI
// for each status, handle it/make toast in UI data.sts.forEach( function(el) { StatusMsg(el) } )
data.sts.forEach( function(el) { StatusMsg(el) } ) SetActiveJobsBadge(data.num_active_jobs)
SetActiveJobsBadge(data.num_active_jobs) // still active job(s), keep checking for them to end
// still active job(s), keep checking for them to end if( data.num_active_jobs > 0 ) { setTimeout( function() { CheckForJobs() }, 1000 ); }
if( data.num_active_jobs > 0 ) { setTimeout( function() { CheckForJobs() }, 1000 ); } },
}, } )
} )
return false; return false;
} }