2927 |
16 Nov 06 |
nicklas |
1 |
<%-- $Id$ |
2927 |
16 Nov 06 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2006 Nicklas Nordborg |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Johan Enell |
2927 |
16 Nov 06 |
nicklas |
5 |
|
2927 |
16 Nov 06 |
nicklas |
6 |
This file is part of BASE - BioArray Software Environment. |
2927 |
16 Nov 06 |
nicklas |
7 |
Available at http://base.thep.lu.se/ |
2927 |
16 Nov 06 |
nicklas |
8 |
|
2927 |
16 Nov 06 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
2927 |
16 Nov 06 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
2927 |
16 Nov 06 |
nicklas |
12 |
of the License, or (at your option) any later version. |
2927 |
16 Nov 06 |
nicklas |
13 |
|
2927 |
16 Nov 06 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
2927 |
16 Nov 06 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2927 |
16 Nov 06 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2927 |
16 Nov 06 |
nicklas |
17 |
GNU General Public License for more details. |
2927 |
16 Nov 06 |
nicklas |
18 |
|
2927 |
16 Nov 06 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2927 |
16 Nov 06 |
nicklas |
21 |
------------------------------------------------------------------ |
2927 |
16 Nov 06 |
nicklas |
22 |
|
2927 |
16 Nov 06 |
nicklas |
23 |
@author Nicklas |
2927 |
16 Nov 06 |
nicklas |
24 |
@version 2.0 |
2927 |
16 Nov 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
2927 |
16 Nov 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
2927 |
16 Nov 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
2927 |
16 Nov 06 |
nicklas |
29 |
import="net.sf.basedb.core.DiskUsage" |
2927 |
16 Nov 06 |
nicklas |
30 |
import="net.sf.basedb.core.DiskUsageStatistics" |
2927 |
16 Nov 06 |
nicklas |
31 |
import="net.sf.basedb.core.SystemItems" |
2927 |
16 Nov 06 |
nicklas |
32 |
import="net.sf.basedb.core.Item" |
2927 |
16 Nov 06 |
nicklas |
33 |
import="net.sf.basedb.core.Location" |
2927 |
16 Nov 06 |
nicklas |
34 |
import="net.sf.basedb.core.QuotaType" |
2927 |
16 Nov 06 |
nicklas |
35 |
import="net.sf.basedb.core.ItemContext" |
2927 |
16 Nov 06 |
nicklas |
36 |
import="net.sf.basedb.core.ItemQuery" |
2927 |
16 Nov 06 |
nicklas |
37 |
import="net.sf.basedb.core.ItemResultList" |
2927 |
16 Nov 06 |
nicklas |
38 |
import="net.sf.basedb.core.query.Orders" |
2927 |
16 Nov 06 |
nicklas |
39 |
import="net.sf.basedb.core.query.Expression" |
2927 |
16 Nov 06 |
nicklas |
40 |
import="net.sf.basedb.core.query.Hql" |
2927 |
16 Nov 06 |
nicklas |
41 |
import="net.sf.basedb.core.query.Restrictions" |
2927 |
16 Nov 06 |
nicklas |
42 |
import="net.sf.basedb.core.query.Expressions" |
2927 |
16 Nov 06 |
nicklas |
43 |
import="net.sf.basedb.clients.web.Base" |
2927 |
16 Nov 06 |
nicklas |
44 |
import="net.sf.basedb.clients.web.util.HTML" |
2927 |
16 Nov 06 |
nicklas |
45 |
import="net.sf.basedb.util.Values" |
2927 |
16 Nov 06 |
nicklas |
46 |
import="java.util.List" |
2927 |
16 Nov 06 |
nicklas |
47 |
%> |
2927 |
16 Nov 06 |
nicklas |
48 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2927 |
16 Nov 06 |
nicklas |
49 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
2927 |
16 Nov 06 |
nicklas |
50 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
2927 |
16 Nov 06 |
nicklas |
51 |
<%! |
2927 |
16 Nov 06 |
nicklas |
52 |
private static final Item itemType = Item.DISKUSAGE; |
2927 |
16 Nov 06 |
nicklas |
53 |
%> |
2927 |
16 Nov 06 |
nicklas |
54 |
<% |
2927 |
16 Nov 06 |
nicklas |
55 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2927 |
16 Nov 06 |
nicklas |
56 |
final String ID = sc.getId(); |
2927 |
16 Nov 06 |
nicklas |
57 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
2927 |
16 Nov 06 |
nicklas |
58 |
final int itemId = cc.getId(); |
2927 |
16 Nov 06 |
nicklas |
59 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
60 |
final DbControl dc = sc.newDbControl(":Disk usage"); |
2927 |
16 Nov 06 |
nicklas |
61 |
try |
2927 |
16 Nov 06 |
nicklas |
62 |
{ |
7605 |
26 Feb 19 |
nicklas |
63 |
DiskUsageStatistics du = sc.getSessionSetting("diskUsageStatistics"); |
2927 |
16 Nov 06 |
nicklas |
64 |
if (du == null) |
2927 |
16 Nov 06 |
nicklas |
65 |
{ |
2927 |
16 Nov 06 |
nicklas |
66 |
du = DiskUsage.getStatistics(dc); |
2927 |
16 Nov 06 |
nicklas |
67 |
sc.setSessionSetting("diskUsageStatistics", du); |
2927 |
16 Nov 06 |
nicklas |
68 |
} |
2927 |
16 Nov 06 |
nicklas |
69 |
du.setDbControl(dc); |
2927 |
16 Nov 06 |
nicklas |
70 |
List<QuotaType> quotaTypes = du.getQuotaTypes(); |
2927 |
16 Nov 06 |
nicklas |
71 |
DiskUsageStatistics.Summary summary = du.getTotalSummary(); |
2927 |
16 Nov 06 |
nicklas |
72 |
%> |
6305 |
09 Aug 13 |
nicklas |
73 |
<base:page title="Disk usage" id="overview-page"> |
6305 |
09 Aug 13 |
nicklas |
74 |
<base:head scripts="tabcontrol-2.js,~diskusage.js" styles="headertabcontrol.css"> |
5950 |
09 Feb 12 |
nicklas |
75 |
<style> |
5950 |
09 Feb 12 |
nicklas |
76 |
table.special |
5950 |
09 Feb 12 |
nicklas |
77 |
{ |
5950 |
09 Feb 12 |
nicklas |
78 |
border-collapse: collapse; |
5950 |
09 Feb 12 |
nicklas |
79 |
width: auto; |
5950 |
09 Feb 12 |
nicklas |
80 |
} |
5950 |
09 Feb 12 |
nicklas |
81 |
table.special td, table.special tr:first-child th |
5950 |
09 Feb 12 |
nicklas |
82 |
{ |
5950 |
09 Feb 12 |
nicklas |
83 |
text-align: right; |
6621 |
24 Nov 14 |
nicklas |
84 |
border-right-width: 1px; |
6621 |
24 Nov 14 |
nicklas |
85 |
border-right-style: dotted; |
5950 |
09 Feb 12 |
nicklas |
86 |
} |
5950 |
09 Feb 12 |
nicklas |
87 |
</style> |
2927 |
16 Nov 06 |
nicklas |
88 |
</base:head> |
2927 |
16 Nov 06 |
nicklas |
89 |
<base:body> |
5950 |
09 Feb 12 |
nicklas |
90 |
<h1>Disk usage</h1> |
5950 |
09 Feb 12 |
nicklas |
91 |
|
5950 |
09 Feb 12 |
nicklas |
92 |
<t:tabcontrol |
5950 |
09 Feb 12 |
nicklas |
93 |
id="main" |
5950 |
09 Feb 12 |
nicklas |
94 |
subclass="mastertabcontrol content" |
6305 |
09 Aug 13 |
nicklas |
95 |
active="overview"> |
6305 |
09 Aug 13 |
nicklas |
96 |
<t:tab id="overview" title="Overview" data-cmd="Overview"> |
2927 |
16 Nov 06 |
nicklas |
97 |
|
5950 |
09 Feb 12 |
nicklas |
98 |
<table class="special fullform bottomborder rightborder"> |
2927 |
16 Nov 06 |
nicklas |
99 |
<tr> |
5950 |
09 Feb 12 |
nicklas |
100 |
<th style="width: 10em;"></th> |
6140 |
20 Sep 12 |
nicklas |
101 |
<th style="width: 12em;">Total</th> |
6140 |
20 Sep 12 |
nicklas |
102 |
<th style="width: 12em;">Primary</th> |
7595 |
22 Feb 19 |
nicklas |
103 |
<th style="width: 12em;">External</th> |
6140 |
20 Sep 12 |
nicklas |
104 |
<th style="width: 12em;">Offline</th> |
2927 |
16 Nov 06 |
nicklas |
105 |
</tr> |
6621 |
24 Nov 14 |
nicklas |
106 |
<tr style="border-top-width: 1px;" class="highlight"> |
5950 |
09 Feb 12 |
nicklas |
107 |
<th>Total</th> |
5950 |
09 Feb 12 |
nicklas |
108 |
<td><%=Values.formatBytes(summary.getTotal())%></td> |
5950 |
09 Feb 12 |
nicklas |
109 |
<td><%=Values.formatBytes(summary.getTotal(Location.PRIMARY))%></td> |
7595 |
22 Feb 19 |
nicklas |
110 |
<td><%=Values.formatBytes(summary.getTotal(Location.EXTERNAL))%></td> |
5950 |
09 Feb 12 |
nicklas |
111 |
<td><%=Values.formatBytes(summary.getTotal(Location.OFFLINE))%></td> |
5950 |
09 Feb 12 |
nicklas |
112 |
</tr> |
2927 |
16 Nov 06 |
nicklas |
113 |
<% |
5950 |
09 Feb 12 |
nicklas |
114 |
for (QuotaType qt : quotaTypes) |
5950 |
09 Feb 12 |
nicklas |
115 |
{ |
5950 |
09 Feb 12 |
nicklas |
116 |
%> |
5950 |
09 Feb 12 |
nicklas |
117 |
<tr class="highlight"> |
5950 |
09 Feb 12 |
nicklas |
118 |
<th><%=HTML.encodeTags(qt.getName())%></th> |
5950 |
09 Feb 12 |
nicklas |
119 |
<td><%=Values.formatBytes(summary.getTotal(qt))%></td> |
5950 |
09 Feb 12 |
nicklas |
120 |
<td><%=Values.formatBytes(summary.getTotal(qt, Location.PRIMARY))%></td> |
7595 |
22 Feb 19 |
nicklas |
121 |
<td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.EXTERNAL)) : "n/a"%></td> |
5950 |
09 Feb 12 |
nicklas |
122 |
<td><%=qt.getSystemId().equals(QuotaType.FILE) ? Values.formatBytes(summary.getTotal(qt, Location.OFFLINE)) : "n/a"%></td> |
5950 |
09 Feb 12 |
nicklas |
123 |
</tr> |
5950 |
09 Feb 12 |
nicklas |
124 |
<% |
5950 |
09 Feb 12 |
nicklas |
125 |
} |
5950 |
09 Feb 12 |
nicklas |
126 |
%> |
5950 |
09 Feb 12 |
nicklas |
127 |
</table> |
2927 |
16 Nov 06 |
nicklas |
128 |
</t:tab> |
6305 |
09 Aug 13 |
nicklas |
129 |
<t:tab id="users" title="Per user" data-cmd="ListUsers" /> |
6305 |
09 Aug 13 |
nicklas |
130 |
<t:tab id="groups" title="Per group" data-cmd="ListGroups" /> |
2927 |
16 Nov 06 |
nicklas |
131 |
</t:tabcontrol> |
2927 |
16 Nov 06 |
nicklas |
132 |
|
2927 |
16 Nov 06 |
nicklas |
133 |
</base:body> |
2927 |
16 Nov 06 |
nicklas |
134 |
</base:page> |
2927 |
16 Nov 06 |
nicklas |
135 |
<% |
2927 |
16 Nov 06 |
nicklas |
136 |
} |
2927 |
16 Nov 06 |
nicklas |
137 |
finally |
2927 |
16 Nov 06 |
nicklas |
138 |
{ |
2927 |
16 Nov 06 |
nicklas |
139 |
if (dc != null) dc.close(); |
2927 |
16 Nov 06 |
nicklas |
140 |
} |
2927 |
16 Nov 06 |
nicklas |
141 |
|
2927 |
16 Nov 06 |
nicklas |
142 |
%> |