Lines 119-133
Link Here
|
119 |
<h1>Jobs</h1> |
119 |
<h1>Jobs</h1> |
120 |
|
120 |
|
121 |
<div> |
121 |
<div> |
122 |
<input type="checkbox" id="only_current" checked /> |
122 |
<input type="checkbox" id="only_current" /> |
123 |
<label for="only_current">Current jobs only</label> |
123 |
<label for="only_current">Current jobs only</label> |
124 |
</div> |
124 |
</div> |
125 |
|
125 |
|
126 |
<div> |
|
|
127 |
<input type="checkbox" id="include_last_hour" checked /> |
128 |
<label for="include_last_hour">Only include jobs enqueued in the last hour</label> |
129 |
</div> |
130 |
|
131 |
<div class="page-section"> |
126 |
<div class="page-section"> |
132 |
<table id="table_jobs"> |
127 |
<table id="table_jobs"> |
133 |
<thead> |
128 |
<thead> |
Lines 259-274
Link Here
|
259 |
$("#job_details").show(); |
254 |
$("#job_details").show(); |
260 |
[% END %] |
255 |
[% END %] |
261 |
|
256 |
|
262 |
let additional_filters = { |
|
|
263 |
enqueued_date: function(){ |
264 |
if ( $("#include_last_hour").is(":checked") ) { |
265 |
return { ">": dayjs().subtract(1, 'hour').format() }; |
266 |
} else { |
267 |
return { "<": dayjs().format()}; |
268 |
} |
269 |
} |
270 |
}; |
271 |
|
272 |
let only_current_filter = function(){ |
257 |
let only_current_filter = function(){ |
273 |
if ( $("#only_current").is(":checked") ) { |
258 |
if ( $("#only_current").is(":checked") ) { |
274 |
return 'only_current=1'; |
259 |
return 'only_current=1'; |
Lines 281-287
Link Here
|
281 |
"ajax": { |
266 |
"ajax": { |
282 |
"url": "/api/v1/jobs?" + only_current_filter() |
267 |
"url": "/api/v1/jobs?" + only_current_filter() |
283 |
}, |
268 |
}, |
284 |
"order": [[ 1, "desc" ]], |
269 |
"order": [[ 4, "desc" ]], |
285 |
"columns": [ |
270 |
"columns": [ |
286 |
{ |
271 |
{ |
287 |
"data": "job_id", |
272 |
"data": "job_id", |
Lines 348-359
Link Here
|
348 |
"orderable": false |
333 |
"orderable": false |
349 |
} |
334 |
} |
350 |
] |
335 |
] |
351 |
}, null, 1, additional_filters); |
336 |
}, null, 1); |
352 |
|
|
|
353 |
$("#include_last_hour").on("change", function(){ |
354 |
jobs_table.DataTable().draw(); |
355 |
return false; |
356 |
}); |
357 |
|
337 |
|
358 |
$("#only_current").on("change", function(){ |
338 |
$("#only_current").on("change", function(){ |
359 |
jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load(); |
339 |
jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load(); |
360 |
- |
|
|