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

(-)a/admin/background_jobs.pl (-4 / +14 lines)
Lines 78-92 if ( $op eq 'cancel' ) { Link Here
78
78
79
79
80
if ( $op eq 'list' ) {
80
if ( $op eq 'list' ) {
81
    my $jobs =
81
    my $queued_jobs =
82
      $can_manage_background_jobs
82
      $can_manage_background_jobs
83
      ? Koha::BackgroundJobs->search( {},
83
      ? Koha::BackgroundJobs->search( { ended_on => undef },
84
        { order_by => { -desc => 'enqueued_on' } } )
84
        { order_by => { -desc => 'enqueued_on' } } )
85
      : Koha::BackgroundJobs->search(
85
      : Koha::BackgroundJobs->search(
86
        { borrowernumber => $logged_in_user->borrowernumber },
86
        { borrowernumber => $logged_in_user->borrowernumber, ended_on => undef },
87
        { order_by       => { -desc => 'enqueued_on' } }
87
        { order_by       => { -desc => 'enqueued_on' } }
88
      );
88
      );
89
    $template->param( jobs => $jobs );
89
    $template->param( queued => $queued_jobs );
90
91
    my $complete_jobs =
92
      $can_manage_background_jobs
93
      ? Koha::BackgroundJobs->search( { ended_on => { '!=' => undef } },
94
        { order_by => { -desc => 'enqueued_on' } } )
95
      : Koha::BackgroundJobs->search(
96
        { borrowernumber => $logged_in_user->borrowernumber, ended_on => { '!=' => undef } },
97
        { order_by       => { -desc => 'enqueued_on' } }
98
      );
99
    $template->param( complete => $complete_jobs );
90
}
100
}
91
101
92
$template->param(
102
$template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt (-43 / +112 lines)
Lines 156-204 Link Here
156
156
157
    <h1>Background jobs</h1>
157
    <h1>Background jobs</h1>
158
158
159
    [% IF jobs.count %]
159
    <div id="taskstabs" class="toptabs">
160
        <table id="table_background_jobs">
160
        <ul class="nav nav-tabs" role="tablist">
161
            <thead>
161
            <li role="presentation" class="active"><a href="#queued" aria-controls="queued" role="tab" data-toggle="tab">Queued jobs</a></li>
162
                <tr>
162
            <li role="presentation"><a href="#complete" aria-controls="complete" role="tab" data-toggle="tab">Complete jobs</a></li>
163
                    <th>Job ID</th>
163
        </ul>
164
                    <th>Status</th>
164
165
                    <th>Progress</th>
165
        <div class="tab-content">
166
                    <th>Type</th>
166
            <div role="tabpanel" class="tab-pane active" id="queued">
167
                    <th>Queued</th>
167
                <h2>Queued jobs</h2>
168
                    <th>Started</th>
168
169
                    <th>Ended</th>
169
                [% IF queued.count %]
170
                    <th class="noExport">Actions</th>
170
                    <table id="table_queued_jobs">
171
                </tr>
171
                        <thead>
172
            </thead>
172
                            <tr>
173
            <tbody>
173
                                <th>Job ID</th>
174
                [% FOREACH job IN jobs %]
174
                                <th>Status</th>
175
                <tr>
175
                                <th>Progress</th>
176
                    <td>[% job.id | html %]</td>
176
                                <th>Type</th>
177
                    <td>
177
                                <th>Queued</th>
178
                        [% PROCESS show_job_status %]
178
                                <th>Started</th>
179
                    </td>
179
                                <th>Ended</th>
180
                    <td>[% job.progress || 0 | html %] / [% job.size | html %]</td>
180
                                <th class="noExport">Actions</th>
181
                    <td>
181
                            </tr>
182
                        [% PROCESS show_job_type job_type => job.type %]
182
                        </thead>
183
                    </td>
183
                        <tbody>
184
                    <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td>
184
                            [% FOREACH job IN queued %]
185
                    <td>[% job.started_on| $KohaDates with_hours = 1 %]</td>
185
                            <tr>
186
                    <td>[% job.ended_on| $KohaDates with_hours = 1 %]</td>
186
                                <td>[% job.id | html %]</td>
187
                    <td class="actions">
187
                                <td>
188
                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&amp;id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a>
188
                                    [% PROCESS show_job_status %]
189
                        [% IF job.status == 'new' || job.status == 'started' %]
189
                                </td>
190
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&amp;id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a>
190
                                <td>[% job.progress || 0 | html %] / [% job.size | html %]</td>
191
                        [% END %]
191
                                <td>
192
                    </td>
192
                                    [% PROCESS show_job_type job_type => job.type %]
193
                </tr>
193
                                </td>
194
                                <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td>
195
                                <td>[% job.started_on| $KohaDates with_hours = 1 %]</td>
196
                                <td>[% job.ended_on| $KohaDates with_hours = 1 %]</td>
197
                                <td class="actions">
198
                                    <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&amp;id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a>
199
                                    [% IF job.status == 'new' || job.status == 'started' %]
200
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&amp;id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a>
201
                                    [% END %]
202
                                </td>
203
                            </tr>
204
                            [% END %]
205
                        </tbody>
206
                    </table>
207
                [% ELSE %]
208
                    <div class="dialog message">
209
                        There are no queued background jobs yet.
210
                    </div>
194
                [% END %]
211
                [% END %]
195
            </tbody>
212
            </div>
196
        </table>
213
197
    [% ELSE %]
214
            <div role="tabpanel" class="tab-pane active" id="complete">
198
        <div class="dialog message">
215
                <h2>Complete jobs</h2>
199
            There are no background jobs yet.
216
217
                [% IF complete.count %]
218
                    <table id="table_complete_jobs">
219
                        <thead>
220
                            <tr>
221
                                <th>Job ID</th>
222
                                <th>Status</th>
223
                                <th>Progress</th>
224
                                <th>Type</th>
225
                                <th>Queued</th>
226
                                <th>Started</th>
227
                                <th>Ended</th>
228
                                <th class="noExport">Actions</th>
229
                            </tr>
230
                        </thead>
231
                        <tbody>
232
                            [% FOREACH job IN complete %]
233
                            <tr>
234
                                <td>[% job.id | html %]</td>
235
                                <td>
236
                                    [% PROCESS show_job_status %]
237
                                </td>
238
                                <td>[% job.progress || 0 | html %] / [% job.size | html %]</td>
239
                                <td>
240
                                    [% PROCESS show_job_type job_type => job.type %]
241
                                </td>
242
                                <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td>
243
                                <td>[% job.started_on| $KohaDates with_hours = 1 %]</td>
244
                                <td>[% job.ended_on| $KohaDates with_hours = 1 %]</td>
245
                                <td class="actions">
246
                                    <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&amp;id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a>
247
                                    [% IF job.status == 'new' || job.status == 'started' %]
248
                                        <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&amp;id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a>
249
                                    [% END %]
250
                                </td>
251
                            </tr>
252
                            [% END %]
253
                        </tbody>
254
                    </table>
255
                [% ELSE %]
256
                    <div class="dialog message">
257
                        There are no completed background jobs yet.
258
                    </div>
259
                [% END %]
260
            </div>
200
        </div>
261
        </div>
201
    [% END %]
262
    </div>
263
202
[% END %]
264
[% END %]
203
265
204
            </main>
266
            </main>
Lines 216-222 Link Here
216
    [% INCLUDE 'datatables.inc' %]
278
    [% INCLUDE 'datatables.inc' %]
217
    <script>
279
    <script>
218
        $(document).ready(function() {
280
        $(document).ready(function() {
219
            $("#table_background_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
281
            $("#table_queued_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
220
                "aoColumnDefs": [
282
                "aoColumnDefs": [
221
                    { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
283
                    { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
222
                ],
284
                ],
Lines 225-230 Link Here
225
                "sPaginationType": "full_numbers"
287
                "sPaginationType": "full_numbers"
226
            }));
288
            }));
227
289
290
            $("#table_complete_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
291
                "aoColumnDefs": [
292
                    { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
293
                ],
294
                "aaSorting": [[ 0, "desc" ]],
295
                "iDisplayLength": 10,
296
                "sPaginationType": "full_numbers"
297
            }));
228
        });
298
        });
229
    </script>
299
    </script>
230
    [% IF op == 'view' %]
300
    [% IF op == 'view' %]
231
- 

Return to bug 30462