1 | <%-- $Id: list_jobs.jsp 5425 2010-09-23 13:30:07Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
---|
4 | Copyright (C) 2007 Johan Enell, Nicklas Nordborg |
---|
5 | |
---|
6 | This file is part of BASE - BioArray Software Environment. |
---|
7 | Available at http://base.thep.lu.se/ |
---|
8 | |
---|
9 | BASE is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License |
---|
11 | as published by the Free Software Foundation; either version 3 |
---|
12 | of the License, or (at your option) any later version. |
---|
13 | |
---|
14 | BASE is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ------------------------------------------------------------------ |
---|
22 | |
---|
23 | @author Nicklas |
---|
24 | @version 2.0 |
---|
25 | --%> |
---|
26 | <%@ page session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.Item" |
---|
30 | import="net.sf.basedb.core.Job" |
---|
31 | import="net.sf.basedb.core.JobAgent" |
---|
32 | import="net.sf.basedb.core.ItemQuery" |
---|
33 | import="net.sf.basedb.core.Include" |
---|
34 | import="net.sf.basedb.core.ItemResultIterator" |
---|
35 | import="net.sf.basedb.core.ItemResultList" |
---|
36 | import="net.sf.basedb.core.ItemContext" |
---|
37 | import="net.sf.basedb.core.Permission" |
---|
38 | import="net.sf.basedb.core.PluginDefinition" |
---|
39 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
40 | import="net.sf.basedb.core.query.Hql" |
---|
41 | import="net.sf.basedb.core.query.Orders" |
---|
42 | import="net.sf.basedb.core.query.Restrictions" |
---|
43 | import="net.sf.basedb.core.query.Expressions" |
---|
44 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
45 | import="net.sf.basedb.core.plugin.Plugin" |
---|
46 | import="net.sf.basedb.util.Enumeration" |
---|
47 | import="net.sf.basedb.clients.web.Base" |
---|
48 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
49 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
50 | import="net.sf.basedb.clients.web.util.HTML" |
---|
51 | import="net.sf.basedb.util.Values" |
---|
52 | import="net.sf.basedb.util.formatter.Formatter" |
---|
53 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
54 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
55 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
56 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
57 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
58 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
59 | import="java.util.List" |
---|
60 | import="java.util.Map" |
---|
61 | import="java.util.Date" |
---|
62 | %> |
---|
63 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
64 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
65 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
66 | <%! |
---|
67 | private static final Item itemType = Item.JOB; |
---|
68 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
69 | |
---|
70 | private static final Enumeration<String, String> status = new Enumeration<String, String>(); |
---|
71 | private static final Enumeration<String, String> pluginTypes = new Enumeration<String, String>(); |
---|
72 | private static final Enumeration<String, String> execTime = new Enumeration<String, String>(); |
---|
73 | static |
---|
74 | { |
---|
75 | for (Job.Status s : Job.Status.values()) |
---|
76 | { |
---|
77 | status.add(Integer.toString(s.getValue()), HTML.encodeTags(s.toString())); |
---|
78 | } |
---|
79 | for (Plugin.MainType pt : Plugin.MainType.values()) |
---|
80 | { |
---|
81 | pluginTypes.add(Integer.toString(pt.getValue()), HTML.encodeTags(pt.toString())); |
---|
82 | } |
---|
83 | for (Job.ExecutionTime et : Job.ExecutionTime.values()) |
---|
84 | { |
---|
85 | execTime.add(Integer.toString(et.getValue()), HTML.encodeTags(et.toString())); |
---|
86 | } |
---|
87 | } |
---|
88 | %> |
---|
89 | <% |
---|
90 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
91 | final String ID = sc.getId(); |
---|
92 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
93 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
94 | final Date now = new Date(); |
---|
95 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
96 | final String callback = request.getParameter("callback"); |
---|
97 | final String title = mode.generateTitle("job", "jobs"); |
---|
98 | final DbControl dc = sc.newDbControl(); |
---|
99 | ItemResultIterator<Job> jobs = null; |
---|
100 | try |
---|
101 | { |
---|
102 | |
---|
103 | // Get all job agents |
---|
104 | final ItemQuery<JobAgent> agentQuery = JobAgent.getQuery(); |
---|
105 | agentQuery.include(Include.ALL); |
---|
106 | agentQuery.order(Orders.asc(Hql.property("name"))); |
---|
107 | agentQuery.setCacheResult(true); |
---|
108 | Enumeration<String, String> agents = new Enumeration<String, String>(); |
---|
109 | for (JobAgent a : agentQuery.list(dc)) |
---|
110 | { |
---|
111 | agents.add(Integer.toString(a.getId()), a.getName()); |
---|
112 | } |
---|
113 | |
---|
114 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
115 | try |
---|
116 | { |
---|
117 | final ItemQuery<Job> query = Base.getConfiguredQuery(cc, true, Job.getQuery(), mode); |
---|
118 | jobs = query.iterate(dc); |
---|
119 | } |
---|
120 | catch (Throwable t) |
---|
121 | { |
---|
122 | cc.setMessage(t.getMessage()); |
---|
123 | } |
---|
124 | int numListed = 0; |
---|
125 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
126 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
127 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
128 | %> |
---|
129 | <base:page title="<%=title==null ? "Jobs" : title%>" type="<%=mode.getPageType()%>"> |
---|
130 | <base:head scripts="menu.js,table.js" styles="menu.css,table.css,progressbar.css"> |
---|
131 | <ext:scripts context="<%=jspContext%>" /> |
---|
132 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
133 | <script language="JavaScript"> |
---|
134 | var submitPage = 'index.jsp'; |
---|
135 | var formId = 'jobs'; |
---|
136 | function viewItem(itemId) |
---|
137 | { |
---|
138 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
139 | } |
---|
140 | function itemOnClick(evt, itemId) |
---|
141 | { |
---|
142 | viewItem(itemId); |
---|
143 | } |
---|
144 | function deleteItems() |
---|
145 | { |
---|
146 | var frm = document.forms[formId]; |
---|
147 | if (Forms.numChecked(frm) == 0) |
---|
148 | { |
---|
149 | alert('Please select at least one item in the list'); |
---|
150 | return; |
---|
151 | } |
---|
152 | frm.action = submitPage; |
---|
153 | frm.cmd.value = 'DeleteItems'; |
---|
154 | frm.submit(); |
---|
155 | } |
---|
156 | function restoreItems() |
---|
157 | { |
---|
158 | var frm = document.forms[formId]; |
---|
159 | if (Forms.numChecked(frm) == 0) |
---|
160 | { |
---|
161 | alert('Please select at least one item in the list'); |
---|
162 | return; |
---|
163 | } |
---|
164 | frm.action = submitPage; |
---|
165 | frm.cmd.value = 'RestoreItems'; |
---|
166 | frm.submit(); |
---|
167 | } |
---|
168 | function deleteItemPermanently(itemId) |
---|
169 | { |
---|
170 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId); |
---|
171 | } |
---|
172 | function setOwner() |
---|
173 | { |
---|
174 | Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems'); |
---|
175 | } |
---|
176 | function configureColumns() |
---|
177 | { |
---|
178 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
179 | } |
---|
180 | function runPlugin(cmd) |
---|
181 | { |
---|
182 | Table.submitToPopup(formId, cmd, 740, 540); |
---|
183 | } |
---|
184 | function returnSelected() |
---|
185 | { |
---|
186 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
187 | window.close(); |
---|
188 | } |
---|
189 | function presetOnChange() |
---|
190 | { |
---|
191 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
192 | } |
---|
193 | </script> |
---|
194 | </base:head> |
---|
195 | |
---|
196 | <base:body> |
---|
197 | <% |
---|
198 | if (cc.getMessage() != null) |
---|
199 | { |
---|
200 | %> |
---|
201 | <div class="error"><%=cc.getMessage()%></div> |
---|
202 | <% |
---|
203 | cc.setMessage(null); |
---|
204 | } |
---|
205 | %> |
---|
206 | <tbl:table |
---|
207 | id="jobs" |
---|
208 | clazz="itemlist" |
---|
209 | columns="<%=cc.getSetting("columns")%>" |
---|
210 | sortby="<%=cc.getSortProperty()%>" |
---|
211 | direction="<%=cc.getSortDirection()%>" |
---|
212 | title="<%=title%>" |
---|
213 | action="index.jsp" |
---|
214 | sc="<%=sc%>" |
---|
215 | item="<%=itemType%>" |
---|
216 | > |
---|
217 | <tbl:hidden |
---|
218 | name="mode" |
---|
219 | value="<%=mode.getName()%>" |
---|
220 | /> |
---|
221 | <tbl:hidden |
---|
222 | name="callback" |
---|
223 | value="<%=callback%>" |
---|
224 | skip="<%=callback == null%>" |
---|
225 | /> |
---|
226 | <tbl:columndef |
---|
227 | id="name" |
---|
228 | property="name" |
---|
229 | datatype="string" |
---|
230 | title="Name" |
---|
231 | sortable="true" |
---|
232 | filterable="true" |
---|
233 | exportable="true" |
---|
234 | show="always" |
---|
235 | /> |
---|
236 | <tbl:columndef |
---|
237 | id="id" |
---|
238 | clazz="uniquecol" |
---|
239 | property="id" |
---|
240 | datatype="int" |
---|
241 | title="ID" |
---|
242 | sortable="true" |
---|
243 | filterable="true" |
---|
244 | exportable="true" |
---|
245 | /> |
---|
246 | <tbl:columndef |
---|
247 | id="owner" |
---|
248 | property="owner.name" |
---|
249 | datatype="string" |
---|
250 | title="Owner" |
---|
251 | sortable="true" |
---|
252 | filterable="true" |
---|
253 | exportable="true" |
---|
254 | /> |
---|
255 | <tbl:columndef |
---|
256 | id="priority" |
---|
257 | property="priority" |
---|
258 | datatype="int" |
---|
259 | title="Priority" |
---|
260 | sortable="true" |
---|
261 | filterable="true" |
---|
262 | exportable="true" |
---|
263 | /> |
---|
264 | <tbl:columndef |
---|
265 | id="status" |
---|
266 | property="status" |
---|
267 | datatype="int" |
---|
268 | enumeration="<%=status%>" |
---|
269 | title="Status" |
---|
270 | sortable="true" |
---|
271 | filterable="true" |
---|
272 | exportable="true" |
---|
273 | /> |
---|
274 | <tbl:columndef |
---|
275 | id="statusMessage" |
---|
276 | property="statusMessage" |
---|
277 | datatype="string" |
---|
278 | title="Status message" |
---|
279 | sortable="true" |
---|
280 | filterable="true" |
---|
281 | exportable="true" |
---|
282 | /> |
---|
283 | <tbl:columndef |
---|
284 | id="dryRun" |
---|
285 | property="dryRun" |
---|
286 | datatype="boolean" |
---|
287 | title="Dry run" |
---|
288 | sortable="true" |
---|
289 | filterable="true" |
---|
290 | exportable="true" |
---|
291 | /> |
---|
292 | <tbl:columndef |
---|
293 | id="stackTrace" |
---|
294 | property="stackTrace" |
---|
295 | datatype="string" |
---|
296 | title="Stack trace" |
---|
297 | sortable="true" |
---|
298 | filterable="true" |
---|
299 | exportable="true" |
---|
300 | /> |
---|
301 | <tbl:columndef |
---|
302 | id="server" |
---|
303 | property="server" |
---|
304 | datatype="string" |
---|
305 | title="Server" |
---|
306 | sortable="true" |
---|
307 | filterable="true" |
---|
308 | exportable="true" |
---|
309 | /> |
---|
310 | <tbl:columndef |
---|
311 | id="jobagent" |
---|
312 | property="jobAgentId" |
---|
313 | datatype="int" |
---|
314 | title="Job agent" |
---|
315 | filterable="true" |
---|
316 | enumeration="<%=agents%>" |
---|
317 | /> |
---|
318 | <tbl:columndef |
---|
319 | id="percentComplete" |
---|
320 | property="percentComplete" |
---|
321 | datatype="int" |
---|
322 | title="Percent complete" |
---|
323 | sortable="true" |
---|
324 | filterable="true" |
---|
325 | exportable="true" |
---|
326 | /> |
---|
327 | <tbl:columndef |
---|
328 | id="estimatedExecutionTime" |
---|
329 | property="estimatedExecutionTime" |
---|
330 | datatype="int" |
---|
331 | enumeration="<%=execTime%>" |
---|
332 | title="Estimated time" |
---|
333 | tooltip="An estimation of the execution time of the plugin" |
---|
334 | sortable="true" |
---|
335 | filterable="true" |
---|
336 | exportable="true" |
---|
337 | /> |
---|
338 | <tbl:columndef |
---|
339 | id="runningTime" |
---|
340 | title="Running time" |
---|
341 | /> |
---|
342 | <tbl:columndef |
---|
343 | id="created" |
---|
344 | property="created" |
---|
345 | datatype="timestamp" |
---|
346 | title="Created" |
---|
347 | sortable="true" |
---|
348 | filterable="true" |
---|
349 | exportable="true" |
---|
350 | formatter="<%=dateTimeFormatter%>" |
---|
351 | /> |
---|
352 | <tbl:columndef |
---|
353 | id="scheduled" |
---|
354 | property="scheduled" |
---|
355 | datatype="timestamp" |
---|
356 | title="Scheduled" |
---|
357 | sortable="true" |
---|
358 | filterable="true" |
---|
359 | exportable="true" |
---|
360 | formatter="<%=dateTimeFormatter%>" |
---|
361 | /> |
---|
362 | <tbl:columndef |
---|
363 | id="started" |
---|
364 | property="started" |
---|
365 | datatype="timestamp" |
---|
366 | title="Started" |
---|
367 | sortable="true" |
---|
368 | filterable="true" |
---|
369 | exportable="true" |
---|
370 | formatter="<%=dateTimeFormatter%>" |
---|
371 | /> |
---|
372 | <tbl:columndef |
---|
373 | id="ended" |
---|
374 | property="ended" |
---|
375 | datatype="timestamp" |
---|
376 | title="Ended" |
---|
377 | sortable="true" |
---|
378 | filterable="true" |
---|
379 | exportable="true" |
---|
380 | formatter="<%=dateTimeFormatter%>" |
---|
381 | /> |
---|
382 | <tbl:columndef |
---|
383 | id="pluginType" |
---|
384 | property="pluginDefinition.mainType" |
---|
385 | datatype="int" |
---|
386 | title="Type" |
---|
387 | enumeration="<%=pluginTypes%>" |
---|
388 | sortable="true" |
---|
389 | filterable="true" |
---|
390 | exportable="true" |
---|
391 | /> |
---|
392 | <tbl:columndef |
---|
393 | id="experiment" |
---|
394 | property="experiment.name" |
---|
395 | datatype="string" |
---|
396 | title="Experiment" |
---|
397 | sortable="true" |
---|
398 | filterable="true" |
---|
399 | exportable="true" |
---|
400 | /> |
---|
401 | <tbl:columndef |
---|
402 | id="plugin" |
---|
403 | property="pluginDefinition.name" |
---|
404 | datatype="string" |
---|
405 | title="Plugin" |
---|
406 | sortable="true" |
---|
407 | filterable="true" |
---|
408 | exportable="true" |
---|
409 | /> |
---|
410 | <tbl:columndef |
---|
411 | id="pluginVersion" |
---|
412 | property="pluginVersion" |
---|
413 | datatype="string" |
---|
414 | title="Plugin version" |
---|
415 | sortable="true" |
---|
416 | filterable="true" |
---|
417 | exportable="true" |
---|
418 | /> |
---|
419 | <tbl:columndef |
---|
420 | id="configuration" |
---|
421 | property="pluginConfiguration.name" |
---|
422 | datatype="string" |
---|
423 | title="Configuration" |
---|
424 | sortable="true" |
---|
425 | filterable="true" |
---|
426 | exportable="true" |
---|
427 | /> |
---|
428 | <tbl:columndef |
---|
429 | id="description" |
---|
430 | property="description" |
---|
431 | datatype="string" |
---|
432 | title="Description" |
---|
433 | sortable="true" |
---|
434 | filterable="true" |
---|
435 | exportable="true" |
---|
436 | /> |
---|
437 | <tbl:columndef |
---|
438 | id="permission" |
---|
439 | title="Permission" |
---|
440 | /> |
---|
441 | <tbl:toolbar |
---|
442 | visible="<%=mode.hasToolbar()%>" |
---|
443 | > |
---|
444 | <tbl:button |
---|
445 | image="delete.gif" |
---|
446 | onclick="deleteItems()" |
---|
447 | title="Delete" |
---|
448 | tooltip="Delete the selected items" |
---|
449 | /> |
---|
450 | <tbl:button |
---|
451 | image="restore.gif" |
---|
452 | onclick="restoreItems()" |
---|
453 | title="Restore" |
---|
454 | tooltip="Restore the selected (deleted) items" |
---|
455 | /> |
---|
456 | <tbl:button |
---|
457 | image="take_ownership.png" |
---|
458 | onclick="setOwner()" |
---|
459 | title="Set owner…" |
---|
460 | tooltip="Change owner of the selected items" |
---|
461 | /> |
---|
462 | <tbl:button |
---|
463 | image="columns.gif" |
---|
464 | onclick="configureColumns()" |
---|
465 | title="Columns…" |
---|
466 | tooltip="Show, hide and re-order columns" |
---|
467 | /> |
---|
468 | <tbl:button |
---|
469 | image="import.gif" |
---|
470 | onclick="runPlugin('ImportItems')" |
---|
471 | title="Import…" |
---|
472 | tooltip="Import data" |
---|
473 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
474 | /> |
---|
475 | <tbl:button |
---|
476 | image="export.gif" |
---|
477 | onclick="runPlugin('ExportItems')" |
---|
478 | title="Export…" |
---|
479 | tooltip="Export data" |
---|
480 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
481 | /> |
---|
482 | <tbl:button |
---|
483 | image="runplugin.gif" |
---|
484 | onclick="runPlugin('RunListPlugin')" |
---|
485 | title="Run plugin…" |
---|
486 | tooltip="Run a plugin" |
---|
487 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
488 | /> |
---|
489 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
490 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
491 | </tbl:toolbar> |
---|
492 | <tbl:navigator |
---|
493 | page="<%=cc.getPage()%>" |
---|
494 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
495 | totalrows="<%=jobs == null ? 0 : jobs.getTotalCount()%>" |
---|
496 | visible="<%=mode.hasNavigator()%>" |
---|
497 | /> |
---|
498 | <tbl:data> |
---|
499 | <tbl:columns> |
---|
500 | <tbl:presetselector |
---|
501 | clazz="columnheader" |
---|
502 | colspan="3" |
---|
503 | onchange="presetOnChange()" |
---|
504 | /> |
---|
505 | </tbl:columns> |
---|
506 | |
---|
507 | <tr> |
---|
508 | <tbl:header |
---|
509 | clazz="index" |
---|
510 | > </tbl:header> |
---|
511 | <tbl:header |
---|
512 | clazz="check" |
---|
513 | visible="<%=mode.hasCheck()%>" |
---|
514 | ><base:icon |
---|
515 | image="check_uncheck.gif" |
---|
516 | tooltip="Check/uncheck all" |
---|
517 | onclick="Forms.checkUncheck(document.forms[formId])" style="align: left;" |
---|
518 | /></tbl:header> |
---|
519 | <tbl:header |
---|
520 | clazz="check" |
---|
521 | visible="<%=mode.hasRadio()%>" |
---|
522 | > </tbl:header> |
---|
523 | <tbl:header |
---|
524 | clazz="icons" |
---|
525 | visible="<%=mode.hasIcons()%>" |
---|
526 | > </tbl:header> |
---|
527 | <tbl:propertyfilter /> |
---|
528 | </tr> |
---|
529 | |
---|
530 | <tbl:rows> |
---|
531 | <% |
---|
532 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
533 | int selectedItemId = cc.getId(); |
---|
534 | if (jobs != null) |
---|
535 | { |
---|
536 | String tooltip = mode.isSelectionMode() ? |
---|
537 | "Select this item" : "View this item"; |
---|
538 | while (jobs.hasNext()) |
---|
539 | { |
---|
540 | Job item = jobs.next(); |
---|
541 | int itemId = item.getId(); |
---|
542 | String name = HTML.encodeTags(item.getName()); |
---|
543 | String deletePermanently = "deleteItemPermanently("+itemId+")"; |
---|
544 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
545 | index++; |
---|
546 | numListed++; |
---|
547 | PluginDefinition plugin = null; |
---|
548 | boolean readPlugin = true; |
---|
549 | try |
---|
550 | { |
---|
551 | plugin = item.getPluginDefinition(); |
---|
552 | } |
---|
553 | catch (PermissionDeniedException ex) |
---|
554 | { |
---|
555 | readPlugin = false; |
---|
556 | } |
---|
557 | JobAgent agent = null; |
---|
558 | boolean readAgent = true; |
---|
559 | try |
---|
560 | { |
---|
561 | agent = item.getJobAgent(); |
---|
562 | } |
---|
563 | catch (PermissionDeniedException ex) |
---|
564 | { |
---|
565 | readAgent = false; |
---|
566 | } |
---|
567 | %> |
---|
568 | <tbl:row> |
---|
569 | <tbl:header |
---|
570 | clazz="index" |
---|
571 | ><%=index%></tbl:header> |
---|
572 | <tbl:header |
---|
573 | clazz="check" |
---|
574 | visible="<%=mode.hasCheck()%>" |
---|
575 | ><input |
---|
576 | type="checkbox" |
---|
577 | name="<%=itemId%>" |
---|
578 | value="<%=itemId%>" |
---|
579 | title="<%=name%>" |
---|
580 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
581 | ></tbl:header> |
---|
582 | <tbl:header |
---|
583 | clazz="check" |
---|
584 | visible="<%=mode.hasRadio()%>" |
---|
585 | ><input |
---|
586 | type="radio" |
---|
587 | name="item_id" |
---|
588 | value="<%=itemId%>" |
---|
589 | title="<%=name%>" |
---|
590 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
591 | ></tbl:header> |
---|
592 | <tbl:header |
---|
593 | clazz="icons" |
---|
594 | visible="<%=mode.hasIcons()%>" |
---|
595 | ><base:icon |
---|
596 | image="<%=deletePermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
597 | onclick="<%=deletePermission ? deletePermanently : null%>" |
---|
598 | tooltip="This item has been scheduled for deletion" |
---|
599 | visible="<%=item.isRemoved()%>" |
---|
600 | /> </tbl:header> |
---|
601 | <tbl:cell column="name"><div class="link" onclick="itemOnClick(event, <%=itemId%>)" |
---|
602 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
603 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
604 | <tbl:cell column="owner" |
---|
605 | ><base:propertyvalue |
---|
606 | item="<%=item%>" |
---|
607 | property="owner" |
---|
608 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
609 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
610 | /></tbl:cell> |
---|
611 | <tbl:cell column="priority"><%=item.getPriority()%></tbl:cell> |
---|
612 | <tbl:cell column="status"><%=item.getStatus()%></tbl:cell> |
---|
613 | <tbl:cell column="statusMessage"><%=HTML.encodeTags(item.getStatusMessage())%></tbl:cell> |
---|
614 | <tbl:cell column="dryRun"><%=item.isDryRun()%></tbl:cell> |
---|
615 | <tbl:cell column="stackTrace"><%=HTML.encodeTags(item.getStackTrace())%></tbl:cell> |
---|
616 | <tbl:cell column="server"><%=HTML.encodeTags(item.getServer())%></tbl:cell> |
---|
617 | <tbl:cell column="jobagent"><%=Base.getLinkedName(ID, agent, !readAgent, true)%></tbl:cell> |
---|
618 | <tbl:cell column="estimatedExecutionTime"><%=item.getEstimatedExecutionTime()%></tbl:cell> |
---|
619 | <tbl:cell column="percentComplete"> |
---|
620 | <table border=0 cellspacing=0 cellpadding=0> |
---|
621 | <tr> |
---|
622 | <td width="100"> |
---|
623 | <table width="100" class="progressbar" border=0 cellspacing=0 cellpadding=0> |
---|
624 | <tr> |
---|
625 | <% |
---|
626 | int percent = item.getPercentComplete(); |
---|
627 | if (percent > 0) |
---|
628 | { |
---|
629 | %> |
---|
630 | <td width="<%=percent%>%" class="done"> </td> |
---|
631 | <% |
---|
632 | } |
---|
633 | if (percent == -1) |
---|
634 | { |
---|
635 | %> |
---|
636 | <td width="100%" class="unknown">unknown</td> |
---|
637 | <% |
---|
638 | } |
---|
639 | else if (percent < 100) |
---|
640 | { |
---|
641 | %> |
---|
642 | <td width="<%=100-percent%>%" class="remain"> </td> |
---|
643 | <% |
---|
644 | } |
---|
645 | %> |
---|
646 | </tr> |
---|
647 | </table> |
---|
648 | </td> |
---|
649 | <%if (percent != -1) { %> |
---|
650 | <td> <%=percent%>%</td> |
---|
651 | <%} %> |
---|
652 | </tr> |
---|
653 | </table> |
---|
654 | </tbl:cell> |
---|
655 | <tbl:cell column="created" value="<%=item.getCreated()%>" /> |
---|
656 | <tbl:cell column="scheduled" value="<%=item.getScheduled()%>" /> |
---|
657 | <tbl:cell column="started" value="<%=item.getStarted()%>" /> |
---|
658 | <tbl:cell column="ended" value="<%=item.getEnded()%>" /> |
---|
659 | <tbl:cell column="runningTime"> |
---|
660 | <% |
---|
661 | Date started = item.getStarted(); |
---|
662 | if (started != null) |
---|
663 | { |
---|
664 | Date ended = item.getEnded(); |
---|
665 | if (ended == null) ended = now; |
---|
666 | long runningTime = ended.getTime() - started.getTime(); |
---|
667 | %> |
---|
668 | <%=Values.formatTime(runningTime / 1000)%> |
---|
669 | <% |
---|
670 | } |
---|
671 | %> |
---|
672 | </tbl:cell> |
---|
673 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
674 | <tbl:cell column="pluginType"> |
---|
675 | <% |
---|
676 | if (!readPlugin) |
---|
677 | { |
---|
678 | %> |
---|
679 | <i>- denied -</i> |
---|
680 | <% |
---|
681 | } |
---|
682 | else if (plugin == null) |
---|
683 | { |
---|
684 | %> |
---|
685 | <i>- none -</i> |
---|
686 | <% |
---|
687 | } |
---|
688 | else |
---|
689 | { |
---|
690 | %> |
---|
691 | <%=plugin.getMainType()%> |
---|
692 | <% |
---|
693 | } |
---|
694 | %> |
---|
695 | </tbl:cell> |
---|
696 | <tbl:cell column="experiment" |
---|
697 | ><base:propertyvalue |
---|
698 | item="<%=item%>" |
---|
699 | property="experiment" |
---|
700 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
701 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
702 | /></tbl:cell> |
---|
703 | <tbl:cell column="plugin"> |
---|
704 | <% |
---|
705 | if (!readPlugin) |
---|
706 | { |
---|
707 | %> |
---|
708 | <i>- denied -</i> |
---|
709 | <% |
---|
710 | } |
---|
711 | else if (plugin == null) |
---|
712 | { |
---|
713 | %> |
---|
714 | <i>- none -</i> |
---|
715 | <% |
---|
716 | } |
---|
717 | else |
---|
718 | { |
---|
719 | %> |
---|
720 | <%=HTML.encodeTags(plugin.getName())%> |
---|
721 | <% |
---|
722 | } |
---|
723 | %> |
---|
724 | </tbl:cell> |
---|
725 | <tbl:cell column="pluginVersion"><%=HTML.encodeTags(item.getPluginVersion())%></tbl:cell> |
---|
726 | <tbl:cell column="configuration" |
---|
727 | ><base:propertyvalue |
---|
728 | item="<%=item%>" |
---|
729 | property="pluginConfiguration" |
---|
730 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
731 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
732 | /></tbl:cell> |
---|
733 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
734 | </tbl:row> |
---|
735 | <% |
---|
736 | } |
---|
737 | } |
---|
738 | %> |
---|
739 | </tbl:rows> |
---|
740 | </tbl:data> |
---|
741 | <% |
---|
742 | if (numListed == 0) |
---|
743 | { |
---|
744 | %> |
---|
745 | <tbl:panel><%=jobs == null || jobs.getTotalCount() == 0 ? "No jobs were found" : "No jobs on this page. Please select another page!" %></tbl:panel> |
---|
746 | <% |
---|
747 | } |
---|
748 | else |
---|
749 | { |
---|
750 | %> |
---|
751 | <tbl:navigator |
---|
752 | page="<%=cc.getPage()%>" |
---|
753 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
754 | totalrows="<%=jobs == null ? 0 : jobs.getTotalCount()%>" |
---|
755 | visible="<%=mode.hasNavigator()%>" |
---|
756 | locked="true" |
---|
757 | /> |
---|
758 | <% |
---|
759 | } |
---|
760 | %> |
---|
761 | </tbl:table> |
---|
762 | <base:buttongroup align="center" clazz="fixedatbottom"> |
---|
763 | <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
764 | <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
765 | <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
766 | </base:buttongroup> |
---|
767 | <br><br><br> |
---|
768 | </base:body> |
---|
769 | </base:page> |
---|
770 | <% |
---|
771 | } |
---|
772 | finally |
---|
773 | { |
---|
774 | if (jobs != null) jobs.close(); |
---|
775 | if (dc != null) dc.close(); |
---|
776 | } |
---|
777 | %> |
---|