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

(-)a/admin/background_jobs.pl (-24 / +1 lines)
Lines 79-108 if ( $op eq 'cancel' ) { Link Here
79
79
80
if ( $op eq 'list' ) {
80
if ( $op eq 'list' ) {
81
    my $jobs = Koha::BackgroundJobs->search({}, { order_by => { -desc => 'enqueued_on' }});
81
    my $jobs = Koha::BackgroundJobs->search({}, { order_by => { -desc => 'enqueued_on' }});
82
    my @pending_jobs;
82
    $template->param( jobs => $jobs );
83
    try {
84
        my $conn = Koha::BackgroundJob->connect;
85
        my $job_type = 'batch_biblio_record_modification';
86
        $conn->subscribe({ destination => $job_type, ack => 'client' });
87
        my @frames;
88
        while (my $frame = $conn->receive_frame({timeout => 1})) {
89
            last unless $frame;
90
            my $body = $frame->body;
91
            my $args = decode_json($body);
92
            push @pending_jobs, $args->{job_id};
93
            push @frames, $frame;
94
        }
95
        $conn->nack( { frame => $_ } ) for @frames;
96
        $conn->disconnect;
97
    } catch {
98
        push @messages, {
99
            type => 'error',
100
            code => 'cannot_retrieve_jobs',
101
            error => $_,
102
        };
103
    };
104
105
    $template->param( jobs => $jobs, pending_jobs => \@pending_jobs, );
106
}
83
}
107
84
108
$template->param(
85
$template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt (-12 lines)
Lines 23-30 Link Here
23
[% FOR m IN messages %]
23
[% FOR m IN messages %]
24
    <div class="dialog message">
24
    <div class="dialog message">
25
        [% SWITCH m.code %]
25
        [% SWITCH m.code %]
26
        [% CASE 'cannot_retrieve_jobs' %]
27
            <div><i class="fa fa-exclamation error"></i>Cannot retrieve pending jobs ([% m.error | html %])</div>
28
        [% CASE 'cannot_view_job' %]
26
        [% CASE 'cannot_view_job' %]
29
            <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
27
            <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
30
        [% CASE %]
28
        [% CASE %]
Lines 143-157 Link Here
143
141
144
    <h2>Background jobs</h2>
142
    <h2>Background jobs</h2>
145
143
146
    <div class="dialog message">
147
        <i class="fa fa-info"></i>
148
        [% IF pending_jobs.size > 0 %]
149
            There is [% pending_jobs.size | html %] pending jobs on the server: [% pending_jobs.join(', ') | html %].
150
        [% ELSE %]
151
            There is no pending jobs on the server.
152
        [% END %]
153
    </div>
154
155
    [% IF jobs.count %]
144
    [% IF jobs.count %]
156
        <table id="table_background_jobs">
145
        <table id="table_background_jobs">
157
            <thead>
146
            <thead>
158
- 

Return to bug 22417