Lines 259-287
Link Here
|
259 |
$("#job_details").show(); |
259 |
$("#job_details").show(); |
260 |
[% END %] |
260 |
[% END %] |
261 |
|
261 |
|
262 |
let additional_filters = { |
262 |
let query_filters = function(){ |
263 |
enqueued_on: function(){ |
263 |
if ( $("#only_current").is(":checked") && !$("#include_last_hour").is(":checked") ) { |
264 |
let now = new Date(); |
264 |
return 'only_current=1&only_last_hour=0'; |
265 |
if ( $("#include_last_hour").is(":checked") ) { |
265 |
} else if ( $("#include_last_hour").is(":checked") && !$("#only_current").is(":checked")) { |
266 |
now.setHours(now.getHours() - 1); |
266 |
return 'only_current=0&only_last_hour=1'; |
267 |
return { ">": now.toISOString() }; |
267 |
} else if ( $("#only_current").is(":checked") && $("#include_last_hour").is(":checked") ) { |
268 |
} else { |
268 |
return 'only_current=1&only_last_hour=1'; |
269 |
return { "<": now.toISOString() }; |
|
|
270 |
} |
271 |
} |
272 |
}; |
273 |
|
274 |
let only_current_filter = function(){ |
275 |
if ( $("#only_current").is(":checked") ) { |
276 |
return 'only_current=1'; |
277 |
} else { |
269 |
} else { |
278 |
return 'only_current=0'; |
270 |
return 'only_current=0&only_last_hour=0'; |
279 |
} |
271 |
} |
280 |
} |
272 |
} |
281 |
|
273 |
|
282 |
let jobs_table = $("#table_jobs").kohaTable({ |
274 |
let jobs_table = $("#table_jobs").kohaTable({ |
283 |
"ajax": { |
275 |
"ajax": { |
284 |
"url": "/api/v1/jobs?" + only_current_filter() |
276 |
"url": "/api/v1/jobs?" + query_filters(), |
285 |
}, |
277 |
}, |
286 |
"order": [[ 1, "desc" ]], |
278 |
"order": [[ 1, "desc" ]], |
287 |
"columns": [ |
279 |
"columns": [ |
Lines 350-364
Link Here
|
350 |
"orderable": false |
342 |
"orderable": false |
351 |
} |
343 |
} |
352 |
] |
344 |
] |
353 |
}, null, 1, additional_filters); |
345 |
}, null, 1); |
354 |
|
|
|
355 |
$("#include_last_hour").on("change", function(){ |
356 |
jobs_table.DataTable().draw(); |
357 |
return false; |
358 |
}); |
359 |
|
346 |
|
360 |
$("#only_current").on("change", function(){ |
347 |
$("#only_current, #include_last_hour").on("change", function(){ |
361 |
jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load(); |
348 |
jobs_table.DataTable().ajax.url("/api/v1/jobs?" + query_filters()).load(); |
362 |
return false; |
349 |
return false; |
363 |
}); |
350 |
}); |
364 |
}); |
351 |
}); |