Bugzilla – Attachment 142860 Details for
Bug 30462
Improve the default display for the background jobs queue management page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30462: [22.05.x] Separate Queued and Complete jobs
Bug-30462-2205x-Separate-Queued-and-Complete-jobs.patch (text/plain), 12.06 KB, created by
Nick Clemens (kidclamp)
on 2022-11-01 11:36:28 UTC
(
hide
)
Description:
Bug 30462: [22.05.x] Separate Queued and Complete jobs
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-11-01 11:36:28 UTC
Size:
12.06 KB
patch
obsolete
>From 88c24a724e7f679dc278442646e21e2c6ea2f232 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 7 Jun 2022 11:08:32 +0100 >Subject: [PATCH] Bug 30462: [22.05.x] Separate Queued and Complete jobs > >This patch updates the background jobs management page to display >queued and completed jobs in their own tabs on the page. > >JD Amended patch: >Fix QA failures: > 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) >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Bug 30462: (follow-up) Limit completed to 60 minutes > >This follow-up reduces the completed jobs list to only those jobs >completed within the last 60 minutes. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Bug 30462: Remove 'Ended' column for current jobs > >This column will always be empty > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Bug 30462: Fix display of the complete jobs > >We want to display the jobs terminated in the last hour, not today. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Bug 30462: (QA follow-up) Tab name change > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > admin/background_jobs.pl | 29 +++- > .../prog/en/modules/admin/background_jobs.tt | 149 +++++++++++++----- > 2 files changed, 132 insertions(+), 46 deletions(-) > >diff --git a/admin/background_jobs.pl b/admin/background_jobs.pl >index a4b7b90c0a..761c09d069 100755 >--- a/admin/background_jobs.pl >+++ b/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( >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 ab1cd65cba..0fafb30da4 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 >@@ -156,49 +156,106 @@ > > <h1>Background jobs</h1> > >- [% IF jobs.count %] >- <table id="table_background_jobs"> >- <thead> >- <tr> >- <th>Job ID</th> >- <th>Status</th> >- <th>Progress</th> >- <th>Type</th> >- <th>Queued</th> >- <th>Started</th> >- <th>Ended</th> >- <th class="noExport">Actions</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH job IN jobs %] >- <tr> >- <td>[% job.id | html %]</td> >- <td> >- [% PROCESS show_job_status %] >- </td> >- <td>[% job.progress || 0 | html %] / [% job.size | html %]</td> >- <td> >- [% PROCESS show_job_type job_type => job.type %] >- </td> >- <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td> >- <td>[% job.started_on| $KohaDates with_hours = 1 %]</td> >- <td>[% job.ended_on| $KohaDates with_hours = 1 %]</td> >- <td class="actions"> >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a> >- [% IF job.status == 'new' || job.status == 'started' %] >- <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a> >- [% END %] >- </td> >- </tr> >+ <div id="taskstabs" class="toptabs"> >+ <ul class="nav nav-tabs" role="tablist"> >+ <li role="presentation" class="active"><a href="#queued" aria-controls="queued" role="tab" data-toggle="tab">Queued jobs</a></li> >+ <li role="presentation"><a href="#complete" aria-controls="complete" role="tab" data-toggle="tab">Completed jobs</a></li> >+ </ul> >+ >+ <div class="tab-content"> >+ <div role="tabpanel" class="tab-pane active" id="queued"> >+ [% IF queued.count %] >+ <table id="table_queued_jobs"> >+ <thead> >+ <tr> >+ <th>Job ID</th> >+ <th>Status</th> >+ <th>Progress</th> >+ <th>Type</th> >+ <th>Queued</th> >+ <th>Started</th> >+ <th class="noExport">Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH job IN queued %] >+ <tr> >+ <td>[% job.id | html %]</td> >+ <td> >+ [% PROCESS show_job_status %] >+ </td> >+ <td>[% job.progress || 0 | html %] / [% job.size | html %]</td> >+ <td> >+ [% PROCESS show_job_type job_type => job.type %] >+ </td> >+ <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td> >+ <td>[% job.started_on| $KohaDates with_hours = 1 %]</td> >+ <td class="actions"> >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a> >+ [% IF job.status == 'new' || job.status == 'started' %] >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <div class="dialog message"> >+ There are no queued background jobs yet. >+ </div> > [% END %] >- </tbody> >- </table> >- [% ELSE %] >- <div class="dialog message"> >- There are no background jobs yet. >+ </div> >+ >+ <div role="tabpanel" class="tab-pane" id="complete"> >+ [% IF complete.count %] >+ <p>Jobs completed in the last 60 minutes.</p> >+ <table id="table_complete_jobs"> >+ <thead> >+ <tr> >+ <th>Job ID</th> >+ <th>Status</th> >+ <th>Progress</th> >+ <th>Type</th> >+ <th>Queued</th> >+ <th>Started</th> >+ <th>Ended</th> >+ <th class="noExport">Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH job IN complete %] >+ <tr> >+ <td>[% job.id | html %]</td> >+ <td> >+ [% PROCESS show_job_status %] >+ </td> >+ <td>[% job.progress || 0 | html %] / [% job.size | html %]</td> >+ <td> >+ [% PROCESS show_job_type job_type => job.type %] >+ </td> >+ <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td> >+ <td>[% job.started_on| $KohaDates with_hours = 1 %]</td> >+ <td>[% job.ended_on| $KohaDates with_hours = 1 %]</td> >+ <td class="actions"> >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a> >+ [% IF job.status == 'new' || job.status == 'started' %] >+ <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <div class="dialog message"> >+ There were no completed background jobs completed in the last 60 minutes. >+ </div> >+ [% END %] >+ </div> > </div> >- [% END %] >+ </div> >+ > [% END %] > > </main> >@@ -216,7 +273,7 @@ > [% INCLUDE 'datatables.inc' %] > <script> > $(document).ready(function() { >- $("#table_background_jobs").dataTable($.extend(true, {}, dataTablesDefaults, { >+ $("#table_queued_jobs").dataTable($.extend(true, {}, dataTablesDefaults, { > "aoColumnDefs": [ > { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, > ], >@@ -225,6 +282,14 @@ > "sPaginationType": "full_numbers" > })); > >+ $("#table_complete_jobs").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "aaSorting": [[ 0, "desc" ]], >+ "iDisplayLength": 10, >+ "sPaginationType": "full_numbers" >+ })); > }); > </script> > [% IF op == 'view' %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30462
:
135570
|
135583
|
135749
|
135750
|
135938
|
136001
|
136002
|
136003
|
136004
|
140145
|
140146
|
140147
|
140148
|
140353
| 142860