Lines 1-4
Link Here
|
1 |
function updateProgress(job_id, callback) { |
1 |
function updateProgress(job_id, callbacks) { |
2 |
$.getJSON('/api/v1/jobs/' + job_id, function(job){ |
2 |
$.getJSON('/api/v1/jobs/' + job_id, function(job){ |
3 |
let recheck = true; |
3 |
let recheck = true; |
4 |
|
4 |
|
Lines 14-26
function updateProgress(job_id, callback) {
Link Here
|
14 |
$('#job-status-' + job_id).text(JOB_PROGRESS_STARTED); |
14 |
$('#job-status-' + job_id).text(JOB_PROGRESS_STARTED); |
15 |
$('#progress-bar-' + job_id).attr('aria-valuenow', percent); |
15 |
$('#progress-bar-' + job_id).attr('aria-valuenow', percent); |
16 |
$('#progress-bar-' + job_id).width(Math.floor(percent) +"%"); |
16 |
$('#progress-bar-' + job_id).width(Math.floor(percent) +"%"); |
|
|
17 |
typeof callbacks.progress_callback === 'function' && callbacks.progress_callback(); |
17 |
} else if ( job.status == "finished" ) { |
18 |
} else if ( job.status == "finished" ) { |
18 |
$('#job-percent-' + job_id).text(100); |
19 |
$('#job-percent-' + job_id).text(100); |
19 |
$('#job-status-' + job_id).text(JOB_PROGRESS_FINISHED); |
20 |
$('#job-status-' + job_id).text(JOB_PROGRESS_FINISHED); |
20 |
$('#progress-bar-' + job_id).addClass("progress-bar-success"); |
21 |
$('#progress-bar-' + job_id).addClass("progress-bar-success"); |
21 |
$('#progress-bar-' + job_id).attr('aria-valuenow', 100).css("width", "100%"); |
22 |
$('#progress-bar-' + job_id).attr('aria-valuenow', 100).css("width", "100%"); |
22 |
recheck = false; |
23 |
recheck = false; |
23 |
callback(); |
24 |
typeof callbacks.finish_callback === 'function' && callbacks.finish_callback(); |
24 |
} else if ( job.status == "failed" ) { |
25 |
} else if ( job.status == "failed" ) { |
25 |
$('#job-percent-' + job_id).text(0); |
26 |
$('#job-percent-' + job_id).text(0); |
26 |
$('#job-status-' + job_id).text(JOB_PROGRESS_FAILED); |
27 |
$('#job-status-' + job_id).text(JOB_PROGRESS_FAILED); |
Lines 30-36
function updateProgress(job_id, callback) {
Link Here
|
30 |
} |
31 |
} |
31 |
|
32 |
|
32 |
if ( recheck ) { |
33 |
if ( recheck ) { |
33 |
setTimeout(function(){updateProgress(job_id, callback)}, 1 * 1000); |
34 |
setTimeout(function(){updateProgress(job_id, callbacks)}, 1 * 1000); |
34 |
} |
35 |
} |
35 |
}); |
36 |
}); |
36 |
} |
37 |
} |
37 |
- |
|
|