1 | <%-- $Id: list_jobs.jsp 7269 2017-01-11 12:48:14Z 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.ItemSubtype" |
---|
33 | import="net.sf.basedb.core.ItemQuery" |
---|
34 | import="net.sf.basedb.core.Include" |
---|
35 | import="net.sf.basedb.core.ItemResultIterator" |
---|
36 | import="net.sf.basedb.core.ItemResultList" |
---|
37 | import="net.sf.basedb.core.ItemContext" |
---|
38 | import="net.sf.basedb.core.Permission" |
---|
39 | import="net.sf.basedb.core.Nameable" |
---|
40 | import="net.sf.basedb.core.PluginDefinition" |
---|
41 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
42 | import="net.sf.basedb.core.query.Hql" |
---|
43 | import="net.sf.basedb.core.query.Orders" |
---|
44 | import="net.sf.basedb.core.query.Restrictions" |
---|
45 | import="net.sf.basedb.core.query.Expressions" |
---|
46 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
47 | import="net.sf.basedb.core.plugin.Plugin" |
---|
48 | import="net.sf.basedb.util.Enumeration" |
---|
49 | import="net.sf.basedb.util.ShareableUtil" |
---|
50 | import="net.sf.basedb.clients.web.Base" |
---|
51 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
52 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
53 | import="net.sf.basedb.clients.web.util.HTML" |
---|
54 | import="net.sf.basedb.util.Values" |
---|
55 | import="net.sf.basedb.util.formatter.Formatter" |
---|
56 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
57 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
58 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
59 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
60 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
61 | import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
---|
62 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
63 | import="java.util.Iterator" |
---|
64 | import="java.util.List" |
---|
65 | import="java.util.Map" |
---|
66 | import="java.util.Date" |
---|
67 | %> |
---|
68 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
69 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
70 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
71 | <%! |
---|
72 | private static final Item itemType = Item.JOB; |
---|
73 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
74 | |
---|
75 | private static final Enumeration<String, String> status = new Enumeration<String, String>(); |
---|
76 | private static final Enumeration<String, String> pluginTypes = new Enumeration<String, String>(); |
---|
77 | private static final Enumeration<String, String> execTime = new Enumeration<String, String>(); |
---|
78 | static |
---|
79 | { |
---|
80 | for (Job.Status s : Job.Status.values()) |
---|
81 | { |
---|
82 | status.add(Integer.toString(s.getValue()), HTML.encodeTags(s.toString())); |
---|
83 | } |
---|
84 | for (Plugin.MainType pt : Plugin.MainType.values()) |
---|
85 | { |
---|
86 | pluginTypes.add(Integer.toString(pt.getValue()), HTML.encodeTags(pt.toString())); |
---|
87 | } |
---|
88 | for (Job.ExecutionTime et : Job.ExecutionTime.values()) |
---|
89 | { |
---|
90 | execTime.add(Integer.toString(et.getValue()), HTML.encodeTags(et.toString())); |
---|
91 | } |
---|
92 | } |
---|
93 | %> |
---|
94 | <% |
---|
95 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
96 | final String ID = sc.getId(); |
---|
97 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
98 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
99 | final Date now = new Date(); |
---|
100 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
101 | final String callback = request.getParameter("callback"); |
---|
102 | final String title = mode.generateTitle("job", "jobs"); |
---|
103 | final DbControl dc = sc.newDbControl(); |
---|
104 | ItemResultIterator<Job> jobs = null; |
---|
105 | try |
---|
106 | { |
---|
107 | |
---|
108 | // Get all job agents |
---|
109 | final ItemQuery<JobAgent> agentQuery = JobAgent.getQuery(); |
---|
110 | agentQuery.include(Include.ALL); |
---|
111 | agentQuery.order(Orders.asc(Hql.property("name"))); |
---|
112 | agentQuery.setCacheResult(true); |
---|
113 | Enumeration<String, String> agents = new Enumeration<String, String>(); |
---|
114 | for (JobAgent a : agentQuery.list(dc)) |
---|
115 | { |
---|
116 | agents.add(Integer.toString(a.getId()), a.getName()); |
---|
117 | } |
---|
118 | // Load subtypes |
---|
119 | final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType); |
---|
120 | typeQuery.order(Orders.asc(Hql.property("name"))); |
---|
121 | typeQuery.setCacheResult(true); |
---|
122 | |
---|
123 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
124 | try |
---|
125 | { |
---|
126 | final ItemQuery<Job> query = Base.getConfiguredQuery(dc, cc, true, Job.getQuery(), mode); |
---|
127 | jobs = query.iterate(dc); |
---|
128 | } |
---|
129 | catch (Throwable t) |
---|
130 | { |
---|
131 | cc.setMessage(t.getMessage()); |
---|
132 | t.printStackTrace(); |
---|
133 | } |
---|
134 | int numListed = 0; |
---|
135 | Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
136 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
137 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
138 | ExtensionsInvoker columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
---|
139 | %> |
---|
140 | <base:page title="<%=title==null ? "Jobs" : title%>" type="<%=mode.getPageType()%>" id="list-page"> |
---|
141 | <base:head scripts="table.js,~jobs.js" styles="table.css,toolbar.css,progressbar.css"> |
---|
142 | <ext:scripts context="<%=jspContext%>" /> |
---|
143 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
144 | </base:head> |
---|
145 | |
---|
146 | <base:body> |
---|
147 | <h1><%=title==null ? "Jobs" : title%></h1> |
---|
148 | <div class="content"> |
---|
149 | <tbl:table |
---|
150 | id="jobs" |
---|
151 | columns="<%=cc.getSetting("columns")%>" |
---|
152 | sortby="<%=cc.getSortProperty()%>" |
---|
153 | direction="<%=cc.getSortDirection()%>" |
---|
154 | action="index.jsp" |
---|
155 | sc="<%=sc%>" |
---|
156 | item="<%=itemType%>" |
---|
157 | filterrows="<%=cc.getFilterRows()%>" |
---|
158 | subclass="fulltable" |
---|
159 | > |
---|
160 | <tbl:hidden |
---|
161 | name="mode" |
---|
162 | value="<%=mode.getName()%>" |
---|
163 | /> |
---|
164 | <tbl:hidden |
---|
165 | name="callback" |
---|
166 | value="<%=callback%>" |
---|
167 | skip="<%=callback == null%>" |
---|
168 | /> |
---|
169 | <tbl:columndef |
---|
170 | id="name" |
---|
171 | property="name" |
---|
172 | datatype="string" |
---|
173 | title="Name" |
---|
174 | sortable="true" |
---|
175 | filterable="true" |
---|
176 | exportable="true" |
---|
177 | show="always" |
---|
178 | /> |
---|
179 | <tbl:columndef |
---|
180 | id="id" |
---|
181 | clazz="uniquecol" |
---|
182 | property="id" |
---|
183 | datatype="int" |
---|
184 | title="ID" |
---|
185 | sortable="true" |
---|
186 | filterable="true" |
---|
187 | exportable="true" |
---|
188 | /> |
---|
189 | <tbl:columndef |
---|
190 | id="externalId" |
---|
191 | property="externalId" |
---|
192 | datatype="string" |
---|
193 | title="External ID" |
---|
194 | sortable="true" |
---|
195 | filterable="true" |
---|
196 | exportable="true" |
---|
197 | /> |
---|
198 | <% |
---|
199 | Enumeration<String, String> jobTypes = new Enumeration<String, String>(); |
---|
200 | for (ItemSubtype subtype : typeQuery.list(dc)) |
---|
201 | { |
---|
202 | jobTypes.add(Integer.toString(subtype.getId()), HTML.encodeTags(subtype.getName())); |
---|
203 | } |
---|
204 | %> |
---|
205 | <tbl:columndef |
---|
206 | id="itemSubtype" |
---|
207 | property="itemSubtype" |
---|
208 | sortproperty="itemSubtype.name" |
---|
209 | exportproperty="itemSubtype.name:string" |
---|
210 | datatype="int" |
---|
211 | enumeration="<%=jobTypes%>" |
---|
212 | title="Subtype" |
---|
213 | sortable="true" |
---|
214 | filterable="true" |
---|
215 | exportable="true" |
---|
216 | /> |
---|
217 | <tbl:columndef |
---|
218 | id="owner" |
---|
219 | property="owner.name" |
---|
220 | datatype="string" |
---|
221 | title="Owner" |
---|
222 | sortable="true" |
---|
223 | filterable="true" |
---|
224 | exportable="true" |
---|
225 | /> |
---|
226 | <tbl:columndef |
---|
227 | id="priority" |
---|
228 | property="priority" |
---|
229 | datatype="int" |
---|
230 | title="Priority" |
---|
231 | sortable="true" |
---|
232 | filterable="true" |
---|
233 | exportable="true" |
---|
234 | /> |
---|
235 | <tbl:columndef |
---|
236 | id="status" |
---|
237 | property="status" |
---|
238 | datatype="int" |
---|
239 | enumeration="<%=status%>" |
---|
240 | title="Status" |
---|
241 | sortable="true" |
---|
242 | filterable="true" |
---|
243 | exportable="true" |
---|
244 | /> |
---|
245 | <tbl:columndef |
---|
246 | id="statusMessage" |
---|
247 | property="statusMessage" |
---|
248 | datatype="string" |
---|
249 | title="Status message" |
---|
250 | sortable="true" |
---|
251 | filterable="true" |
---|
252 | exportable="true" |
---|
253 | /> |
---|
254 | <tbl:columndef |
---|
255 | id="dryRun" |
---|
256 | property="dryRun" |
---|
257 | datatype="boolean" |
---|
258 | title="Dry run" |
---|
259 | sortable="true" |
---|
260 | filterable="true" |
---|
261 | exportable="true" |
---|
262 | /> |
---|
263 | <tbl:columndef |
---|
264 | id="stackTrace" |
---|
265 | property="stackTrace" |
---|
266 | datatype="string" |
---|
267 | title="Stack trace" |
---|
268 | sortable="true" |
---|
269 | filterable="true" |
---|
270 | exportable="true" |
---|
271 | /> |
---|
272 | <tbl:columndef |
---|
273 | id="server" |
---|
274 | property="server" |
---|
275 | datatype="string" |
---|
276 | title="Server" |
---|
277 | sortable="true" |
---|
278 | filterable="true" |
---|
279 | exportable="true" |
---|
280 | /> |
---|
281 | <tbl:columndef |
---|
282 | id="node" |
---|
283 | property="node" |
---|
284 | datatype="string" |
---|
285 | title="Node" |
---|
286 | sortable="true" |
---|
287 | filterable="true" |
---|
288 | exportable="true" |
---|
289 | /> |
---|
290 | <tbl:columndef |
---|
291 | id="jobagent" |
---|
292 | property="jobAgentId" |
---|
293 | datatype="int" |
---|
294 | title="Job agent" |
---|
295 | filterable="true" |
---|
296 | enumeration="<%=agents%>" |
---|
297 | /> |
---|
298 | <tbl:columndef |
---|
299 | id="percentComplete" |
---|
300 | property="percentComplete" |
---|
301 | datatype="int" |
---|
302 | title="Percent complete" |
---|
303 | sortable="true" |
---|
304 | filterable="true" |
---|
305 | exportable="true" |
---|
306 | /> |
---|
307 | <tbl:columndef |
---|
308 | id="estimatedExecutionTime" |
---|
309 | property="estimatedExecutionTime" |
---|
310 | datatype="int" |
---|
311 | enumeration="<%=execTime%>" |
---|
312 | title="Estimated time" |
---|
313 | tooltip="An estimation of the execution time of the plugin" |
---|
314 | sortable="true" |
---|
315 | filterable="true" |
---|
316 | exportable="true" |
---|
317 | /> |
---|
318 | <tbl:columndef |
---|
319 | id="runningTime" |
---|
320 | title="Running time" |
---|
321 | /> |
---|
322 | <tbl:columndef |
---|
323 | id="created" |
---|
324 | property="created" |
---|
325 | datatype="timestamp" |
---|
326 | title="Created" |
---|
327 | sortable="true" |
---|
328 | filterable="true" |
---|
329 | exportable="true" |
---|
330 | formatter="<%=dateTimeFormatter%>" |
---|
331 | /> |
---|
332 | <tbl:columndef |
---|
333 | id="scheduled" |
---|
334 | property="scheduled" |
---|
335 | datatype="timestamp" |
---|
336 | title="Scheduled" |
---|
337 | sortable="true" |
---|
338 | filterable="true" |
---|
339 | exportable="true" |
---|
340 | formatter="<%=dateTimeFormatter%>" |
---|
341 | /> |
---|
342 | <tbl:columndef |
---|
343 | id="started" |
---|
344 | property="started" |
---|
345 | datatype="timestamp" |
---|
346 | title="Started" |
---|
347 | sortable="true" |
---|
348 | filterable="true" |
---|
349 | exportable="true" |
---|
350 | formatter="<%=dateTimeFormatter%>" |
---|
351 | /> |
---|
352 | <tbl:columndef |
---|
353 | id="ended" |
---|
354 | property="ended" |
---|
355 | datatype="timestamp" |
---|
356 | title="Ended" |
---|
357 | sortable="true" |
---|
358 | filterable="true" |
---|
359 | exportable="true" |
---|
360 | formatter="<%=dateTimeFormatter%>" |
---|
361 | /> |
---|
362 | <tbl:columndef |
---|
363 | id="pluginType" |
---|
364 | property="pluginDefinition.mainType" |
---|
365 | datatype="int" |
---|
366 | title="Type" |
---|
367 | enumeration="<%=pluginTypes%>" |
---|
368 | sortable="true" |
---|
369 | filterable="true" |
---|
370 | exportable="true" |
---|
371 | /> |
---|
372 | <tbl:columndef |
---|
373 | id="experiment" |
---|
374 | property="experiment.name" |
---|
375 | datatype="string" |
---|
376 | title="Experiment" |
---|
377 | sortable="true" |
---|
378 | filterable="true" |
---|
379 | exportable="true" |
---|
380 | /> |
---|
381 | <tbl:columndef |
---|
382 | id="plugin" |
---|
383 | property="pluginDefinition.name" |
---|
384 | datatype="string" |
---|
385 | title="Plugin" |
---|
386 | sortable="true" |
---|
387 | filterable="true" |
---|
388 | exportable="true" |
---|
389 | /> |
---|
390 | <tbl:columndef |
---|
391 | id="pluginVersion" |
---|
392 | property="pluginVersion" |
---|
393 | datatype="string" |
---|
394 | title="Plugin version" |
---|
395 | sortable="true" |
---|
396 | filterable="true" |
---|
397 | exportable="true" |
---|
398 | /> |
---|
399 | <tbl:columndef |
---|
400 | id="configuration" |
---|
401 | property="pluginConfiguration.name" |
---|
402 | datatype="string" |
---|
403 | title="Configuration" |
---|
404 | sortable="true" |
---|
405 | filterable="true" |
---|
406 | exportable="true" |
---|
407 | /> |
---|
408 | <tbl:columndef |
---|
409 | id="description" |
---|
410 | property="description" |
---|
411 | datatype="string" |
---|
412 | title="Description" |
---|
413 | sortable="true" |
---|
414 | filterable="true" |
---|
415 | exportable="true" |
---|
416 | /> |
---|
417 | <tbl:columndef |
---|
418 | id="permission" |
---|
419 | title="Permission" |
---|
420 | /> |
---|
421 | <tbl:columndef |
---|
422 | id="sharedTo" |
---|
423 | title="Shared to" |
---|
424 | filterable="true" |
---|
425 | filterproperty="!sharedTo.name" |
---|
426 | datatype="string" |
---|
427 | /> |
---|
428 | <tbl:columndef |
---|
429 | id="xt-columns" |
---|
430 | extensions="<%=columnsInvoker%>" |
---|
431 | jspcontext="<%=jspContext%>" |
---|
432 | /> |
---|
433 | <div class="panelgroup bg-filled-50 bottomborder"> |
---|
434 | <tbl:toolbar |
---|
435 | subclass="bottomborder" |
---|
436 | visible="<%=mode.hasToolbar()%>" |
---|
437 | > |
---|
438 | <tbl:button |
---|
439 | id="btnDeleteItems" |
---|
440 | image="delete.png" |
---|
441 | title="Delete" |
---|
442 | tooltip="Delete the selected items" |
---|
443 | /> |
---|
444 | <tbl:button |
---|
445 | id="btnRestoreItems" |
---|
446 | image="restore.png" |
---|
447 | title="Restore" |
---|
448 | tooltip="Restore the selected (deleted) items" |
---|
449 | /> |
---|
450 | <tbl:button |
---|
451 | id="btnAbort" |
---|
452 | image="abort.png" |
---|
453 | title="Abort…" |
---|
454 | tooltip="Abort the selected items" |
---|
455 | /> |
---|
456 | <tbl:button |
---|
457 | id="btnShareItems" |
---|
458 | image="share.png" |
---|
459 | title="Share…" |
---|
460 | tooltip="Share the selected items" |
---|
461 | /> |
---|
462 | <tbl:button |
---|
463 | id="btnSetOwner" |
---|
464 | image="take_ownership.png" |
---|
465 | title="Set owner…" |
---|
466 | tooltip="Change owner of the selected items" |
---|
467 | /> |
---|
468 | <tbl:button |
---|
469 | id="btnColumns" |
---|
470 | image="columns.png" |
---|
471 | title="Columns…" |
---|
472 | tooltip="Show, hide and re-order columns" |
---|
473 | /> |
---|
474 | <tbl:button |
---|
475 | id="btnImport" |
---|
476 | data-plugin-type="IMPORT" |
---|
477 | image="import.png" |
---|
478 | title="Import…" |
---|
479 | tooltip="Import data" |
---|
480 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
481 | /> |
---|
482 | <tbl:button |
---|
483 | id="btnExport" |
---|
484 | data-plugin-type="EXPORT" |
---|
485 | image="export.png" |
---|
486 | title="Export…" |
---|
487 | tooltip="Export data" |
---|
488 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
489 | /> |
---|
490 | <tbl:button |
---|
491 | id="btnRunPlugin" |
---|
492 | data-plugin-type="OTHER" |
---|
493 | image="runplugin.png" |
---|
494 | title="Run plugin…" |
---|
495 | tooltip="Run a plugin" |
---|
496 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
497 | /> |
---|
498 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
499 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
500 | </tbl:toolbar> |
---|
501 | <tbl:panel> |
---|
502 | <tbl:presetselector /> |
---|
503 | <tbl:navigator |
---|
504 | page="<%=cc.getPage()%>" |
---|
505 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
506 | totalrows="<%=jobs == null ? 0 : jobs.getTotalCount()%>" |
---|
507 | visible="<%=mode.hasNavigator()%>" |
---|
508 | /> |
---|
509 | </tbl:panel> |
---|
510 | </div> |
---|
511 | <tbl:data> |
---|
512 | <tbl:headers> |
---|
513 | <tbl:headerrow> |
---|
514 | <tbl:header colspan="3" /> |
---|
515 | <tbl:columnheaders /> |
---|
516 | </tbl:headerrow> |
---|
517 | <% |
---|
518 | int numFilters = cc.getNumPropertyFilters(); |
---|
519 | int numRows = cc.getFilterRows(); |
---|
520 | for (int filterNo = 0; filterNo < numRows; filterNo++) |
---|
521 | { |
---|
522 | boolean lastRow = filterNo == numRows-1; |
---|
523 | %> |
---|
524 | <tbl:headerrow> |
---|
525 | <tbl:header subclass="index" /> |
---|
526 | <tbl:header |
---|
527 | subclass="check" |
---|
528 | visible="<%=mode.hasCheck()%>" |
---|
529 | ><base:icon |
---|
530 | subclass="link table-check" |
---|
531 | image="check_uncheck.png" |
---|
532 | tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" |
---|
533 | visible="<%=lastRow%>" |
---|
534 | /></tbl:header> |
---|
535 | <tbl:header |
---|
536 | subclass="check" |
---|
537 | visible="<%=mode.hasRadio()%>" |
---|
538 | /> |
---|
539 | <tbl:header |
---|
540 | subclass="icons" |
---|
541 | visible="<%=mode.hasIcons()%>" |
---|
542 | > |
---|
543 | <base:icon |
---|
544 | subclass="link table-filter-row-action" |
---|
545 | image="add.png" |
---|
546 | tooltip="Add extra filter row" |
---|
547 | visible="<%=lastRow%>" |
---|
548 | /><base:icon |
---|
549 | subclass="link table-filter-row-action" |
---|
550 | image="remove.png" |
---|
551 | tooltip="Remove this filter row" |
---|
552 | visible="<%=numRows > 1 || numFilters > 0 %>" |
---|
553 | data-remove-row="<%=filterNo%>" |
---|
554 | /> |
---|
555 | </tbl:header> |
---|
556 | <tbl:propertyfilter row="<%=filterNo%>" /> |
---|
557 | </tbl:headerrow> |
---|
558 | <% |
---|
559 | } |
---|
560 | %> |
---|
561 | </tbl:headers> |
---|
562 | <tbl:rows> |
---|
563 | <% |
---|
564 | if (cc.getMessage() != null) |
---|
565 | { |
---|
566 | %> |
---|
567 | <tbl:panel subclass="bg-filled-50"> |
---|
568 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
569 | </tbl:panel> |
---|
570 | <% |
---|
571 | cc.setMessage(null); |
---|
572 | } |
---|
573 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
574 | int selectedItemId = cc.getId(); |
---|
575 | if (jobs != null) |
---|
576 | { |
---|
577 | String tooltip = mode.isSelectionMode() ? |
---|
578 | "Select this item" : "View this item"; |
---|
579 | while (jobs.hasNext()) |
---|
580 | { |
---|
581 | Job item = jobs.next(); |
---|
582 | int itemId = item.getId(); |
---|
583 | String name = HTML.encodeTags(item.getName()); |
---|
584 | |
---|
585 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
586 | index++; |
---|
587 | numListed++; |
---|
588 | PluginDefinition plugin = null; |
---|
589 | boolean readPlugin = true; |
---|
590 | try |
---|
591 | { |
---|
592 | plugin = item.getPluginDefinition(); |
---|
593 | } |
---|
594 | catch (PermissionDeniedException ex) |
---|
595 | { |
---|
596 | readPlugin = false; |
---|
597 | } |
---|
598 | JobAgent agent = null; |
---|
599 | boolean readAgent = true; |
---|
600 | try |
---|
601 | { |
---|
602 | agent = item.getJobAgent(); |
---|
603 | } |
---|
604 | catch (PermissionDeniedException ex) |
---|
605 | { |
---|
606 | readAgent = false; |
---|
607 | } |
---|
608 | %> |
---|
609 | <tbl:row> |
---|
610 | <tbl:header |
---|
611 | clazz="index" |
---|
612 | ><%=index%></tbl:header> |
---|
613 | <tbl:header |
---|
614 | clazz="check" |
---|
615 | visible="<%=mode.hasCheck()%>" |
---|
616 | ><input |
---|
617 | type="checkbox" |
---|
618 | name="<%=itemId%>" |
---|
619 | value="<%=itemId%>" |
---|
620 | title="<%=name%>" |
---|
621 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
622 | ></tbl:header> |
---|
623 | <tbl:header |
---|
624 | clazz="check" |
---|
625 | visible="<%=mode.hasRadio()%>" |
---|
626 | ><input |
---|
627 | type="radio" |
---|
628 | name="item_id" |
---|
629 | value="<%=itemId%>" |
---|
630 | title="<%=name%>" |
---|
631 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
632 | ></tbl:header> |
---|
633 | <tbl:header |
---|
634 | clazz="icons" |
---|
635 | visible="<%=mode.hasIcons()%>" |
---|
636 | ><base:icon |
---|
637 | image="deleted.png" |
---|
638 | id="<%="delete."+itemId %>" |
---|
639 | subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>" |
---|
640 | data-item-id="<%=itemId%>" |
---|
641 | tooltip="This item has been scheduled for deletion" |
---|
642 | visible="<%=item.isRemoved()%>" |
---|
643 | /> </tbl:header> |
---|
644 | <tbl:cell column="name"><div |
---|
645 | class="link table-item" |
---|
646 | data-item-id="<%=itemId%>" |
---|
647 | data-no-edit="1" |
---|
648 | tabindex="0" |
---|
649 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
650 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
651 | <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell> |
---|
652 | <tbl:cell column="itemSubtype" |
---|
653 | ><base:propertyvalue |
---|
654 | item="<%=item%>" |
---|
655 | property="itemSubtype" |
---|
656 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
657 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
658 | /></tbl:cell> |
---|
659 | <tbl:cell column="owner" |
---|
660 | ><base:propertyvalue |
---|
661 | item="<%=item%>" |
---|
662 | property="owner" |
---|
663 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
664 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
665 | /></tbl:cell> |
---|
666 | <tbl:cell column="priority"><%=item.getPriority()%></tbl:cell> |
---|
667 | <tbl:cell column="status"><%=item.getStatus()%></tbl:cell> |
---|
668 | <tbl:cell column="statusMessage"><%=HTML.encodeTags(item.getStatusMessage())%></tbl:cell> |
---|
669 | <tbl:cell column="dryRun"><%=item.isDryRun()%></tbl:cell> |
---|
670 | <tbl:cell column="stackTrace"><%=HTML.encodeTags(item.getStackTrace())%></tbl:cell> |
---|
671 | <tbl:cell column="server"><%=HTML.encodeTags(item.getServer())%></tbl:cell> |
---|
672 | <tbl:cell column="node"><%=HTML.encodeTags(item.getNode())%></tbl:cell> |
---|
673 | <tbl:cell column="jobagent"><%=Base.getLinkedName(ID, agent, !readAgent, true)%></tbl:cell> |
---|
674 | <tbl:cell column="estimatedExecutionTime"><%=item.getEstimatedExecutionTime()%></tbl:cell> |
---|
675 | <tbl:cell column="percentComplete"> |
---|
676 | <table class="progressbar <%=item.getStatus() == Job.Status.ERROR ? "failed" : ""%>"> |
---|
677 | <tr> |
---|
678 | <td> |
---|
679 | <table class="bar" style="width: 100px;"> |
---|
680 | <tr> |
---|
681 | <% |
---|
682 | int percent = item.getPercentComplete(); |
---|
683 | if (percent > 0) |
---|
684 | { |
---|
685 | %> |
---|
686 | <td style="width: <%=percent%>%;" class="percentDone"> </td> |
---|
687 | <% |
---|
688 | } |
---|
689 | if (percent == -1) |
---|
690 | { |
---|
691 | %> |
---|
692 | <td style="width: 100%;" class="percentUnknown">unknown</td> |
---|
693 | <% |
---|
694 | } |
---|
695 | else if (percent < 100) |
---|
696 | { |
---|
697 | %> |
---|
698 | <td style="width: <%=100-percent%>%;" class="percentRemain"> </td> |
---|
699 | <% |
---|
700 | } |
---|
701 | %> |
---|
702 | </tr> |
---|
703 | </table> |
---|
704 | </td> |
---|
705 | <%if (percent != -1) { %> |
---|
706 | <td class="percentText"><%=percent%>%</td> |
---|
707 | <%} %> |
---|
708 | </tr> |
---|
709 | </table> |
---|
710 | </tbl:cell> |
---|
711 | <tbl:cell column="created" value="<%=item.getCreated()%>" /> |
---|
712 | <tbl:cell column="scheduled" value="<%=item.getScheduled()%>" /> |
---|
713 | <tbl:cell column="started" value="<%=item.getStarted()%>" /> |
---|
714 | <tbl:cell column="ended" value="<%=item.getEnded()%>" /> |
---|
715 | <tbl:cell column="runningTime"> |
---|
716 | <% |
---|
717 | Date started = item.getStarted(); |
---|
718 | if (started != null) |
---|
719 | { |
---|
720 | Date ended = item.getEnded(); |
---|
721 | if (ended == null) ended = now; |
---|
722 | long runningTime = ended.getTime() - started.getTime(); |
---|
723 | %> |
---|
724 | <%=Values.formatTime(runningTime / 1000)%> |
---|
725 | <% |
---|
726 | } |
---|
727 | %> |
---|
728 | </tbl:cell> |
---|
729 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
730 | <tbl:cell column="pluginType"> |
---|
731 | <% |
---|
732 | if (!readPlugin) |
---|
733 | { |
---|
734 | %> |
---|
735 | <i>- denied -</i> |
---|
736 | <% |
---|
737 | } |
---|
738 | else if (plugin == null) |
---|
739 | { |
---|
740 | %> |
---|
741 | <i>- none -</i> |
---|
742 | <% |
---|
743 | } |
---|
744 | else |
---|
745 | { |
---|
746 | %> |
---|
747 | <%=plugin.getMainType()%> |
---|
748 | <% |
---|
749 | } |
---|
750 | %> |
---|
751 | </tbl:cell> |
---|
752 | <tbl:cell column="experiment" |
---|
753 | ><base:propertyvalue |
---|
754 | item="<%=item%>" |
---|
755 | property="experiment" |
---|
756 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
757 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
758 | /></tbl:cell> |
---|
759 | <tbl:cell column="plugin"> |
---|
760 | <% |
---|
761 | if (!readPlugin) |
---|
762 | { |
---|
763 | %> |
---|
764 | <i>- denied -</i> |
---|
765 | <% |
---|
766 | } |
---|
767 | else if (plugin == null) |
---|
768 | { |
---|
769 | %> |
---|
770 | <i>- none -</i> |
---|
771 | <% |
---|
772 | } |
---|
773 | else |
---|
774 | { |
---|
775 | %> |
---|
776 | <%=HTML.encodeTags(plugin.getName())%> |
---|
777 | <% |
---|
778 | } |
---|
779 | %> |
---|
780 | </tbl:cell> |
---|
781 | <tbl:cell column="pluginVersion"><%=HTML.encodeTags(item.getPluginVersion())%></tbl:cell> |
---|
782 | <tbl:cell column="configuration" |
---|
783 | ><base:propertyvalue |
---|
784 | item="<%=item%>" |
---|
785 | property="pluginConfiguration" |
---|
786 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
787 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
788 | /></tbl:cell> |
---|
789 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
790 | <tbl:cell column="sharedTo"> |
---|
791 | <% |
---|
792 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
793 | while(sharees.hasNext()) |
---|
794 | { |
---|
795 | Nameable n = sharees.next(); |
---|
796 | if (mode.hasPropertyLink()) |
---|
797 | { |
---|
798 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
799 | } |
---|
800 | else |
---|
801 | { |
---|
802 | out.write(HTML.encodeTags(n.getName())); |
---|
803 | } |
---|
804 | out.write(sharees.hasNext() ? ", " : ""); |
---|
805 | } |
---|
806 | %> |
---|
807 | </tbl:cell> |
---|
808 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
809 | <tbl:cell column="xt-columns" /> |
---|
810 | </tbl:xt-cells> |
---|
811 | </tbl:row> |
---|
812 | <% |
---|
813 | } |
---|
814 | } |
---|
815 | if (numListed == 0) |
---|
816 | { |
---|
817 | %> |
---|
818 | <tbl:panel subclass="bg-filled-50"> |
---|
819 | <div class="messagecontainer note"> |
---|
820 | <%=jobs == null || jobs.getTotalCount() == 0 ? "No jobs were found" : "No jobs on this page. Please select another page!" %> |
---|
821 | </div> |
---|
822 | </tbl:panel> |
---|
823 | <% |
---|
824 | } |
---|
825 | %> |
---|
826 | </tbl:rows> |
---|
827 | </tbl:data> |
---|
828 | </tbl:table> |
---|
829 | </div> |
---|
830 | |
---|
831 | <base:buttongroup subclass="dialogbuttons"> |
---|
832 | <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
833 | <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
834 | <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
835 | </base:buttongroup> |
---|
836 | |
---|
837 | </base:body> |
---|
838 | </base:page> |
---|
839 | <% |
---|
840 | } |
---|
841 | finally |
---|
842 | { |
---|
843 | if (jobs != null) jobs.close(); |
---|
844 | if (dc != null) dc.close(); |
---|
845 | } |
---|
846 | %> |
---|