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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
27 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
30 [% IF CAN_user_parameters_manage_background_jobs %]
32 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
36 <a href="/cgi-bin/koha/admin/background_jobs.pl">Jobs</a>
39 <a href="#" aria-current="page">Details of job #[% job.id | html %]</a>
43 <a href="#" aria-current="page">Jobs</a>
48 <a href="#" aria-current="page">Administration</a>
55 <div class="main container-fluid">
57 <div class="col-sm-10 col-sm-push-2">
60 [% FOR m IN messages %]
61 <div class="dialog message">
63 [% CASE 'cannot_view_job' %]
64 <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
72 <h1>Details of job #[% job.id | html %]</h1>
74 [% PROCESS "background_jobs/${job.type}.inc" %]
76 <div id="job_details" style="display:none">
77 <fieldset class="rows">
79 <li><span class="label">Job ID: </span>[% job.id | html %]</li>
81 <label for="job_status">Status: </label>
82 <span id="job_status_description"></span>
84 <li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li>
86 <label for="job_type">Type: </label>
87 <span id="job_type_description"></span>
90 <label for="job_enqueued_on">Queued: </label>
91 [% job.enqueued_on | $KohaDates with_hours = 1 %]
94 <label for="job_started_on">Started: </label>
95 [% job.started_on | $KohaDates with_hours = 1 %]
98 <label for="job_ended_on">Ended: </label>
99 [% job.ended_on | $KohaDates with_hours = 1 %]
103 <div class="page-section">
105 [% IF job.status != 'new' %][% PROCESS 'report' %][% END %]
107 <div class="page-section">
108 <h2>Detailed messages</h2>
109 [% IF job.status != 'new' %][% PROCESS 'detail' %][% END %]
111 </div> <!-- /#job_details -->
113 [% IF CAN_user_parameters_manage_background_jobs %]
114 <fieldset class="action">
115 <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
120 [% IF op == 'list' %]
125 <input type="checkbox" id="only_current" checked />
126 <label for="only_current">Current jobs only</label>
130 <input type="checkbox" id="include_last_hour" checked />
131 <label for="include_last_hour">Only include jobs started in the last hour</label>
134 <div class="page-section">
135 <table id="table_jobs">
139 <th data-filter="job_statuses">Status</th>
141 <th data-filter="job_types">Type</th>
145 <th class="noExport">Actions</th>
153 </div> <!-- /.col-sm-10.col-sm-push-2 -->
155 <div class="col-sm-2 col-sm-pull-10">
157 [% INCLUDE 'admin-menu.inc' %]
159 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
160 </div> <!-- /.row -->
162 [% MACRO jsinclude BLOCK %]
163 [% Asset.js("js/admin-menu.js") | $raw %]
164 [% INCLUDE 'js-date-format.inc' %]
165 [% INCLUDE 'datatables.inc' %]
167 const job_statuses = [
168 {'_id': 'new', '_str': _("New")},
169 {'_id': 'cancelled', '_str': _("Cancelled")},
170 {'_id': 'finished', '_str': _("Finished")},
171 {'_id': 'started', '_str': _("Started")},
172 {'_id': 'running', '_str': _("Running")},
173 {'_id': 'failed', '_str': _("Failed")},
175 function get_job_status (status) {
176 let status_lib = job_statuses.find( s => s._id == status );
178 return status_lib._str;
185 '_id': 'batch_biblio_record_modification',
186 '_str': _("Batch bibliographic record modification")
189 '_id': 'batch_biblio_record_deletion',
190 '_str': _("Batch bibliographic record record deletion")
193 '_id': 'batch_authority_record_modification',
194 '_str': _("Batch authority record modification")
197 '_id': 'batch_authority_record_deletion',
198 '_str': _("Batch authority record deletion")
201 '_id': 'batch_item_record_modification',
202 '_str': _("Batch item record modification")
205 '_id': 'batch_item_record_deletion',
206 '_str': _("Batch item record deletion")
209 '_id': 'batch_hold_cancel',
210 '_str': _("Batch hold cancellation")
213 '_id': 'create_eholdings_from_biblios',
214 '_str': _("Create eHolding titles")
217 '_id': 'update_elastic_index',
218 '_str': _("Update Elasticsearch index")
221 '_id': 'update_holds_queue_for_biblios',
222 '_str': _("Holds queue update")
225 '_id': 'stage_marc_for_import',
226 '_str': _("Staged MARC records for import")
229 '_id': 'marc_import_commit_batch',
230 '_str': _("Import MARC records")
233 '_id': 'marc_import_revert_batch',
234 '_str': _("Revert import MARC records")
238 function get_job_type (job_type) {
239 let job_type_lib = job_types.find( t => t._id == job_type );
240 if ( job_type_lib ) {
241 return job_type_lib._str;
243 return _("Unknown job type '%s'").format(job_type);
246 $(document).ready(function() {
247 [% IF op == 'view' %]
248 $("#job_status_description").html( get_job_status("[% job.status | html %]") );
249 $("#job_type_description").html( get_job_type("[% job.type | html %]") );
250 $("#job_details").show();
253 let additional_filters = {
254 started_on: function(){
255 let now = new Date();
256 if ( $("#include_last_hour").is(":checked") ) {
257 now.setHours(now.getHours() - 1);
258 return { ">": now.toISOString() };
260 return { "<": now.toISOString() };
265 let only_current_filter = function(){
266 if ( $("#only_current").is(":checked") ) {
267 return 'only_current=1';
269 return 'only_current=0';
273 let jobs_table = $("#table_jobs").kohaTable({
275 "url": "/api/v1/jobs?" + only_current_filter()
277 "order": [[ 1, "desc" ]],
288 "render": function(data, type, row, meta) {
289 return get_job_status(row.status).escapeHtml();
293 "data": "progress,size",
296 "render": function(data, type, row, meta) {
297 return "%s/%s".format(row.progress, row.size).escapeHtml();
304 "render": function(data, type, row, meta) {
305 return get_job_type(row.type).escapeHtml();
309 "data": "enqueued_date",
312 "render": function(data, type, row, meta) {
313 return $datetime(row.enqueued_date);
317 "data": "started_date",
320 "render": function(data, type, row, meta) {
321 return $datetime(row.started_date);
325 "data": "ended_date",
328 "render": function(data, type, row, meta) {
329 return $datetime(row.ended_date);
333 "data": function( row, type, val, meta ) {
334 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";
335 if ( row.status == 'new' || row.status == 'started' ) {
336 result += '<a class="btn btn-default btn-xs" role="button" href="/cgi-bin/koha/admin/bakcground_jobs.pl?op=cancel&id='+ encodeURIComponent(row.job_id) +'"><i class="fa fa-trash" aria-hidden="true"></i> '+_("Cancel")+'</a>';
344 }, null, 1, additional_filters);
346 $("#include_last_hour").on("change", function(){
347 jobs_table.DataTable().draw();
351 $("#only_current").on("change", function(){
352 jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load();
357 [% IF op == 'view' %]
362 [% INCLUDE 'intranet-bottom.inc' %]