Lines 3-32
function updateProgress(job_id, callbacks) {
Link Here
|
3 |
let recheck = true; |
3 |
let recheck = true; |
4 |
|
4 |
|
5 |
if ( job.status == "new" ) { |
5 |
if ( job.status == "new" ) { |
6 |
$('#job-percent-' + job_id).text(0); |
6 |
$('#progress-' + job_id).attr('aria-valuenow', 0); |
7 |
$('#job-status-' + job_id).text(JOB_PROGRESS_NOT_STARTED); |
7 |
$('#progress-bar-' + job_id).width("100%"); |
8 |
$('#progress-bar-' + job_id).attr('aria-valuenow', 0).css("width", "100%"); |
8 |
$('#progress-bar-' + job_id).text("0" + JOB_PROGRESS_PERCENT + " " + JOB_PROGRESS_NOT_STARTED); |
9 |
} else if ( job.status == "started" ) { |
9 |
} else if ( job.status == "started" ) { |
10 |
const progress = job["progress"]; |
10 |
const progress = job["progress"]; |
11 |
const size = job["size"]; |
11 |
const size = job["size"]; |
12 |
const percent = progress > 0 ? ( progress / size ) * 100 : 0; |
12 |
const percent = progress > 0 ? ( progress / size ) * 100 : 0; |
13 |
$('#job-percent-' + job_id).text(percent.toFixed(2)); |
13 |
$('#progress-' + job_id).attr('aria-valuenow', percent); |
14 |
$('#job-status-' + job_id).text(JOB_PROGRESS_STARTED); |
|
|
15 |
$('#progress-bar-' + job_id).attr('aria-valuenow', percent); |
16 |
$('#progress-bar-' + job_id).width(Math.floor(percent) +"%"); |
14 |
$('#progress-bar-' + job_id).width(Math.floor(percent) +"%"); |
|
|
15 |
$('#progress-bar-' + job_id).text(percent.toFixed(2) + JOB_PROGRESS_PERCENT + " " + JOB_PROGRESS_STARTED); |
17 |
typeof callbacks.progress_callback === 'function' && callbacks.progress_callback(); |
16 |
typeof callbacks.progress_callback === 'function' && callbacks.progress_callback(); |
18 |
} else if ( job.status == "finished" ) { |
17 |
} else if ( job.status == "finished" ) { |
19 |
$('#job-percent-' + job_id).text(100); |
18 |
$('#progress-bar-' + job_id).addClass("bg-success"); |
20 |
$('#job-status-' + job_id).text(JOB_PROGRESS_FINISHED); |
19 |
$('#progress-' + job_id).attr('aria-valuenow', 100); |
21 |
$('#progress-bar-' + job_id).addClass("progress-bar-success"); |
20 |
$('#progress-bar-' + job_id).css("width", "100%"); |
22 |
$('#progress-bar-' + job_id).attr('aria-valuenow', 100).css("width", "100%"); |
21 |
$('#progress-bar-' + job_id).text("100" + JOB_PROGRESS_PERCENT + " " + JOB_PROGRESS_FINISHED); |
23 |
recheck = false; |
22 |
recheck = false; |
24 |
typeof callbacks.finish_callback === 'function' && callbacks.finish_callback(); |
23 |
typeof callbacks.finish_callback === 'function' && callbacks.finish_callback(); |
25 |
} else if ( job.status == "failed" ) { |
24 |
} else if ( job.status == "failed" ) { |
26 |
$('#job-percent-' + job_id).text(0); |
25 |
$('#progress-bar-' + job_id).addClass("bg-danger"); |
27 |
$('#job-status-' + job_id).text(JOB_PROGRESS_FAILED); |
26 |
$('#progress' + job_id).attr('aria-valuenow', 0); |
28 |
$('#progress-bar-' + job_id).addClass("progress-bar-danger"); |
27 |
$('#progress-bar-' + job_id).css("width", "100%"); |
29 |
$('#progress-bar-' + job_id).attr('aria-valuenow', 0).css("width", "100%"); |
28 |
$('#progress-bar-' + job_id).text("0" + JOB_PROGRESS_PERCENT + " " + JOB_PROGRESS_FAILED); |
30 |
recheck = false; |
29 |
recheck = false; |
31 |
} |
30 |
} |
32 |
|
31 |
|
33 |
- |
|
|