Bugzilla – Attachment 108029 Details for
Bug 22417
Add a task queue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22417: Add GUI to watch the progress of jobs
Bug-22417-Add-GUI-to-watch-the-progress-of-jobs.patch (text/plain), 10.33 KB, created by
David Cook
on 2020-08-11 08:17:42 UTC
(
hide
)
Description:
Bug 22417: Add GUI to watch the progress of jobs
Filename:
MIME Type:
Creator:
David Cook
Created:
2020-08-11 08:17:42 UTC
Size:
10.33 KB
patch
obsolete
>From 9135186930ff57c39d1ade7ae75cff1d8fba0dac Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 25 Feb 2019 21:45:35 -0300 >Subject: [PATCH] Bug 22417: Add GUI to watch the progress of jobs > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: David Cook <dcook@prosentient.com.au> >--- > admin/background_jobs.pl | 67 +++++++++ > .../prog/en/modules/admin/background_jobs.tt | 165 +++++++++++++++++++++ > 2 files changed, 232 insertions(+) > create mode 100755 admin/background_jobs.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt > >diff --git a/admin/background_jobs.pl b/admin/background_jobs.pl >new file mode 100755 >index 0000000000..2b4ca03dbf >--- /dev/null >+++ b/admin/background_jobs.pl >@@ -0,0 +1,67 @@ >+#! /usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use CGI qw ( -utf8 ); >+use JSON qw( decode_json ); >+use C4::Context; >+use C4::Auth; >+use C4::Output; >+ >+use Koha::BackgroundJob; >+use Koha::BackgroundJobs; >+ >+my $input = new CGI; >+my $op = $input->param('op') || 'list'; >+my @messages; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "admin/background_jobs.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { parameters => 'manage_background_jobs' }, # TODO Add this new permission, so far only works for superlibrarians >+ debug => 1, >+ } >+); >+ >+my $dbh = C4::Context->dbh; >+ >+if ( $op eq 'view' ) { >+ my $id = $input->param('id'); >+ if ( my $job = Koha::BackgroundJobs->find($id) ) { >+ $template->param( >+ job => $job, >+ ); >+ } else { >+ $op = 'list'; >+ } >+ >+} >+ >+if ( $op eq 'list' ) { >+ my $jobs = Koha::BackgroundJobs->search({}, { order_by => { -desc => 'enqueued_on' }}); >+ $template->param( jobs => $jobs, ); >+} >+ >+$template->param( >+ messages => \@messages, >+ op => $op, >+); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >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 >new file mode 100644 >index 0000000000..5d42f4ad08 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt >@@ -0,0 +1,165 @@ >+[% USE raw %] >+[% USE Asset %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Administration › [% IF op =='add_form' %]Background jobs› [% IF job %] View background job[% ELSE %] Background jobs[% END %][% END %]</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="admin_background_jobs" class="admin"> >+[% INCLUDE 'header.inc' %] >+ >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+ › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> >+ › <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a> >+</div> >+ >+<div class="main container-fluid"> >+ <div class="row"> >+ <div class="col-sm-10 col-sm-push-2"> >+ <main> >+ >+[% FOR m IN messages %] >+ <div class="dialog [% m.type | html %]"> >+ [% SWITCH m.code %] >+ [% CASE %] >+ [% m.code | html %] >+ [% END %] >+ </div> >+[% END %] >+ >+[% IF op == 'view' %] >+ <h1>Detail of job #[% job.id | html %]</h1> >+ >+ <fieldset class="rows"> >+ <ol> >+ <li><span class="label">Job ID: </span>[% job.id | html %]</li> >+ <li><label for="job_status">Status: </label>[% job.status | html %]</li> >+ <li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li> >+ <li><label for="job_type">Type: </label>[% job.type | html %]</li> >+ <li><label for="job_enqueued_on">enqueued_on: </label>[% job.enqueued_on | html %]</li> >+ <li><label for="job_started_on">started_on: </label>[% job.started_on | html %]</li> >+ <li><label for="job_ended_on">ended_on: </label>[% job.ended_on | html %]</li> >+ <li><label for="job_data">Report: </label> >+ [% SWITCH job.type %] >+ [% CASE 'batch_biblio_record_modification' %] >+ [% SET report = job.report %] >+ [% IF report %] >+ [% IF report.total_records == report.total_success %] >+ <div class="dialog message"> >+ All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >+ </div> >+ [% ELSE %] >+ <div class="dialog message"> >+ [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred. <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a> >+ </div> >+ [% END %] >+ [% END %] >+ [% CASE %][% job.type | html %] >+ [% END %] >+ </li> >+ <li><label for="job_data">Detailed messages: </label> >+ [% SWITCH job.type %] >+ [% CASE 'batch_biblio_record_modification' %] >+ [% FOR m IN job.messages %] >+ <div class="dialog message"> >+ [% IF m.type == 'success' %] >+ <i class="fa fa-check success"></i> >+ [% ELSIF m.type == 'warning' %] >+ <i class="fa fa-warning warn"></i> >+ [% ELSIF m.type == 'error' %] >+ <i class="fa fa-exclamation error"></i> >+ [% END %] >+ [% SWITCH m.code %] >+ [% CASE 'biblio_not_modified' %] >+ Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has not been modified. An error occurred on modifying it. >+ [% CASE 'biblio_modified' %] >+ Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has successfully been modified. >+ [% END %] >+ </div> >+ [% END %] >+ [% CASE %][% job.type | html %] >+ [% END %] >+ </li> >+ </ol> >+ </fieldset> >+ >+ <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a> >+[% END %] >+ >+[% IF op == 'list' %] >+ >+ <h2>Background jobs</h2> >+ >+ [% IF jobs.count %] >+ <table id="table_background_jobs"> >+ <thead> >+ <tr> >+ <th>Job ID</th> >+ <th>Status</th> >+ <th>Progress</th> >+ <th>Type</th> >+ <th>Enqueued on</th> >+ <th>Started on</th> >+ <th>Ended on</th> >+ <th>Actions (NIY)</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH job IN jobs %] >+ <tr> >+ <td>[% job.id | html %]</td> >+ <td>[% job.status | html %]</td> >+ <td>[% job.progress || 0 | html %] / [% job.size | html %]</td> >+ <td> >+ [% SWITCH job.type %] >+ [% CASE 'batch_biblio_record_modification' %]Batch bibliographic record modification >+ [% CASE %][% job.type | html %] >+ [% END %] >+ </td> >+ <td>[% job.enqueued_on | html %]</td> >+ <td>[% job.started_on| html %]</td> >+ <td>[% job.ended_on| html %]</td> >+ <td class="actions"> >+ <a class="btn btn-default btn-xs disabled" href="/cgi-bin/koha/admin/background_jobs.pl?op=delete_confirm&id=[% job.id | html %]"><i class="fa fa-pencil"></i> Delete</a> >+ <a class="btn btn-default btn-xs disabled" href="/cgi-bin/koha/admin/background_jobs.pl?op=replay&id=[% job.id | html %]"><i class="fa fa-trash"></i> Replay</a> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <div class="dialog message"> >+ There are no background jobs yet. >+ </div> >+ [% END %] >+[% END %] >+ >+ </main> >+ </div> <!-- /.col-sm-10.col-sm-push-2 --> >+ >+ <div class="col-sm-2 col-sm-pull-10"> >+ <aside> >+ [% INCLUDE 'admin-menu.inc' %] >+ </aside> >+ </div> <!-- /.col-sm-2.col-sm-pull-10 --> >+ </div> <!-- /.row --> >+ >+[% MACRO jsinclude BLOCK %] >+ [% Asset.js("js/admin-menu.js") | $raw %] >+ [% INCLUDE 'datatables.inc' %] >+ <script> >+ $(document).ready(function() { >+ $("#table_cities").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "aaSorting": [[ 1, "asc" ]], >+ "iDisplayLength": 10, >+ "sPaginationType": "full_numbers" >+ })); >+ }); >+ </script> >+[% END %] >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.11.0
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 22417
:
105542
|
105543
|
107385
|
107386
|
107387
|
107388
|
107389
|
107390
|
107391
|
107392
|
107393
|
107394
|
107395
|
107396
|
107397
|
107398
|
107399
|
107400
|
107401
|
107402
|
107403
|
107404
|
107405
|
107406
|
107481
|
107482
|
107682
|
108023
|
108024
|
108025
|
108026
|
108027
|
108028
|
108029
|
108030
|
108031
|
108032
|
108033
|
108034
|
108035
|
108036
|
108037
|
108038
|
108039
|
108040
|
108041
|
108042
|
108043
|
108044
|
108045
|
108046
|
108047
|
109270
|
109271
|
109319
|
109320
|
109321
|
109322
|
109323
|
109324
|
109325
|
109326
|
109327
|
109328
|
109329
|
109330
|
109331
|
109332
|
109333
|
109334
|
109335
|
109336
|
109337
|
109338
|
109339
|
109340
|
109341
|
109342
|
109343
|
109344
|
109345
|
109350
|
109351
|
109355
|
109390
|
109391
|
109392
|
109393
|
109394
|
109395
|
109396
|
109397
|
109398
|
109399
|
109400
|
109401
|
109402
|
109403
|
109404
|
109405
|
109406
|
109407
|
109408
|
109409
|
109410
|
109411
|
109412
|
109413
|
109414
|
109415
|
109416
|
109417
|
109418
|
109474
|
109475
|
109476
|
109477
|
110150
|
111091
|
111092
|
111093
|
111094
|
111095
|
111096
|
111097
|
111098
|
111099
|
111100
|
111101
|
111102
|
111103
|
111104
|
111105
|
111106
|
111107
|
111108
|
111109
|
111110
|
111111
|
111112
|
111113
|
111114
|
111115
|
111116
|
111117
|
111118
|
111119
|
111120
|
111121
|
111238
|
111239
|
111245