From 1d492f7ff7301f993b4acd07252e838a62e3ca6a Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 4 Oct 2024 13:41:44 +0200 Subject: [PATCH] Bug 37888: Show all jobs, order by "queued", remove last hour filter By default the background jobs page now shows the most recently queued jobs, whatever their status is. By doing that, the jobs enqueued less an hour ago are always visible if there are any (well, the first page at least), so the "last hour" filter becomes way less useful and it's better to remove it as it caused problems (see bug 37905) and the "1 hour" duration was arbitrary. The "current jobs only" filter is still useful as lots of quick background jobs can push running jobs away from the first page and it's a common use case to list running jobs Test plan: 1. Start some background jobs (batch item modification for instance) 2. Make them run and wait for finish 3. Stop the background jobs workers 4. Start some more background jobs 5. You should now have running and non-running background jobs. Go to the admin background jobs page 6. Verify that all background jobs are shown and that they ordered by queued time (last queued job first) 7. Verify that "Current jobs only" filter still works Signed-off-by: Eric Phetteplace Signed-off-by: Martin Renvoize --- .../prog/en/modules/admin/background_jobs.tt | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt index 9ca777c1e00..e6b5fbf38c0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt @@ -119,15 +119,10 @@

Jobs

- +
-
- - -
-
@@ -259,16 +254,6 @@ $("#job_details").show(); [% END %] - let additional_filters = { - enqueued_date: function(){ - if ( $("#include_last_hour").is(":checked") ) { - return { ">": dayjs().subtract(1, 'hour').format() }; - } else { - return { "<": dayjs().format()}; - } - } - }; - let only_current_filter = function(){ if ( $("#only_current").is(":checked") ) { return 'only_current=1'; @@ -281,7 +266,7 @@ "ajax": { "url": "/api/v1/jobs?" + only_current_filter() }, - "order": [[ 1, "desc" ]], + "order": [[ 4, "desc" ]], "columns": [ { "data": "job_id", @@ -348,12 +333,7 @@ "orderable": false } ] - }, null, 1, additional_filters); - - $("#include_last_hour").on("change", function(){ - jobs_table.DataTable().draw(); - return false; - }); + }, null, 1); $("#only_current").on("change", function(){ jobs_table.DataTable().ajax.url("/api/v1/jobs?" + only_current_filter()).load(); -- 2.47.0