Owen Leonard
6f6af47c15
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
311 lines
14 KiB
Text
311 lines
14 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE KohaDates %]
|
|
[% SET footerjs = 1 %]
|
|
[% BLOCK show_job_status %]
|
|
[% SWITCH job.status %]
|
|
[% CASE "new" %]
|
|
New
|
|
[% CASE "cancelled" %]
|
|
Cancelled
|
|
[% CASE "finished" %]
|
|
Finished
|
|
[% CASE "started" %]
|
|
Started
|
|
[% CASE "running" %]
|
|
Running
|
|
[% CASE # Default case %]
|
|
[% job.status | html %]
|
|
[% END -%]
|
|
[% END %]
|
|
[% BLOCK show_job_type %]
|
|
[% SWITCH job.type %]
|
|
[% CASE "batch_biblio_record_modification" %]
|
|
Batch bibliographic record modification
|
|
[% CASE "batch_authority_record_modification" %]
|
|
Batch authority record modification
|
|
[% CASE # Default case %]
|
|
[% job.type | html %]
|
|
[% END %]
|
|
[% END %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>
|
|
[% IF op == 'view' %]
|
|
Details of job #[% job.id | html %] ›
|
|
[% END %]
|
|
Background jobs ›
|
|
Administration › Koha
|
|
</title>
|
|
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="admin_background_jobs" class="admin">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'prefs-admin-search.inc' %]
|
|
|
|
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
|
<ol>
|
|
<li>
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
|
</li>
|
|
|
|
[% IF CAN_user_parameters_manage_background_jobs %]
|
|
<li>
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
|
</li>
|
|
[% IF op == 'view' %]
|
|
<li>
|
|
<a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" aria-current="page">Details of job #[% job.id | html %]</a>
|
|
</li>
|
|
[% ELSE %]
|
|
<li>
|
|
<a href="#" aria-current="page">Background jobs</a>
|
|
</li>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<li>
|
|
<a href="#" aria-current="page">Administration</a>
|
|
</li>
|
|
[% END %]
|
|
</ol>
|
|
</nav>
|
|
|
|
<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 message">
|
|
[% SWITCH m.code %]
|
|
[% CASE 'cannot_view_job' %]
|
|
<div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
|
|
[% CASE %]
|
|
[% m.code | html %]
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'view' %]
|
|
<h1>Details 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>
|
|
[% PROCESS show_job_status %]
|
|
</li>
|
|
<li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li>
|
|
<li>
|
|
<label for="job_type">Type: </label>
|
|
[% PROCESS show_job_type %]
|
|
</li>
|
|
<li>
|
|
<label for="job_enqueued_on">Queued: </label>
|
|
[% job.enqueued_on | $KohaDates with_hours = 1 %]
|
|
</li>
|
|
<li>
|
|
<label for="job_started_on">Started: </label>
|
|
[% job.started_on | $KohaDates with_hours = 1 %]
|
|
</li>
|
|
<li>
|
|
<label for="job_ended_on">Ended: </label>
|
|
[% job.ended_on | $KohaDates with_hours = 1 %]
|
|
</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>
|
|
[% IF lists.count %]
|
|
<br />
|
|
Add modified records to the following list:
|
|
<select name="add_bibs_to_list" id="add_bibs_to_list">
|
|
<option value="">Select a list</option>
|
|
[% FOREACH list IN lists %]
|
|
<option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% END %]
|
|
</div>
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
[% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred.
|
|
[% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %]
|
|
<a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
|
|
</div>
|
|
[% END %]
|
|
[% END %]
|
|
[% CASE 'batch_authority_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.
|
|
[% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %]
|
|
<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 "[% job.type | html %]" not handled in the template
|
|
[% 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.[% IF m.error %] ([% m.error | html %])[% END %].
|
|
[% 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 'batch_authority_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 'authority_not_modified' %]
|
|
Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has not been modified. An error occurred on modifying it[% IF m.error %] ([% m.error | html %])[% END %].
|
|
[% CASE 'authority_modified' %]
|
|
Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has successfully been modified.
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
[% CASE %]Job type "[% job.type | html %]" not handled in the template
|
|
[% END %]
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
[% IF CAN_user_parameters_manage_background_jobs %]
|
|
<fieldset class="action">
|
|
<a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
|
|
</fieldset>
|
|
[% END %]
|
|
[% 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>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>
|
|
[% SWITCH job.type %]
|
|
[% CASE 'batch_biblio_record_modification' %]Batch bibliographic record modification
|
|
[% CASE 'batch_authority_record_modification' %]Batch authority record modification
|
|
[% CASE %][% job.type | html %]
|
|
[% END %]
|
|
</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 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_background_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
|
|
],
|
|
"aaSorting": [[ 0, "desc" ]],
|
|
"iDisplayLength": 10,
|
|
"sPaginationType": "full_numbers"
|
|
}));
|
|
|
|
$("#add_bibs_to_list").change(function(){
|
|
var selected = $("#add_bibs_to_list").find("option:selected");
|
|
if ( selected.attr("class") == "shelf" ){
|
|
var shelfnumber = selected.attr("value");
|
|
var bibs = new Array();
|
|
[% FOREACH message IN job.messages %]
|
|
[% IF message.code == 'biblio_modified' %]
|
|
bibs.push("biblionumber="+[% message.biblionumber | html %]);
|
|
[% END %]
|
|
[% END %]
|
|
var bibstring = bibs.join("&");
|
|
window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizable=yes');
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|