View | Details | Raw Unified | Return to bug 37795
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/job_progress.inc (-3 / +2 lines)
Lines 1-5 Link Here
1
<div class="progress">
1
<div class="progress bg-dark-subtle" id="progress-[% job_id | html %]" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
2
    <div id="progress-bar-[% job_id | html %]" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
2
    <div class="progress-bar overflow-visible" id="progress-bar-[% job_id | html %]">
3
        <span id="job-percent-[% job_id | html %]">0</span>% <span id="job-status-[% job_id | html %]"></span>
4
    </div>
3
    </div>
5
</div>
4
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/str/job_progress.inc (+1 lines)
Lines 4-7 Link Here
4
    var JOB_PROGRESS_STARTED     = _("Started");
4
    var JOB_PROGRESS_STARTED     = _("Started");
5
    var JOB_PROGRESS_FINISHED    = _("Finished");
5
    var JOB_PROGRESS_FINISHED    = _("Finished");
6
    var JOB_PROGRESS_FAILED      = _("Failed");
6
    var JOB_PROGRESS_FAILED      = _("Failed");
7
    var JOB_PROGRESS_PERCENT     = _("%");
7
</script>
8
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/js/job_progress.js (-15 / +13 lines)
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
- 

Return to bug 37795