1 | <%-- $Id: view_agent.jsp 5937 2012-01-27 11:00:26Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Nicklas Nordborg |
---|
4 | Copyright (C) 2007 Martin Svensson |
---|
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.SystemItems" |
---|
30 | import="net.sf.basedb.core.Item" |
---|
31 | import="net.sf.basedb.core.ItemContext" |
---|
32 | import="net.sf.basedb.core.Include" |
---|
33 | import="net.sf.basedb.core.Permission" |
---|
34 | import="net.sf.basedb.core.Job" |
---|
35 | import="net.sf.basedb.core.JobAgent" |
---|
36 | import="net.sf.basedb.core.JobAgentSettings" |
---|
37 | import="net.sf.basedb.util.jobagent.JobAgentInfo" |
---|
38 | import="net.sf.basedb.util.jobagent.JobInfo" |
---|
39 | import="net.sf.basedb.core.User" |
---|
40 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
41 | import="net.sf.basedb.core.PluginDefinition" |
---|
42 | import="net.sf.basedb.core.ItemQuery" |
---|
43 | import="net.sf.basedb.core.ItemResultList" |
---|
44 | import="net.sf.basedb.core.ItemResultIterator" |
---|
45 | import="net.sf.basedb.core.MultiPermissions" |
---|
46 | import="net.sf.basedb.core.Group" |
---|
47 | import="net.sf.basedb.core.Project" |
---|
48 | import="net.sf.basedb.core.query.Orders" |
---|
49 | import="net.sf.basedb.core.query.Hql" |
---|
50 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
51 | import="net.sf.basedb.core.plugin.Plugin" |
---|
52 | import="net.sf.basedb.clients.web.Base" |
---|
53 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
54 | import="net.sf.basedb.clients.web.util.HTML" |
---|
55 | import="net.sf.basedb.util.Values" |
---|
56 | import="net.sf.basedb.util.formatter.Formatter" |
---|
57 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
58 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
59 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
60 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
61 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
62 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
63 | import="java.util.Map" |
---|
64 | import="java.util.Set" |
---|
65 | import="java.util.Date" |
---|
66 | import="java.util.Collections" |
---|
67 | import="java.util.List" |
---|
68 | |
---|
69 | %> |
---|
70 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
71 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
72 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
73 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
74 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
75 | <%! |
---|
76 | private static final Item itemType = Item.JOBAGENT; |
---|
77 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
78 | %> |
---|
79 | <% |
---|
80 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
81 | final String ID = sc.getId(); |
---|
82 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
83 | final int itemId = cc.getId(); |
---|
84 | final float scale = Base.getScale(sc); |
---|
85 | final DbControl dc = sc.newDbControl(); |
---|
86 | try |
---|
87 | { |
---|
88 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
89 | Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc); |
---|
90 | |
---|
91 | String title = null; |
---|
92 | JobAgent agent = JobAgent.getById(dc, itemId); |
---|
93 | |
---|
94 | JobAgentInfo info = agent.getInfo(); |
---|
95 | Boolean paused = info.isPaused(); |
---|
96 | |
---|
97 | final boolean writePermission = agent.hasPermission(Permission.WRITE); |
---|
98 | final boolean deletePermission = agent.hasPermission(Permission.DELETE); |
---|
99 | final boolean sharePermission = agent.hasPermission(Permission.SET_PERMISSION); |
---|
100 | final boolean setOwnerPermission = agent.hasPermission(Permission.SET_OWNER); |
---|
101 | final boolean isOwner = agent.isOwner(); |
---|
102 | final boolean isRemoved = agent.isRemoved(); |
---|
103 | final boolean isUsed = isRemoved && agent.isUsed(); |
---|
104 | final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
---|
105 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, agent); |
---|
106 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
107 | %> |
---|
108 | <base:page title="<%=title%>"> |
---|
109 | <base:head scripts="tabcontrol.js,table.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css,progressbar.css"> |
---|
110 | <ext:scripts context="<%=jspContext%>" /> |
---|
111 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
112 | <script language="JavaScript"> |
---|
113 | function editItem() |
---|
114 | { |
---|
115 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
116 | } |
---|
117 | function shareItem() |
---|
118 | { |
---|
119 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareJobAgent', 600, 400); |
---|
120 | } |
---|
121 | function deleteItem() |
---|
122 | { |
---|
123 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>'); |
---|
124 | } |
---|
125 | function restoreItem() |
---|
126 | { |
---|
127 | location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>'); |
---|
128 | } |
---|
129 | function deleteItemPermanently() |
---|
130 | { |
---|
131 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted'); |
---|
132 | } |
---|
133 | function itemDeleted() |
---|
134 | { |
---|
135 | Main.listItems('<%=ID%>', '<%=itemType.name()%>'); |
---|
136 | } |
---|
137 | function showUsingItems() |
---|
138 | { |
---|
139 | Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>); |
---|
140 | } |
---|
141 | function setOwner() |
---|
142 | { |
---|
143 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300); |
---|
144 | } |
---|
145 | function configurePlugin(pluginId) |
---|
146 | { |
---|
147 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true, '&plugin_id='+pluginId); |
---|
148 | } |
---|
149 | function controlJobAgent(cmd) |
---|
150 | { |
---|
151 | location.href = 'index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>'; |
---|
152 | } |
---|
153 | </script> |
---|
154 | </base:head> |
---|
155 | <base:body> |
---|
156 | <p> |
---|
157 | <p:path> |
---|
158 | <p:pathelement title="Job agents" href="<%="index.jsp?ID="+ID%>" /> |
---|
159 | <p:pathelement title="<%=HTML.encodeTags(agent.getName())%>" /> |
---|
160 | </p:path> |
---|
161 | |
---|
162 | <t:tabcontrol id="main" active="properties"> |
---|
163 | <t:tab id="properties" title="Properties"> |
---|
164 | |
---|
165 | <tbl:toolbar |
---|
166 | > |
---|
167 | <tbl:button |
---|
168 | disabled="<%=writePermission ? false : true%>" |
---|
169 | image="edit.gif" |
---|
170 | onclick="editItem()" |
---|
171 | title="Edit…" |
---|
172 | tooltip="<%=writePermission ? "Edit this job agent" : "You do not have permission to edit this job agent"%>" |
---|
173 | /> |
---|
174 | <tbl:button |
---|
175 | disabled="<%=deletePermission ? false : true%>" |
---|
176 | image="delete.gif" |
---|
177 | onclick="deleteItem()" |
---|
178 | title="Delete" |
---|
179 | visible="<%=!agent.isRemoved()%>" |
---|
180 | tooltip="<%=deletePermission ? "Delete this job agent" : "You do not have permission to delete this job agent"%>" |
---|
181 | /> |
---|
182 | <tbl:button |
---|
183 | disabled="<%=writePermission ? false : true%>" |
---|
184 | image="restore.gif" |
---|
185 | onclick="restoreItem()" |
---|
186 | title="Restore" |
---|
187 | visible="<%=agent.isRemoved()%>" |
---|
188 | tooltip="<%=writePermission ? "Restore this job agent" : "You do not have permission to restore this job agent"%>" |
---|
189 | /> |
---|
190 | <tbl:button |
---|
191 | disabled="<%=sharePermission ? false : true%>" |
---|
192 | image="share.gif" |
---|
193 | onclick="shareItem()" |
---|
194 | title="Share…" |
---|
195 | tooltip="<%=sharePermission ? "Share this job agent to other user, groups and projects" : "You do not have permission to share this job agent"%>" |
---|
196 | /> |
---|
197 | <tbl:button |
---|
198 | disabled="<%=setOwnerPermission ? false : true%>" |
---|
199 | image="take_ownership.png" |
---|
200 | onclick="setOwner()" |
---|
201 | title="Set owner…" |
---|
202 | tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>" |
---|
203 | /> |
---|
204 | <tbl:button |
---|
205 | image="import.gif" |
---|
206 | onclick="runPlugin('ImportItem')" |
---|
207 | title="Import…" |
---|
208 | tooltip="Import data" |
---|
209 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
210 | /> |
---|
211 | <tbl:button |
---|
212 | image="export.gif" |
---|
213 | onclick="runPlugin('ExportItem')" |
---|
214 | title="Export…" |
---|
215 | tooltip="Export data" |
---|
216 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
217 | /> |
---|
218 | <tbl:button |
---|
219 | image="runplugin.gif" |
---|
220 | onclick="runPlugin('RunPlugin')" |
---|
221 | title="Run plugin…" |
---|
222 | tooltip="Run a plugin" |
---|
223 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
224 | /> |
---|
225 | <tbl:button |
---|
226 | image="start.png" |
---|
227 | onclick="controlJobAgent('Start')" |
---|
228 | title="Start" |
---|
229 | tooltip="Start the job agent" |
---|
230 | visible="<%=writePermission && paused != null && paused == true%>" |
---|
231 | /> |
---|
232 | <tbl:button |
---|
233 | image="pause.png" |
---|
234 | onclick="controlJobAgent('Pause')" |
---|
235 | title="Pause" |
---|
236 | tooltip="Pause the job agent" |
---|
237 | visible="<%=writePermission && paused != null && paused == false%>" |
---|
238 | /> |
---|
239 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
240 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
241 | <tbl:button |
---|
242 | image="help.png" |
---|
243 | onclick="<%="Main.openHelp('" + ID +"', 'jobagent.view.properties')"%>" |
---|
244 | title="Help…" |
---|
245 | tooltip="Get help about this page" |
---|
246 | /> |
---|
247 | </tbl:toolbar> |
---|
248 | <div class="boxedbottom"> |
---|
249 | <% |
---|
250 | if (cc.getMessage() != null) |
---|
251 | { |
---|
252 | %> |
---|
253 | <div class="error"><%=cc.getMessage()%></div> |
---|
254 | <% |
---|
255 | cc.setMessage(null); |
---|
256 | } |
---|
257 | %> |
---|
258 | |
---|
259 | <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(agent)%></i></div> |
---|
260 | <div class="itemstatus"> |
---|
261 | <base:icon |
---|
262 | image="<%=deletePermanentlyPermission ? "deleted.gif" : "deleted_disabled.gif"%>" |
---|
263 | onclick="<%=deletePermanentlyPermission ? "deleteItemPermanently()" : null%>" |
---|
264 | tooltip="<%=deletePermanentlyPermission ? "Permanently delete this item" : null%>" |
---|
265 | visible="<%=isRemoved%>"> This item has been flagged for deletion<br></base:icon> |
---|
266 | <base:icon image="used.gif" |
---|
267 | onclick="showUsingItems()" |
---|
268 | tooltip="Show the items that are using this one" |
---|
269 | visible="<%=isUsed%>"> This item is used by other items and can't be permanently deleted<br></base:icon> |
---|
270 | <base:icon image="shared.gif" |
---|
271 | visible="<%=agent.isShared()%>"> This item is shared to other user, groups and/or projects</base:icon> |
---|
272 | <base:icon image="warning.gif" |
---|
273 | visible="<%=!agent.isShared()%>"> This item is NOT shared to other users, groups or projects. Only the |
---|
274 | owner will be able to run jobs on this agent</base:icon> |
---|
275 | </div> |
---|
276 | <table class="form" cellspacing=0> |
---|
277 | <tr> |
---|
278 | <td class="prompt">Name</td> |
---|
279 | <td><%=HTML.encodeTags(agent.getName())%></td> |
---|
280 | </tr> |
---|
281 | <tr> |
---|
282 | <td class="prompt">External ID</td> |
---|
283 | <td><%=HTML.encodeTags(agent.getExternalId())%></td> |
---|
284 | </tr> |
---|
285 | <tr> |
---|
286 | <td class="prompt">Server</td> |
---|
287 | <td><%=HTML.encodeTags(agent.getServer())%></td> |
---|
288 | </tr> |
---|
289 | <tr> |
---|
290 | <td class="prompt">Port</td> |
---|
291 | <td><%=agent.getPort() == null ? "" : agent.getPort().toString()%></td> |
---|
292 | </tr> |
---|
293 | <tr> |
---|
294 | <td class="prompt">Status</td> |
---|
295 | <td> |
---|
296 | <%=paused == null ? "<i>- unknown -</i>" : paused == true ? "Paused" : "Running"%> |
---|
297 | </td> |
---|
298 | </tr> |
---|
299 | <tr> |
---|
300 | <td class="prompt">CPU usage</td> |
---|
301 | <td><%=info.getCpuUsage() == null ? "<i>- unknown -</i>" : info.getCpuUsage() + "%"%></td> |
---|
302 | </tr> |
---|
303 | <tr> |
---|
304 | <td class="prompt">Memory</td> |
---|
305 | <td> |
---|
306 | Total: <%=info.getTotalMemory() == null ? "<i>- unknown -</i>" : Values.formatBytes(info.getTotalMemory())%>, |
---|
307 | Used: <%=info.getUsedMemory() == null ? "<i>- unknown -</i>" : Values.formatBytes(info.getUsedMemory())%> |
---|
308 | </td> |
---|
309 | </tr> |
---|
310 | <tr> |
---|
311 | <td class="prompt">Owner</td> |
---|
312 | <td><base:propertyvalue item="<%=agent%>" property="owner" /></td> |
---|
313 | </tr> |
---|
314 | <tr> |
---|
315 | <td class="prompt">Description</td> |
---|
316 | <td><%=HTML.niceFormat(agent.getDescription())%></td> |
---|
317 | </tr> |
---|
318 | </table> |
---|
319 | |
---|
320 | |
---|
321 | <% |
---|
322 | ItemQuery<JobAgentSettings> query = agent.getSettings(); |
---|
323 | query.include(Include.ALL); |
---|
324 | query.order(Orders.asc(Hql.property("pluginDefinition.name"))); |
---|
325 | ItemResultList<JobAgentSettings> plugins = query.list(dc); |
---|
326 | |
---|
327 | if (plugins.size() == 0) |
---|
328 | { |
---|
329 | %> |
---|
330 | <h4>Installed plugins</h4> |
---|
331 | This job agent has no installed plugins (or, you don't have permission to view them). |
---|
332 | <% |
---|
333 | } |
---|
334 | else |
---|
335 | { |
---|
336 | %> |
---|
337 | <base:section |
---|
338 | id="plugins" |
---|
339 | title="<%="Plugins (" + plugins.size() + ")"%>" |
---|
340 | context="<%=cc%>" |
---|
341 | > |
---|
342 | <tbl:table |
---|
343 | id="plugins" |
---|
344 | |
---|
345 | columns="all" |
---|
346 | > |
---|
347 | <tbl:columndef |
---|
348 | id="plugin" |
---|
349 | title="Plugin" |
---|
350 | /> |
---|
351 | <tbl:columndef |
---|
352 | id="trusted" |
---|
353 | title="Trusted" |
---|
354 | /> |
---|
355 | <tbl:columndef |
---|
356 | id="maxMemory" |
---|
357 | title="Max memory" |
---|
358 | /> |
---|
359 | <tbl:columndef |
---|
360 | id="priorityBoost" |
---|
361 | title="Priority boost" |
---|
362 | /> |
---|
363 | <tbl:columndef |
---|
364 | id="configure" |
---|
365 | title="" |
---|
366 | /> |
---|
367 | <tbl:data> |
---|
368 | <tbl:columns> |
---|
369 | </tbl:columns> |
---|
370 | <tbl:rows> |
---|
371 | <% |
---|
372 | for (JobAgentSettings settings : plugins) |
---|
373 | { |
---|
374 | PluginDefinition plugin = null; |
---|
375 | boolean readPlugin = true; |
---|
376 | try |
---|
377 | { |
---|
378 | plugin = settings.getPluginDefinition(); |
---|
379 | } |
---|
380 | catch (PermissionDeniedException ex) |
---|
381 | { |
---|
382 | readPlugin = false; |
---|
383 | } |
---|
384 | Long maxMemory = settings.getEffectiveMaxMemory(); |
---|
385 | %> |
---|
386 | <tbl:row> |
---|
387 | <tbl:cell column="plugin"><base:icon |
---|
388 | image="deleted.gif" |
---|
389 | tooltip="This item has been scheduled for deletion" |
---|
390 | visible="<%=plugin != null && plugin.isRemoved()%>" |
---|
391 | /><%=Base.getLinkedName(ID, plugin, !readPlugin, true)%></tbl:cell> |
---|
392 | <tbl:cell column="trusted"><%=settings.isEffectivelyTrusted()%></tbl:cell> |
---|
393 | <tbl:cell column="maxMemory"><%=maxMemory == null ? "<i>- not specified -</i>" : Values.formatBytes(maxMemory)%></tbl:cell> |
---|
394 | <tbl:cell column="priorityBoost"><%=settings.getPriorityBoost()%></tbl:cell> |
---|
395 | <tbl:cell column="configure"> |
---|
396 | <% |
---|
397 | if (writePermission && plugin != null) |
---|
398 | { |
---|
399 | %> |
---|
400 | <base:icon image="runplugin.gif" |
---|
401 | onclick="<%="configurePlugin(" + plugin.getId() + ")"%>" |
---|
402 | tooltip="Configure the settings for this plugin on the job agent "/> |
---|
403 | <% |
---|
404 | } |
---|
405 | %> |
---|
406 | </tbl:cell> |
---|
407 | </tbl:row> |
---|
408 | <% |
---|
409 | } |
---|
410 | %> |
---|
411 | </tbl:rows> |
---|
412 | </tbl:data> |
---|
413 | </tbl:table> |
---|
414 | </base:section> |
---|
415 | <% |
---|
416 | } |
---|
417 | %> |
---|
418 | |
---|
419 | <% |
---|
420 | Set<JobInfo> jobs = agent.getInfo().getJobInfo(); |
---|
421 | if (jobs == null || jobs.size() == 0) |
---|
422 | { |
---|
423 | %> |
---|
424 | <h4>Executing jobs</h4> |
---|
425 | <% |
---|
426 | if (jobs == null) |
---|
427 | { |
---|
428 | %> |
---|
429 | Unknown |
---|
430 | <% |
---|
431 | } |
---|
432 | else |
---|
433 | { |
---|
434 | %> |
---|
435 | No jobs are currently executing on this job agent |
---|
436 | <% |
---|
437 | } |
---|
438 | } |
---|
439 | else |
---|
440 | { |
---|
441 | %> |
---|
442 | <base:section |
---|
443 | id="executingJobs" |
---|
444 | title="<%="Executing jobs (" + jobs.size() + ")"%>" |
---|
445 | context="<%=cc%>" |
---|
446 | > |
---|
447 | <tbl:table |
---|
448 | id="jobs" |
---|
449 | |
---|
450 | columns="all" |
---|
451 | > |
---|
452 | <tbl:columndef |
---|
453 | id="job" |
---|
454 | title="Job" |
---|
455 | /> |
---|
456 | <tbl:columndef |
---|
457 | id="plugin" |
---|
458 | title="Plugin" |
---|
459 | /> |
---|
460 | <tbl:columndef |
---|
461 | id="slot" |
---|
462 | title="Used slot" |
---|
463 | /> |
---|
464 | <tbl:columndef |
---|
465 | id="started" |
---|
466 | title="Started" |
---|
467 | /> |
---|
468 | <tbl:columndef |
---|
469 | id="percentComplete" |
---|
470 | title="Percent complete" |
---|
471 | /> |
---|
472 | <tbl:columndef |
---|
473 | id="owner" |
---|
474 | title="Owner" |
---|
475 | /> |
---|
476 | <tbl:data> |
---|
477 | <tbl:columns> |
---|
478 | </tbl:columns> |
---|
479 | <tbl:rows> |
---|
480 | <% |
---|
481 | for (JobInfo jobInfo : jobs) |
---|
482 | { |
---|
483 | Job job = null; |
---|
484 | boolean readJob = true; |
---|
485 | try |
---|
486 | { |
---|
487 | job = Job.getById(dc, jobInfo.getJobId()); |
---|
488 | } |
---|
489 | catch (Throwable t) |
---|
490 | { |
---|
491 | readJob = false; |
---|
492 | } |
---|
493 | %> |
---|
494 | <tbl:row> |
---|
495 | <tbl:cell column="job"><%=Base.getLinkedName(ID, job, !readJob, true) %></tbl:cell> |
---|
496 | <tbl:cell column="plugin"><base:propertyvalue item="<%=job%>" property="pluginDefinition"/></tbl:cell> |
---|
497 | <tbl:cell column="started"><%=job == null ? "" : dateFormatter.format(job.getStarted())%></tbl:cell> |
---|
498 | <tbl:cell column="slot"><%=jobInfo.getSlot() == null ? "" : jobInfo.getSlot().toString()%></tbl:cell> |
---|
499 | <tbl:cell column="percentComplete"> |
---|
500 | <% |
---|
501 | if (job != null) |
---|
502 | { |
---|
503 | %> |
---|
504 | <table border=0 cellspacing=0 cellpadding=0> |
---|
505 | <tr> |
---|
506 | <td width="100"> |
---|
507 | <table width="100" class="progressbar" border=0 cellspacing=0 cellpadding=0> |
---|
508 | <tr> |
---|
509 | <% |
---|
510 | int percent = job.getPercentComplete(); |
---|
511 | if (percent > 0) |
---|
512 | { |
---|
513 | %> |
---|
514 | <td width="<%=percent%>%" class="done"> </td> |
---|
515 | <% |
---|
516 | } |
---|
517 | if (percent == -1) |
---|
518 | { |
---|
519 | %> |
---|
520 | <td width="100%" class="unknown">unknown</td> |
---|
521 | <% |
---|
522 | } |
---|
523 | else if (percent < 100) |
---|
524 | { |
---|
525 | %> |
---|
526 | <td width="<%=100-percent%>%" class="remain"> </td> |
---|
527 | <% |
---|
528 | } |
---|
529 | %> |
---|
530 | </tr> |
---|
531 | </table> |
---|
532 | </td> |
---|
533 | <%if (percent != -1) { %> |
---|
534 | <td> <%=percent%>%</td> |
---|
535 | <%} %> |
---|
536 | </tr> |
---|
537 | </table> |
---|
538 | <% |
---|
539 | } |
---|
540 | %> |
---|
541 | </tbl:cell> |
---|
542 | <tbl:cell column="owner"><base:propertyvalue item="<%=job%>" property="owner" /></tbl:cell> |
---|
543 | </tbl:row> |
---|
544 | <% |
---|
545 | } |
---|
546 | %> |
---|
547 | </tbl:rows> |
---|
548 | </tbl:data> |
---|
549 | </tbl:table> |
---|
550 | </base:section> |
---|
551 | <% |
---|
552 | } |
---|
553 | %> |
---|
554 | <jsp:include page="../../common/anytoany/list_anytoany.jsp"> |
---|
555 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
556 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
557 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
558 | <jsp:param name="title" value="Other items related to this job agent" /> |
---|
559 | </jsp:include> |
---|
560 | <% |
---|
561 | // Tables with users/groups/projects that this item is shared to |
---|
562 | MultiPermissions mp = new MultiPermissions(Collections.singleton(agent)); |
---|
563 | List<User> users = mp.getUsers().list(dc); |
---|
564 | List<Group> groups = mp.getGroups().list(dc); |
---|
565 | List<Project> projects = mp.getProjects().list(dc); |
---|
566 | int totalShare = users.size() + groups.size() + projects.size(); |
---|
567 | |
---|
568 | if (totalShare > 0) |
---|
569 | { |
---|
570 | %> |
---|
571 | <base:section |
---|
572 | id="sharedTo" |
---|
573 | title="<%="Shared to (" + totalShare + ")"%>" |
---|
574 | context="<%=cc%>" |
---|
575 | > |
---|
576 | <tbl:table |
---|
577 | id="itemsSharedTo" |
---|
578 | |
---|
579 | columns="all" |
---|
580 | > |
---|
581 | <tbl:columndef |
---|
582 | id="itemType" |
---|
583 | title="Item type" |
---|
584 | /> |
---|
585 | <tbl:columndef |
---|
586 | id="name" |
---|
587 | title="Name" |
---|
588 | /> |
---|
589 | <tbl:columndef |
---|
590 | id="permissions" |
---|
591 | title="Permissions" |
---|
592 | /> |
---|
593 | <tbl:data> |
---|
594 | <tbl:columns> |
---|
595 | </tbl:columns> |
---|
596 | <tbl:rows> |
---|
597 | <% |
---|
598 | for (Project project : projects) |
---|
599 | { |
---|
600 | Set<Permission> permissions = mp.getPermissions(project).values().iterator().next(); |
---|
601 | %> |
---|
602 | <tbl:row> |
---|
603 | <tbl:cell column="itemType"><%=project.getType()%></tbl:cell> |
---|
604 | <tbl:cell column="name"><base:icon |
---|
605 | image="deleted.gif" |
---|
606 | tooltip="This item has been scheduled for deletion" |
---|
607 | visible="<%=project.isRemoved()%>" |
---|
608 | /><%=Base.getLinkedName(ID, project, false, true)%></tbl:cell> |
---|
609 | <tbl:cell column="permissions"> |
---|
610 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
611 | </tbl:cell> |
---|
612 | </tbl:row> |
---|
613 | <% |
---|
614 | } |
---|
615 | for (Group group : groups) |
---|
616 | { |
---|
617 | Set<Permission> permissions = mp.getPermissions(group).values().iterator().next(); |
---|
618 | %> |
---|
619 | <tbl:row> |
---|
620 | <tbl:cell column="itemType"><%=group.getType()%></tbl:cell> |
---|
621 | <tbl:cell column="name"><base:icon |
---|
622 | image="deleted.gif" |
---|
623 | tooltip="This item has been scheduled for deletion" |
---|
624 | visible="<%=group.isRemoved()%>" |
---|
625 | /><%=Base.getLinkedName(ID, group, false, true)%></tbl:cell> |
---|
626 | <tbl:cell column="permissions"> |
---|
627 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
628 | </tbl:cell> |
---|
629 | </tbl:row> |
---|
630 | <% |
---|
631 | } |
---|
632 | for (User user : users) |
---|
633 | { |
---|
634 | Set<Permission> permissions = mp.getPermissions(user).values().iterator().next(); |
---|
635 | %> |
---|
636 | <tbl:row> |
---|
637 | <tbl:cell column="itemType"><%=user.getType()%></tbl:cell> |
---|
638 | <tbl:cell column="name"><base:icon |
---|
639 | image="deleted.gif" |
---|
640 | tooltip="This item has been scheduled for deletion" |
---|
641 | visible="<%=user.isRemoved()%>" |
---|
642 | /><%=Base.getLinkedName(ID, user, false, true)%></tbl:cell> |
---|
643 | <tbl:cell column="permissions"> |
---|
644 | <%=PermissionUtil.translatePermissionsToString(permissions)%> |
---|
645 | </tbl:cell> |
---|
646 | </tbl:row> |
---|
647 | <% |
---|
648 | } |
---|
649 | %> |
---|
650 | </tbl:rows> |
---|
651 | </tbl:data> |
---|
652 | </tbl:table> |
---|
653 | </base:section> |
---|
654 | <% |
---|
655 | } |
---|
656 | else |
---|
657 | { |
---|
658 | %> |
---|
659 | <h4>Shared to</h4> |
---|
660 | This job agent is not shared |
---|
661 | (or, you don't have permission to view the ones it is shared to). |
---|
662 | <% |
---|
663 | } |
---|
664 | %> |
---|
665 | |
---|
666 | </div> |
---|
667 | </t:tab> |
---|
668 | </t:tabcontrol> |
---|
669 | </base:body> |
---|
670 | </base:page> |
---|
671 | <% |
---|
672 | } |
---|
673 | finally |
---|
674 | { |
---|
675 | if (dc != null) dc.close(); |
---|
676 | } |
---|
677 | |
---|
678 | %> |
---|