Bugzilla – Attachment 135750 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: Separate Queued and Complete jobs
Bug-30462-Separate-Queued-and-Complete-jobs.patch (text/plain), 10.52 KB, created by
Martin Renvoize (ashimema)
on 2022-06-07 10:11:45 UTC
(
hide
)
Description:
Bug 30462: Separate Queued and Complete jobs
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-06-07 10:11:45 UTC
Size:
10.52 KB
patch
obsolete
>From 90b7a0bd49d175c19fea24ef7d4d23382a9eca0c 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: 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. >--- > admin/background_jobs.pl | 18 +- > .../prog/en/modules/admin/background_jobs.tt | 155 +++++++++++++----- > 2 files changed, 127 insertions(+), 46 deletions(-) > >diff --git a/admin/background_jobs.pl b/admin/background_jobs.pl >index 8a27c00a27..326e8d596c 100755 >--- a/admin/background_jobs.pl >+++ b/admin/background_jobs.pl >@@ -76,15 +76,25 @@ 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 $complete_jobs = >+ $can_manage_background_jobs >+ ? Koha::BackgroundJobs->search( { ended_on => { '!=' => undef } }, >+ { order_by => { -desc => 'enqueued_on' } } ) >+ : Koha::BackgroundJobs->search( >+ { borrowernumber => $logged_in_user->borrowernumber, ended_on => { '!=' => undef } }, >+ { 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 4da24feed3..216052d7d7 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 >@@ -155,50 +155,113 @@ > [% IF op == 'list' %] > > <h1>Background jobs</h1> >+ >+ <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">Complete jobs</a></li> >+ </ul> > >- [% 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 class="tab-content"> >+ <div role="tabpanel" class="tab-pane active" id="queued"> >+ <h2>Queued jobs</h2> >+ >+ [% 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>Ended</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>[% 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 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 active" id="complete"> >+ <h2>Complete jobs</h2> >+ >+ [% IF complete.count %] >+ <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 are no completed background jobs yet. >+ </div> >+ [% END %] >+ </div> >+ > </div> >- [% END %] >+ </div> >+ > [% END %] > > </main> >@@ -216,7 +279,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 +288,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.20.1
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