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