@@ -, +, @@
FAIL koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt
FAIL forbidden patterns
forbidden pattern: trailing space char (line 158)
forbidden pattern: trailing space char (line 256)
---
admin/background_jobs.pl | 29 +++-
.../prog/en/modules/admin/background_jobs.tt | 149 +++++++++++++-----
2 files changed, 132 insertions(+), 46 deletions(-)
--- a/admin/background_jobs.pl
+++ a/admin/background_jobs.pl
@@ -19,6 +19,7 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
+use Koha::DateUtils qw( dt_from_string );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
@@ -78,15 +79,35 @@ if ( $op eq 'cancel' ) {
if ( $op eq 'list' ) {
- my $jobs =
+ my $queued_jobs =
$can_manage_background_jobs
- ? Koha::BackgroundJobs->search( {},
+ ? Koha::BackgroundJobs->search( { ended_on => undef },
{ order_by => { -desc => 'enqueued_on' } } )
: Koha::BackgroundJobs->search(
- { borrowernumber => $logged_in_user->borrowernumber },
+ { borrowernumber => $logged_in_user->borrowernumber, ended_on => undef },
{ order_by => { -desc => 'enqueued_on' } }
);
- $template->param( jobs => $jobs );
+ $template->param( queued => $queued_jobs );
+
+ my $ended_since = dt_from_string->subtract( minutes => '60' );
+ my $dtf = Koha::Database->new->schema->storage->datetime_parser;
+
+ my $complete_jobs =
+ $can_manage_background_jobs
+ ? Koha::BackgroundJobs->search(
+ {
+ ended_on => { '>=' => $dtf->format_datetime($ended_since) }
+ },
+ { order_by => { -desc => 'enqueued_on' } }
+ )
+ : Koha::BackgroundJobs->search(
+ {
+ borrowernumber => $logged_in_user->borrowernumber,
+ ended_on => { '>=' => $dtf->format_datetime($ended_since) }
+ },
+ { order_by => { -desc => 'enqueued_on' } }
+ );
+ $template->param( complete => $complete_jobs );
}
$template->param(
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt
@@ -156,49 +156,106 @@
Background jobs
- [% IF jobs.count %]
-
-
-
- Job ID |
- Status |
- Progress |
- Type |
- Queued |
- Started |
- Ended |
- Actions |
-
-
-
- [% FOREACH job IN jobs %]
-
- [% job.id | html %] |
-
- [% PROCESS show_job_status %]
- |
- [% job.progress || 0 | html %] / [% job.size | html %] |
-
- [% PROCESS show_job_type job_type => job.type %]
- |
- [% job.enqueued_on | $KohaDates with_hours = 1 %] |
- [% job.started_on| $KohaDates with_hours = 1 %] |
- [% job.ended_on| $KohaDates with_hours = 1 %] |
-
- View
- [% IF job.status == 'new' || job.status == 'started' %]
- Cancel
- [% END %]
- |
-
+
+
+
+
+
+ [% IF queued.count %]
+
+
+
+ Job ID |
+ Status |
+ Progress |
+ Type |
+ Queued |
+ Started |
+ Actions |
+
+
+
+ [% FOREACH job IN queued %]
+
+ [% job.id | html %] |
+
+ [% PROCESS show_job_status %]
+ |
+ [% job.progress || 0 | html %] / [% job.size | html %] |
+
+ [% PROCESS show_job_type job_type => job.type %]
+ |
+ [% job.enqueued_on | $KohaDates with_hours = 1 %] |
+ [% job.started_on| $KohaDates with_hours = 1 %] |
+
+ View
+ [% IF job.status == 'new' || job.status == 'started' %]
+ Cancel
+ [% END %]
+ |
+
+ [% END %]
+
+
+ [% ELSE %]
+
+ There are no queued background jobs yet.
+
[% END %]
-
-
- [% ELSE %]
-
- There are no background jobs yet.
+
+
+
+ [% IF complete.count %]
+
Jobs completed in the last 60 minutes.
+
+
+
+ Job ID |
+ Status |
+ Progress |
+ Type |
+ Queued |
+ Started |
+ Ended |
+ Actions |
+
+
+
+ [% FOREACH job IN complete %]
+
+ [% job.id | html %] |
+
+ [% PROCESS show_job_status %]
+ |
+ [% job.progress || 0 | html %] / [% job.size | html %] |
+
+ [% PROCESS show_job_type job_type => job.type %]
+ |
+ [% job.enqueued_on | $KohaDates with_hours = 1 %] |
+ [% job.started_on| $KohaDates with_hours = 1 %] |
+ [% job.ended_on| $KohaDates with_hours = 1 %] |
+
+ View
+ [% IF job.status == 'new' || job.status == 'started' %]
+ Cancel
+ [% END %]
+ |
+
+ [% END %]
+
+
+ [% ELSE %]
+
+ There were no completed background jobs completed in the last 60 minutes.
+
+ [% END %]
+
- [% END %]
+
+
[% END %]
@@ -216,7 +273,7 @@
[% INCLUDE 'datatables.inc' %]
[% IF op == 'view' %]
--