Bug 29263: (bug 24387 follow-up) Fix 'Cancel' link when editing a html custom
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / background_jobs.tt
1 [% USE raw %]
2 [% USE KohaDates %]
3 [% USE Asset %]
4 [% USE KohaDates %]
5 [% SET footerjs = 1 %]
6 [% BLOCK show_job_status %]
7     [% SWITCH job.status %]
8         [% CASE "new" %]
9             New
10         [% CASE "cancelled" %]
11             Cancelled
12         [% CASE "finished" %]
13             Finished
14         [% CASE "started" %]
15             Started
16         [% CASE "running" %]
17             Running
18         [% CASE # Default case %]
19             [% job.status | html %]
20     [% END -%]
21 [% END %]
22 [% BLOCK show_job_type %]
23     [% SWITCH job_type %]
24     [% CASE 'batch_biblio_record_modification' %]
25         Batch bibliographic record modification
26     [% CASE 'batch_biblio_record_deletion' %]
27         Batch bibliographic record record deletion
28     [% CASE 'batch_authority_record_modification' %]
29         Batch authority record modification
30     [% CASE 'batch_authority_record_deletion' %]
31         Batch authority record deletion
32     [% CASE 'batch_item_record_modification' %]
33         Batch item record modification
34     [% CASE 'batch_item_record_deletion' %]
35         Batch item record deletion
36     [% CASE "batch_hold_cancel" %]
37         Batch hold cancellation
38     [% CASE %]Unknown job type '[% job_type | html %]'
39     [% END %]
40
41 [% END %]
42 [% INCLUDE 'doc-head-open.inc' %]
43 <title>
44     [% IF op == 'view' %]
45         Details of job #[% job.id | html %] &rsaquo;
46     [% END %]
47     Background jobs &rsaquo;
48     Administration &rsaquo; Koha
49 </title>
50
51 [% INCLUDE 'doc-head-close.inc' %]
52 </head>
53
54 <body id="admin_background_jobs" class="admin">
55 [% INCLUDE 'header.inc' %]
56 [% INCLUDE 'prefs-admin-search.inc' %]
57
58 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
59     <ol>
60         <li>
61             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
62         </li>
63
64     [% IF CAN_user_parameters_manage_background_jobs %]
65         <li>
66             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
67         </li>
68         [% IF op == 'view' %]
69             <li>
70                 <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>
71             </li>
72             <li>
73                 <a href="#" aria-current="page">Details of job #[% job.id | html %]</a>
74             </li>
75         [% ELSE %]
76             <li>
77                 <a href="#" aria-current="page">Background jobs</a>
78             </li>
79         [% END %]
80     [% ELSE %]
81         <li>
82             <a href="#" aria-current="page">Administration</a>
83         </li>
84     [% END %]
85     </ol>
86 </nav>
87
88 <div class="main container-fluid">
89     <div class="row">
90         <div class="col-sm-10 col-sm-push-2">
91             <main>
92
93 [% FOR m IN messages %]
94     <div class="dialog message">
95         [% SWITCH m.code %]
96         [% CASE 'cannot_view_job' %]
97             <div><i class="fa fa-exclamation error"></i>Insufficient permission to see this job.</div>
98         [% CASE %]
99             [% m.code | html %]
100         [% END %]
101     </div>
102 [% END %]
103
104 [% IF op == 'view' %]
105     <h1>Details of job #[% job.id | html %]</h1>
106
107     [% PROCESS "background_jobs/${job.type}.inc" %]
108
109     <fieldset class="rows">
110         <ol>
111             <li><span class="label">Job ID: </span>[% job.id | html %]</li>
112             <li>
113                 <label for="job_status">Status: </label>
114                 [% PROCESS show_job_status %]
115             </li>
116             <li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li>
117             <li>
118                 <label for="job_type">Type: </label>
119                 [% PROCESS show_job_type job_type => job.type %]
120             </li>
121             <li>
122                 <label for="job_enqueued_on">Queued: </label>
123                 [% job.enqueued_on | $KohaDates with_hours = 1 %]
124             </li>
125             <li>
126                 <label for="job_started_on">Started: </label>
127                 [% job.started_on | $KohaDates with_hours = 1 %]
128             </li>
129             <li>
130                 <label for="job_ended_on">Ended: </label>
131                 [% job.ended_on | $KohaDates with_hours = 1 %]
132             </li>
133             <li><label for="job_data">Report: </label>
134                 [% PROCESS 'report' %]
135             </li>
136             <li><label for="job_data">Detailed messages: </label>
137                 [% PROCESS 'detail' %]
138             </li>
139         </ol>
140     </fieldset>
141
142     [% IF CAN_user_parameters_manage_background_jobs %]
143         <fieldset class="action">
144             <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
145         </fieldset>
146     [% END %]
147 [% END %]
148
149 [% IF op == 'list' %]
150
151     <h2>Background jobs</h2>
152
153     [% IF jobs.count %]
154         <table id="table_background_jobs">
155             <thead>
156                 <tr>
157                     <th>Job ID</th>
158                     <th>Status</th>
159                     <th>Progress</th>
160                     <th>Type</th>
161                     <th>Queued</th>
162                     <th>Started</th>
163                     <th>Ended</th>
164                     <th class="noExport">Actions</th>
165                 </tr>
166             </thead>
167             <tbody>
168                 [% FOREACH job IN jobs %]
169                 <tr>
170                     <td>[% job.id | html %]</td>
171                     <td>
172                         [% PROCESS show_job_status %]
173                     </td>
174                     <td>[% job.progress || 0 | html %] / [% job.size | html %]</td>
175                     <td>
176                         [% PROCESS show_job_type job_type => job.type %]
177                     </td>
178                     <td>[% job.enqueued_on | $KohaDates with_hours = 1 %]</td>
179                     <td>[% job.started_on| $KohaDates with_hours = 1 %]</td>
180                     <td>[% job.ended_on| $KohaDates with_hours = 1 %]</td>
181                     <td class="actions">
182                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&amp;id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a>
183                         [% IF job.status == 'new' || job.status == 'started' %]
184                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&amp;id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a>
185                         [% END %]
186                     </td>
187                 </tr>
188                 [% END %]
189             </tbody>
190         </table>
191     [% ELSE %]
192         <div class="dialog message">
193             There are no background jobs yet.
194         </div>
195     [% END %]
196 [% END %]
197
198             </main>
199         </div> <!-- /.col-sm-10.col-sm-push-2 -->
200
201         <div class="col-sm-2 col-sm-pull-10">
202             <aside>
203                 [% INCLUDE 'admin-menu.inc' %]
204             </aside>
205         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
206      </div> <!-- /.row -->
207
208 [% MACRO jsinclude BLOCK %]
209     [% Asset.js("js/admin-menu.js") | $raw %]
210     [% INCLUDE 'datatables.inc' %]
211     <script>
212         $(document).ready(function() {
213             $("#table_background_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
214                 "aoColumnDefs": [
215                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
216                 ],
217                 "aaSorting": [[ 0, "desc" ]],
218                 "iDisplayLength": 10,
219                 "sPaginationType": "full_numbers"
220             }));
221
222         });
223     </script>
224     [% IF op == 'view' %]
225         [% PROCESS 'js' %]
226     [% END %]
227 [% END %]
228
229 [% INCLUDE 'intranet-bottom.inc' %]