6 [% INCLUDE 'doc-head-open.inc' %]
9 Details of job #[% job.id | html %] ›
12 Administration › Koha
15 [% INCLUDE 'doc-head-close.inc' %]
18 <body id="admin_background_jobs" class="admin">
19 [% WRAPPER 'header.inc' %]
20 [% INCLUDE 'prefs-admin-search.inc' %]
23 [% WRAPPER 'sub-header.inc' %]
24 [% WRAPPER breadcrumbs %]
25 [% IF CAN_user_parameters_manage_background_jobs %]
26 [% WRAPPER breadcrumb_item %]
27 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
30 [% WRAPPER breadcrumb_item %]
31 <a href="/cgi-bin/koha/admin/background_jobs.pl">Jobs</a>
33 [% WRAPPER breadcrumb_item bc_active= 1 %]
34 <span>Details of job #[% job.id | html %]</span>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
42 [% WRAPPER breadcrumb_item bc_active= 1 %]
43 <span>Administration</span>
46 [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
49 <div class="main container-fluid">
51 <div class="col-sm-10 col-sm-push-2">
54 [% FOR m IN messages %]
55 <div class="dialog message">
57 [% CASE 'cannot_view_job' %]
58 <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
66 <h1>Details of job #[% job.id | html %]</h1>
68 [% PROCESS "background_jobs/${job.type}.inc" %]
70 <div id="job_details" style="display:none">
71 <fieldset class="rows">
73 <li><span class="label">Job ID: </span>[% job.id | html %]</li>
75 <label for="job_status">Status: </label>
76 <span id="job_status_description"></span>
78 <li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li>
80 <label for="job_type">Type: </label>
81 <span id="job_type_description"></span>
84 <label for="job_enqueued_on">Queued: </label>
85 [% job.enqueued_on | $KohaDates with_hours = 1 %]
88 <label for="job_started_on">Started: </label>
89 [% job.started_on | $KohaDates with_hours = 1 %]
92 <label for="job_ended_on">Ended: </label>
93 [% job.ended_on | $KohaDates with_hours = 1 %]
97 <div class="page-section">
99 [% IF job.status != 'new' %][% PROCESS 'report' %][% END %]
101 <div class="page-section">
102 <h2>Detailed messages</h2>
103 [% IF job.status != 'new' %][% PROCESS 'detail' %][% END %]
105 </div> <!-- /#job_details -->
107 [% IF CAN_user_parameters_manage_background_jobs %]
108 <fieldset class="action">
109 <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
114 [% IF op == 'list' %]
119 <input type="checkbox" id="only_current" checked />
120 <label for="only_current">Current jobs only</label>
124 <input type="checkbox" id="include_last_hour" checked />
125 <label for="include_last_hour">Only include jobs enqueued in the last hour</label>
128 <div class="page-section">
129 <table id="table_jobs">
133 <th data-filter="job_statuses">Status</th>
135 <th data-filter="job_types">Type</th>
139 <th class="noExport">Actions</th>
147 </div> <!-- /.col-sm-10.col-sm-push-2 -->
149 <div class="col-sm-2 col-sm-pull-10">
151 [% INCLUDE 'admin-menu.inc' %]
153 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
154 </div> <!-- /.row -->
156 [% MACRO jsinclude BLOCK %]
157 [% Asset.js("js/admin-menu.js") | $raw %]
158 [% INCLUDE 'js-date-format.inc' %]
159 [% INCLUDE 'datatables.inc' %]
161 const job_statuses = [
162 {'_id': 'new', '_str': _("New")},
163 {'_id': 'cancelled', '_str': _("Cancelled")},
164 {'_id': 'finished', '_str': _("Finished")},
165 {'_id': 'started', '_str': _("Started")},
166 {'_id': 'running', '_str': _("Running")},
167 {'_id': 'failed', '_str': _("Failed")},
169 function get_job_status (status) {
170 let status_lib = job_statuses.find( s => s._id == status );
172 return status_lib._str;
179 '_id': 'batch_biblio_record_modification',
180 '_str': _("Batch bibliographic record modification")
183 '_id': 'batch_biblio_record_deletion',
184 '_str': _("Batch bibliographic record deletion")
187 '_id': 'batch_authority_record_modification',
188 '_str': _("Batch authority record modification")
191 '_id': 'batch_authority_record_deletion',
192 '_str': _("Batch authority record deletion")
195 '_id': 'batch_item_record_modification',
196 '_str': _("Batch item record modification")
199 '_id': 'batch_item_record_deletion',
200 '_str': _("Batch item record deletion")
203 '_id': 'batch_hold_cancel',
204 '_str': _("Batch hold cancellation")
207 '_id': 'create_eholdings_from_biblios',
208 '_str': _("Create eHolding titles")
211 '_id': 'update_elastic_index',
212 '_str': _("Update Elasticsearch index")
215 '_id': 'update_holds_queue_for_biblios',
216 '_str': _("Holds queue update")
219 '_id': 'stage_marc_for_import',
220 '_str': _("Staged MARC records for import")
223 '_id': 'marc_import_commit_batch',
224 '_str': _("Import MARC records")
227 '_id': 'marc_import_revert_batch',
228 '_str': _("Revert import MARC records")
232 function get_job_type (job_type) {
233 let job_type_lib = job_types.find( t => t._id == job_type );
234 if ( job_type_lib ) {
235 return job_type_lib._str;
237 return _("Unknown job type '%s'").format(job_type);
240 $(document).ready(function() {
241 [% IF op == 'view' %]
242 $("#job_status_description").html( get_job_status("[% job.status | html %]") );
243 $("#job_type_description").html( get_job_type("[% job.type | html %]") );
244 $("#job_details").show();
247 let additional_filters = {
248 enqueued_on: function(){
249 let now = new Date();
250 if ( $("#include_last_hour").is(":checked") ) {
251 now.setHours(now.getHours() - 1);
252 return { ">": now.toISOString() };
254 return { "<": now.toISOString() };
259 let only_current_filter = function(){
260 if ( $("#only_current").is(":checked") ) {
261 return 'only_current=1';
263 return 'only_current=0';
267 let jobs_table = $("#table_jobs").kohaTable({
269 "url": "/api/v1/jobs?" + only_current_filter()
271 "order": [[ 1, "desc" ]],
282 "render": function(data, type, row, meta) {
283 return get_job_status(row.status).escapeHtml();
287 "data": "progress,size",
290 "render": function(data, type, row, meta) {
291 return "%s/%s".format(row.progress, row.size).escapeHtml();
298 "render": function(data, type, row, meta) {
299 return get_job_type(row.type).escapeHtml();
303 "data": "enqueued_date",
306 "render": function(data, type, row, meta) {
307 return $datetime(row.enqueued_date);
311 "data": "started_date",
314 "render": function(data, type, row, meta) {
315 return $datetime(row.started_date);
319 "data": "ended_date",
322 "render": function(data, type, row, meta) {
323 return $datetime(row.ended_date);
327 "data": function( row, type, val, meta ) {
328 var result = '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id='+ encodeURIComponent(row.job_id) +'"><i class="fa fa-eye" aria-hidden="true"></i> '+_("View")+'</a>'+"\n";
329 if ( row.status == 'new' || row.status == 'started' ) {
330 result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&id='+ encodeURIComponent(row.job_id) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</a>';
338 }, null, 1, additional_filters);
340 $("#include_last_hour").on("change", function(){
341 jobs_table.DataTable().draw();
345 $("#only_current").on("change", function(){
346 jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load();
351 [% IF op == 'view' %]
356 [% INCLUDE 'intranet-bottom.inc' %]