1 | <%-- $Id: list_jobs.jsp 5952 2012-02-10 12:27:27Z 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 pageEncoding="UTF-8" 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(dc, cc, true, Job.getQuery(), mode); |
---|
118 | jobs = query.iterate(dc); |
---|
119 | } |
---|
120 | catch (Throwable t) |
---|
121 | { |
---|
122 | cc.setMessage(t.getMessage()); |
---|
123 | t.printStackTrace(); |
---|
124 | } |
---|
125 | int numListed = 0; |
---|
126 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
127 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
128 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
129 | %> |
---|
130 | <base:page title="<%=title==null ? "Jobs" : title%>" type="<%=mode.getPageType()%>"> |
---|
131 | <base:head scripts="menu.js,table.js" styles="menu.css,table.css,toolbar.css,progressbar.css"> |
---|
132 | <ext:scripts context="<%=jspContext%>" /> |
---|
133 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
134 | <script language="JavaScript"> |
---|
135 | var submitPage = 'index.jsp'; |
---|
136 | var formId = 'jobs'; |
---|
137 | function viewItem(itemId) |
---|
138 | { |
---|
139 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
140 | } |
---|
141 | function itemOnClick(evt, itemId) |
---|
142 | { |
---|
143 | viewItem(itemId); |
---|
144 | } |
---|
145 | function deleteItems() |
---|
146 | { |
---|
147 | var frm = document.forms[formId]; |
---|
148 | if (Forms.numChecked(frm) == 0) |
---|
149 | { |
---|
150 | alert('Please select at least one item in the list'); |
---|
151 | return; |
---|
152 | } |
---|
153 | frm.action = submitPage; |
---|
154 | frm.cmd.value = 'DeleteItems'; |
---|
155 | frm.submit(); |
---|
156 | } |
---|
157 | function restoreItems() |
---|
158 | { |
---|
159 | var frm = document.forms[formId]; |
---|
160 | if (Forms.numChecked(frm) == 0) |
---|
161 | { |
---|
162 | alert('Please select at least one item in the list'); |
---|
163 | return; |
---|
164 | } |
---|
165 | frm.action = submitPage; |
---|
166 | frm.cmd.value = 'RestoreItems'; |
---|
167 | frm.submit(); |
---|
168 | } |
---|
169 | function deleteItemPermanently(itemId) |
---|
170 | { |
---|
171 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId); |
---|
172 | } |
---|
173 | function setOwner() |
---|
174 | { |
---|
175 | Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems'); |
---|
176 | } |
---|
177 | function configureColumns() |
---|
178 | { |
---|
179 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
180 | } |
---|
181 | function runPlugin(cmd) |
---|
182 | { |
---|
183 | Table.submitToPopup(formId, cmd, 750, 500); |
---|
184 | } |
---|
185 | function returnSelected() |
---|
186 | { |
---|
187 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
188 | window.close(); |
---|
189 | } |
---|
190 | function presetOnChange() |
---|
191 | { |
---|
192 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
193 | } |
---|
194 | </script> |
---|
195 | </base:head> |
---|
196 | |
---|
197 | <base:body> |
---|
198 | <h1><%=title==null ? "Jobs" : title%></h1> |
---|
199 | <div class="content"> |
---|
200 | <tbl:table |
---|
201 | id="jobs" |
---|
202 | columns="<%=cc.getSetting("columns")%>" |
---|
203 | sortby="<%=cc.getSortProperty()%>" |
---|
204 | direction="<%=cc.getSortDirection()%>" |
---|
205 | action="index.jsp" |
---|
206 | sc="<%=sc%>" |
---|
207 | item="<%=itemType%>" |
---|
208 | subclass="fulltable" |
---|
209 | > |
---|
210 | <tbl:hidden |
---|
211 | name="mode" |
---|
212 | value="<%=mode.getName()%>" |
---|
213 | /> |
---|
214 | <tbl:hidden |
---|
215 | name="callback" |
---|
216 | value="<%=callback%>" |
---|
217 | skip="<%=callback == null%>" |
---|
218 | /> |
---|
219 | <tbl:columndef |
---|
220 | id="name" |
---|
221 | property="name" |
---|
222 | datatype="string" |
---|
223 | title="Name" |
---|
224 | sortable="true" |
---|
225 | filterable="true" |
---|
226 | exportable="true" |
---|
227 | show="always" |
---|
228 | /> |
---|
229 | <tbl:columndef |
---|
230 | id="id" |
---|
231 | clazz="uniquecol" |
---|
232 | property="id" |
---|
233 | datatype="int" |
---|
234 | title="ID" |
---|
235 | sortable="true" |
---|
236 | filterable="true" |
---|
237 | exportable="true" |
---|
238 | /> |
---|
239 | <tbl:columndef |
---|
240 | id="owner" |
---|
241 | property="owner.name" |
---|
242 | datatype="string" |
---|
243 | title="Owner" |
---|
244 | sortable="true" |
---|
245 | filterable="true" |
---|
246 | exportable="true" |
---|
247 | /> |
---|
248 | <tbl:columndef |
---|
249 | id="priority" |
---|
250 | property="priority" |
---|
251 | datatype="int" |
---|
252 | title="Priority" |
---|
253 | sortable="true" |
---|
254 | filterable="true" |
---|
255 | exportable="true" |
---|
256 | /> |
---|
257 | <tbl:columndef |
---|
258 | id="status" |
---|
259 | property="status" |
---|
260 | datatype="int" |
---|
261 | enumeration="<%=status%>" |
---|
262 | title="Status" |
---|
263 | sortable="true" |
---|
264 | filterable="true" |
---|
265 | exportable="true" |
---|
266 | /> |
---|
267 | <tbl:columndef |
---|
268 | id="statusMessage" |
---|
269 | property="statusMessage" |
---|
270 | datatype="string" |
---|
271 | title="Status message" |
---|
272 | sortable="true" |
---|
273 | filterable="true" |
---|
274 | exportable="true" |
---|
275 | /> |
---|
276 | <tbl:columndef |
---|
277 | id="dryRun" |
---|
278 | property="dryRun" |
---|
279 | datatype="boolean" |
---|
280 | title="Dry run" |
---|
281 | sortable="true" |
---|
282 | filterable="true" |
---|
283 | exportable="true" |
---|
284 | /> |
---|
285 | <tbl:columndef |
---|
286 | id="stackTrace" |
---|
287 | property="stackTrace" |
---|
288 | datatype="string" |
---|
289 | title="Stack trace" |
---|
290 | sortable="true" |
---|
291 | filterable="true" |
---|
292 | exportable="true" |
---|
293 | /> |
---|
294 | <tbl:columndef |
---|
295 | id="server" |
---|
296 | property="server" |
---|
297 | datatype="string" |
---|
298 | title="Server" |
---|
299 | sortable="true" |
---|
300 | filterable="true" |
---|
301 | exportable="true" |
---|
302 | /> |
---|
303 | <tbl:columndef |
---|
304 | id="jobagent" |
---|
305 | property="jobAgentId" |
---|
306 | datatype="int" |
---|
307 | title="Job agent" |
---|
308 | filterable="true" |
---|
309 | enumeration="<%=agents%>" |
---|
310 | /> |
---|
311 | <tbl:columndef |
---|
312 | id="percentComplete" |
---|
313 | property="percentComplete" |
---|
314 | datatype="int" |
---|
315 | title="Percent complete" |
---|
316 | sortable="true" |
---|
317 | filterable="true" |
---|
318 | exportable="true" |
---|
319 | /> |
---|
320 | <tbl:columndef |
---|
321 | id="estimatedExecutionTime" |
---|
322 | property="estimatedExecutionTime" |
---|
323 | datatype="int" |
---|
324 | enumeration="<%=execTime%>" |
---|
325 | title="Estimated time" |
---|
326 | tooltip="An estimation of the execution time of the plugin" |
---|
327 | sortable="true" |
---|
328 | filterable="true" |
---|
329 | exportable="true" |
---|
330 | /> |
---|
331 | <tbl:columndef |
---|
332 | id="runningTime" |
---|
333 | title="Running time" |
---|
334 | /> |
---|
335 | <tbl:columndef |
---|
336 | id="created" |
---|
337 | property="created" |
---|
338 | datatype="timestamp" |
---|
339 | title="Created" |
---|
340 | sortable="true" |
---|
341 | filterable="true" |
---|
342 | exportable="true" |
---|
343 | formatter="<%=dateTimeFormatter%>" |
---|
344 | /> |
---|
345 | <tbl:columndef |
---|
346 | id="scheduled" |
---|
347 | property="scheduled" |
---|
348 | datatype="timestamp" |
---|
349 | title="Scheduled" |
---|
350 | sortable="true" |
---|
351 | filterable="true" |
---|
352 | exportable="true" |
---|
353 | formatter="<%=dateTimeFormatter%>" |
---|
354 | /> |
---|
355 | <tbl:columndef |
---|
356 | id="started" |
---|
357 | property="started" |
---|
358 | datatype="timestamp" |
---|
359 | title="Started" |
---|
360 | sortable="true" |
---|
361 | filterable="true" |
---|
362 | exportable="true" |
---|
363 | formatter="<%=dateTimeFormatter%>" |
---|
364 | /> |
---|
365 | <tbl:columndef |
---|
366 | id="ended" |
---|
367 | property="ended" |
---|
368 | datatype="timestamp" |
---|
369 | title="Ended" |
---|
370 | sortable="true" |
---|
371 | filterable="true" |
---|
372 | exportable="true" |
---|
373 | formatter="<%=dateTimeFormatter%>" |
---|
374 | /> |
---|
375 | <tbl:columndef |
---|
376 | id="pluginType" |
---|
377 | property="pluginDefinition.mainType" |
---|
378 | datatype="int" |
---|
379 | title="Type" |
---|
380 | enumeration="<%=pluginTypes%>" |
---|
381 | sortable="true" |
---|
382 | filterable="true" |
---|
383 | exportable="true" |
---|
384 | /> |
---|
385 | <tbl:columndef |
---|
386 | id="experiment" |
---|
387 | property="experiment.name" |
---|
388 | datatype="string" |
---|
389 | title="Experiment" |
---|
390 | sortable="true" |
---|
391 | filterable="true" |
---|
392 | exportable="true" |
---|
393 | /> |
---|
394 | <tbl:columndef |
---|
395 | id="plugin" |
---|
396 | property="pluginDefinition.name" |
---|
397 | datatype="string" |
---|
398 | title="Plugin" |
---|
399 | sortable="true" |
---|
400 | filterable="true" |
---|
401 | exportable="true" |
---|
402 | /> |
---|
403 | <tbl:columndef |
---|
404 | id="pluginVersion" |
---|
405 | property="pluginVersion" |
---|
406 | datatype="string" |
---|
407 | title="Plugin version" |
---|
408 | sortable="true" |
---|
409 | filterable="true" |
---|
410 | exportable="true" |
---|
411 | /> |
---|
412 | <tbl:columndef |
---|
413 | id="configuration" |
---|
414 | property="pluginConfiguration.name" |
---|
415 | datatype="string" |
---|
416 | title="Configuration" |
---|
417 | sortable="true" |
---|
418 | filterable="true" |
---|
419 | exportable="true" |
---|
420 | /> |
---|
421 | <tbl:columndef |
---|
422 | id="description" |
---|
423 | property="description" |
---|
424 | datatype="string" |
---|
425 | title="Description" |
---|
426 | sortable="true" |
---|
427 | filterable="true" |
---|
428 | exportable="true" |
---|
429 | /> |
---|
430 | <tbl:columndef |
---|
431 | id="permission" |
---|
432 | title="Permission" |
---|
433 | /> |
---|
434 | <div class="panelgroup bottomborder"> |
---|
435 | <tbl:toolbar |
---|
436 | subclass="bottomborder" |
---|
437 | visible="<%=mode.hasToolbar()%>" |
---|
438 | > |
---|
439 | <tbl:button |
---|
440 | image="delete.png" |
---|
441 | onclick="deleteItems()" |
---|
442 | title="Delete" |
---|
443 | tooltip="Delete the selected items" |
---|
444 | /> |
---|
445 | <tbl:button |
---|
446 | image="restore.png" |
---|
447 | onclick="restoreItems()" |
---|
448 | title="Restore" |
---|
449 | tooltip="Restore the selected (deleted) items" |
---|
450 | /> |
---|
451 | <tbl:button |
---|
452 | image="take_ownership.png" |
---|
453 | onclick="setOwner()" |
---|
454 | title="Set owner…" |
---|
455 | tooltip="Change owner of the selected items" |
---|
456 | /> |
---|
457 | <tbl:button |
---|
458 | image="columns.png" |
---|
459 | onclick="configureColumns()" |
---|
460 | title="Columns…" |
---|
461 | tooltip="Show, hide and re-order columns" |
---|
462 | /> |
---|
463 | <tbl:button |
---|
464 | image="import.png" |
---|
465 | onclick="runPlugin('ImportItems')" |
---|
466 | title="Import…" |
---|
467 | tooltip="Import data" |
---|
468 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
469 | /> |
---|
470 | <tbl:button |
---|
471 | image="export.png" |
---|
472 | onclick="runPlugin('ExportItems')" |
---|
473 | title="Export…" |
---|
474 | tooltip="Export data" |
---|
475 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
476 | /> |
---|
477 | <tbl:button |
---|
478 | image="runplugin.png" |
---|
479 | onclick="runPlugin('RunListPlugin')" |
---|
480 | title="Run plugin…" |
---|
481 | tooltip="Run a plugin" |
---|
482 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
483 | /> |
---|
484 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
485 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
486 | </tbl:toolbar> |
---|
487 | <tbl:panel> |
---|
488 | <tbl:presetselector |
---|
489 | onchange="presetOnChange()" |
---|
490 | /> |
---|
491 | <tbl:navigator |
---|
492 | page="<%=cc.getPage()%>" |
---|
493 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
494 | totalrows="<%=jobs == null ? 0 : jobs.getTotalCount()%>" |
---|
495 | visible="<%=mode.hasNavigator()%>" |
---|
496 | /> |
---|
497 | </tbl:panel> |
---|
498 | </div> |
---|
499 | <tbl:data> |
---|
500 | <tbl:headers> |
---|
501 | <tbl:headerrow> |
---|
502 | <tbl:header colspan="3" /> |
---|
503 | <tbl:columnheaders /> |
---|
504 | </tbl:headerrow> |
---|
505 | <tbl:headerrow> |
---|
506 | <tbl:header subclass="index" /> |
---|
507 | <tbl:header |
---|
508 | subclass="check" |
---|
509 | visible="<%=mode.hasCheck()%>" |
---|
510 | ><base:icon |
---|
511 | image="check_uncheck.png" |
---|
512 | tooltip="Check/uncheck all" |
---|
513 | onclick="Forms.checkUncheck(document.forms[formId])" |
---|
514 | /></tbl:header> |
---|
515 | <tbl:header |
---|
516 | subclass="check" |
---|
517 | visible="<%=mode.hasRadio()%>" |
---|
518 | /> |
---|
519 | <tbl:header |
---|
520 | subclass="icons" |
---|
521 | visible="<%=mode.hasIcons()%>" |
---|
522 | /> |
---|
523 | <tbl:propertyfilter /> |
---|
524 | </tbl:headerrow> |
---|
525 | </tbl:headers> |
---|
526 | <tbl:rows> |
---|
527 | <% |
---|
528 | if (cc.getMessage() != null) |
---|
529 | { |
---|
530 | %> |
---|
531 | <tbl:panel clazz="messagepanel"> |
---|
532 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
533 | </tbl:panel> |
---|
534 | <% |
---|
535 | cc.setMessage(null); |
---|
536 | } |
---|
537 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
538 | int selectedItemId = cc.getId(); |
---|
539 | if (jobs != null) |
---|
540 | { |
---|
541 | String tooltip = mode.isSelectionMode() ? |
---|
542 | "Select this item" : "View this item"; |
---|
543 | while (jobs.hasNext()) |
---|
544 | { |
---|
545 | Job item = jobs.next(); |
---|
546 | int itemId = item.getId(); |
---|
547 | String name = HTML.encodeTags(item.getName()); |
---|
548 | String deletePermanently = "deleteItemPermanently("+itemId+")"; |
---|
549 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
550 | index++; |
---|
551 | numListed++; |
---|
552 | PluginDefinition plugin = null; |
---|
553 | boolean readPlugin = true; |
---|
554 | try |
---|
555 | { |
---|
556 | plugin = item.getPluginDefinition(); |
---|
557 | } |
---|
558 | catch (PermissionDeniedException ex) |
---|
559 | { |
---|
560 | readPlugin = false; |
---|
561 | } |
---|
562 | JobAgent agent = null; |
---|
563 | boolean readAgent = true; |
---|
564 | try |
---|
565 | { |
---|
566 | agent = item.getJobAgent(); |
---|
567 | } |
---|
568 | catch (PermissionDeniedException ex) |
---|
569 | { |
---|
570 | readAgent = false; |
---|
571 | } |
---|
572 | %> |
---|
573 | <tbl:row> |
---|
574 | <tbl:header |
---|
575 | clazz="index" |
---|
576 | ><%=index%></tbl:header> |
---|
577 | <tbl:header |
---|
578 | clazz="check" |
---|
579 | visible="<%=mode.hasCheck()%>" |
---|
580 | ><input |
---|
581 | type="checkbox" |
---|
582 | name="<%=itemId%>" |
---|
583 | value="<%=itemId%>" |
---|
584 | title="<%=name%>" |
---|
585 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
586 | ></tbl:header> |
---|
587 | <tbl:header |
---|
588 | clazz="check" |
---|
589 | visible="<%=mode.hasRadio()%>" |
---|
590 | ><input |
---|
591 | type="radio" |
---|
592 | name="item_id" |
---|
593 | value="<%=itemId%>" |
---|
594 | title="<%=name%>" |
---|
595 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
596 | ></tbl:header> |
---|
597 | <tbl:header |
---|
598 | clazz="icons" |
---|
599 | visible="<%=mode.hasIcons()%>" |
---|
600 | ><base:icon |
---|
601 | image="deleted.png" |
---|
602 | onclick="<%=deletePermission ? deletePermanently : null%>" |
---|
603 | tooltip="This item has been scheduled for deletion" |
---|
604 | visible="<%=item.isRemoved()%>" |
---|
605 | /> </tbl:header> |
---|
606 | <tbl:cell column="name"><div class="link" onclick="itemOnClick(event, <%=itemId%>)" |
---|
607 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
608 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
609 | <tbl:cell column="owner" |
---|
610 | ><base:propertyvalue |
---|
611 | item="<%=item%>" |
---|
612 | property="owner" |
---|
613 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
614 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
615 | /></tbl:cell> |
---|
616 | <tbl:cell column="priority"><%=item.getPriority()%></tbl:cell> |
---|
617 | <tbl:cell column="status"><%=item.getStatus()%></tbl:cell> |
---|
618 | <tbl:cell column="statusMessage"><%=HTML.encodeTags(item.getStatusMessage())%></tbl:cell> |
---|
619 | <tbl:cell column="dryRun"><%=item.isDryRun()%></tbl:cell> |
---|
620 | <tbl:cell column="stackTrace"><%=HTML.encodeTags(item.getStackTrace())%></tbl:cell> |
---|
621 | <tbl:cell column="server"><%=HTML.encodeTags(item.getServer())%></tbl:cell> |
---|
622 | <tbl:cell column="jobagent"><%=Base.getLinkedName(ID, agent, !readAgent, true)%></tbl:cell> |
---|
623 | <tbl:cell column="estimatedExecutionTime"><%=item.getEstimatedExecutionTime()%></tbl:cell> |
---|
624 | <tbl:cell column="percentComplete"> |
---|
625 | <table border=0 cellspacing=0 cellpadding=0> |
---|
626 | <tr> |
---|
627 | <td width="100"> |
---|
628 | <table width="100" class="progressbar <%=item.getStatus() == Job.Status.ERROR ? "error" : ""%>" border=0 cellspacing=0 cellpadding=0> |
---|
629 | <tr> |
---|
630 | <% |
---|
631 | int percent = item.getPercentComplete(); |
---|
632 | if (percent > 0) |
---|
633 | { |
---|
634 | %> |
---|
635 | <td width="<%=percent%>%" class="done"> </td> |
---|
636 | <% |
---|
637 | } |
---|
638 | if (percent == -1) |
---|
639 | { |
---|
640 | %> |
---|
641 | <td width="100%" class="unknown">unknown</td> |
---|
642 | <% |
---|
643 | } |
---|
644 | else if (percent < 100) |
---|
645 | { |
---|
646 | %> |
---|
647 | <td width="<%=100-percent%>%" class="remain"> </td> |
---|
648 | <% |
---|
649 | } |
---|
650 | %> |
---|
651 | </tr> |
---|
652 | </table> |
---|
653 | </td> |
---|
654 | <%if (percent != -1) { %> |
---|
655 | <td> <%=percent%>%</td> |
---|
656 | <%} %> |
---|
657 | </tr> |
---|
658 | </table> |
---|
659 | </tbl:cell> |
---|
660 | <tbl:cell column="created" value="<%=item.getCreated()%>" /> |
---|
661 | <tbl:cell column="scheduled" value="<%=item.getScheduled()%>" /> |
---|
662 | <tbl:cell column="started" value="<%=item.getStarted()%>" /> |
---|
663 | <tbl:cell column="ended" value="<%=item.getEnded()%>" /> |
---|
664 | <tbl:cell column="runningTime"> |
---|
665 | <% |
---|
666 | Date started = item.getStarted(); |
---|
667 | if (started != null) |
---|
668 | { |
---|
669 | Date ended = item.getEnded(); |
---|
670 | if (ended == null) ended = now; |
---|
671 | long runningTime = ended.getTime() - started.getTime(); |
---|
672 | %> |
---|
673 | <%=Values.formatTime(runningTime / 1000)%> |
---|
674 | <% |
---|
675 | } |
---|
676 | %> |
---|
677 | </tbl:cell> |
---|
678 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
679 | <tbl:cell column="pluginType"> |
---|
680 | <% |
---|
681 | if (!readPlugin) |
---|
682 | { |
---|
683 | %> |
---|
684 | <i>- denied -</i> |
---|
685 | <% |
---|
686 | } |
---|
687 | else if (plugin == null) |
---|
688 | { |
---|
689 | %> |
---|
690 | <i>- none -</i> |
---|
691 | <% |
---|
692 | } |
---|
693 | else |
---|
694 | { |
---|
695 | %> |
---|
696 | <%=plugin.getMainType()%> |
---|
697 | <% |
---|
698 | } |
---|
699 | %> |
---|
700 | </tbl:cell> |
---|
701 | <tbl:cell column="experiment" |
---|
702 | ><base:propertyvalue |
---|
703 | item="<%=item%>" |
---|
704 | property="experiment" |
---|
705 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
706 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
707 | /></tbl:cell> |
---|
708 | <tbl:cell column="plugin"> |
---|
709 | <% |
---|
710 | if (!readPlugin) |
---|
711 | { |
---|
712 | %> |
---|
713 | <i>- denied -</i> |
---|
714 | <% |
---|
715 | } |
---|
716 | else if (plugin == null) |
---|
717 | { |
---|
718 | %> |
---|
719 | <i>- none -</i> |
---|
720 | <% |
---|
721 | } |
---|
722 | else |
---|
723 | { |
---|
724 | %> |
---|
725 | <%=HTML.encodeTags(plugin.getName())%> |
---|
726 | <% |
---|
727 | } |
---|
728 | %> |
---|
729 | </tbl:cell> |
---|
730 | <tbl:cell column="pluginVersion"><%=HTML.encodeTags(item.getPluginVersion())%></tbl:cell> |
---|
731 | <tbl:cell column="configuration" |
---|
732 | ><base:propertyvalue |
---|
733 | item="<%=item%>" |
---|
734 | property="pluginConfiguration" |
---|
735 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
736 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
737 | /></tbl:cell> |
---|
738 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
739 | </tbl:row> |
---|
740 | <% |
---|
741 | } |
---|
742 | } |
---|
743 | if (numListed == 0) |
---|
744 | { |
---|
745 | %> |
---|
746 | <tbl:panel clazz="messagepanel"> |
---|
747 | <div class="messagecontainer note"> |
---|
748 | <%=jobs == null || jobs.getTotalCount() == 0 ? "No jobs were found" : "No jobs on this page. Please select another page!" %> |
---|
749 | </div> |
---|
750 | </tbl:panel> |
---|
751 | <% |
---|
752 | } |
---|
753 | %> |
---|
754 | </tbl:rows> |
---|
755 | </tbl:data> |
---|
756 | </tbl:table> |
---|
757 | </div> |
---|
758 | |
---|
759 | <base:buttongroup subclass="dialogbuttons"> |
---|
760 | <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
761 | <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
762 | <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
763 | </base:buttongroup> |
---|
764 | |
---|
765 | </base:body> |
---|
766 | </base:page> |
---|
767 | <% |
---|
768 | } |
---|
769 | finally |
---|
770 | { |
---|
771 | if (jobs != null) jobs.close(); |
---|
772 | if (dc != null) dc.close(); |
---|
773 | } |
---|
774 | %> |
---|