status.jsp 14.9 KB
Newer Older
toaster's avatar
toaster committed
1
2
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
3
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
toaster's avatar
toaster committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<%@taglib tagdir="/WEB-INF/tags" prefix="h" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="/WEB-INF/tlds/monitor" prefix="d"%>

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <c:choose>
            <c:when test="${workingCollection != null && (workingCollection.fileAuditRunning || workingCollection.tokenAuditRunning) }">
                <meta http-equiv="refresh" content="10"/>
            </c:when>
            <c:otherwise>
                <meta http-equiv="refresh" content="600"/>
            </c:otherwise>
        </c:choose>


        <title>ACE Audit Manager</title>
        <script type="text/javascript" SRC="srbFunctions.js" ></script>
        <script type="text/javascript">
29
30
            function toggleVisibility(id,type) {

toaster's avatar
toaster committed
31
                var t = document.getElementById(id);
32
                if (t.style.display == type) {
toaster's avatar
toaster committed
33
34
                    t.style.display = "none";
                } else {
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
                    t.style.display = type;
                }
            }
            function showGroup(id)
            {
                var divs = document.getElementsByTagName('tr');

                for (i = 0; i < divs.length; i++)
                {
                    if (divs[i].className.indexOf(id) != -1)
                    {
                        divs[i].style.display = "";
                    }
                }
            }
            function hideGroup(id)
            {
                var divs = document.getElementsByTagName('tr');

                for (i = 0; i < divs.length; i++)
                {
                    if (divs[i].className.indexOf(id) != -1)
                    {
                        divs[i].style.display = "none";
                    }
toaster's avatar
toaster committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
                }
            }
        </script>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <style type="text/css">
            .groupheader {
                background: #e8e8e8;
                padding-left: 25px
            }
            #inactiveaudit
            {
                color: red;
                font-weight: bold;
            }
toaster's avatar
toaster committed
74
75
76
77
78
79
80
81
82

            .statusrow:hover {
                background-color: #e8e8e8;
            }

            .statusrow {
                background-color: #FFFFFF;
            }

83
84
85
86
87
88
            #linktable {
                width: 655px;
                margin-left: auto;
                margin-right: auto;
            }

toaster's avatar
toaster committed
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
            #threaddetailsTD:hover div {
                display: block;
            }

            #threaddetailsDIV {
                left: 100px;
                position: absolute;
                background-color: #FFFFFF;
                width: 600px;
                z-index: 300;
                display: none;
                font-size: x-small;
                border: solid 1px #000000;

            }
            #threaddetailsDIV table {
                margin: 5px;

                text-align: left;

            }
            #threaddetailsDIV table tr td {
                background-color: #f1f1f1;
                padding-right: 5px;
                text-align: left;

            }

            #details {
                z-index: 100;
                position: relative;
            }
            #detailstbl1 tr td
            {
                vertical-align: top;
                padding-left: 10px;
                margin-top: 10px;
            }
            #detailstbl1 tr
            {
                background-color: #FFFFFF;
            }
            #detailstbl1 tr:hover
            {
                background-color: #e8e8e8;
            }
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

            #searchtable {
                margin-top: 10px;
                margin-bottom: -10px;
                margin-left: auto;
                margin-right: auto;
                width: 650px;
            }

            .input {
                padding: 2px;
                display: flex;
                width: 650px;
            }

            .input-group-addon {
                border: 1px solid #ccc;
                font-size: 12px;
                background-color: #e8e8e8;
                text-align: center;
                width: 75px;
                height: 20px;
                line-height: 20px;
                padding: 3px 10px;
            }

            .form-input {
                border: 1px solid #ccc;
                width: 100%;
                height: 20px;
                padding: 3px 8px;
                margin-left: -1px;
                margin-right: 5px;
            }

170
171
172
173
174
175
176
177
            .form-select {
                border: 1px solid #ccc;
                width: 100%;
                padding: 3px 8px;
                margin-left: -3px;
                margin-right: 5px;
            }

178
179
180
181
182
183
184
185
            .btn {
                padding: 2px;
                width: 75px;
                height: 25px;
                border: 1px solid #e8e8e8;
                margin-left: 2px;
                margin-top: 2px;
            }
toaster's avatar
toaster committed
186
187
188
189
190
191
192
193
194
195
        </style>
    </head>

    <body>
        <jsp:include page="header.jsp" />
        <script type="text/javascript">document.getElementById('status').style.backgroundColor = '#ccccff';</script>
        <c:if test="${workingCollection != null}">
            <div id="details">
                <jsp:include page="statusdetails.jsp"/>
            </div>
toaster's avatar
toaster committed
196

toaster's avatar
toaster committed
197
198
        </c:if>

199
200
201
202
203
204
205
206
207
208
        <div id="searchtable">
            <form method="GET" role="form">
                <div class="input">
                    <span class="input-group-addon">Group</span>
                    <input type="text" class="form-input" id="group-filter" name="group" placeholder="Search Group"/>
                </div>
                <div class="input">
                    <span class="input-group-addon">Collection</span>
                    <input type="text" class="form-input" id="coll-filter" name="collection" placeholder="Search Collection"/>
                </div>
209
210
211
212
213
214
215
216
                <div class="input">
                    <span class="input-group-addon">State</span>
                    <select name="state" id="state-filter" class="form-select">
                        <c:forEach var="state" items="${states}">
                           <option value="${state.state}">${state.name()}</option>
                        </c:forEach>
                    </select>
                </div>
217
218
219
220

                <button type="submit" class="btn" value="Submit"><span>Submit</span></button>
            </form>
        </div>
toaster's avatar
toaster committed
221
222
        <table id="statustable">
            <thead>
toaster's avatar
   
toaster committed
223
                <td></td><td width="45%">Collection Name</td>
toaster's avatar
toaster committed
224
225
226
227
228
229
                <td>Type</td><td>Total Files*</td>
                <td>Last Audit</td>
                <td>Next Audit</td>
            </thead>
            <c:set var="count" value="0" />
            <jsp:useBean id="today" class="java.util.Date"/>
toaster's avatar
toaster committed
230
231
            <c:set var="counttotal" value="0" />
            <c:set var="sizetotal" value="0" />
toaster's avatar
toaster committed
232
233
234
            <c:forEach var="item" items="${collections}">

                <c:if test="${currgroup != item.collection.group && item.collection.group != null}">
toaster's avatar
toaster committed
235
236
237
238
239
240
241
                    <script type="text/javascript">
                        myp=document.getElementById("group${currgroup}");
                        if (myp != null)
                        {
                            myp.innerHTML='${counttotal} / <c:choose><c:when test="${sizetotal > 0}"><d:FileSize value="${sizetotal}" /></c:when><c:otherwise>0 B</c:otherwise></c:choose>';
                        }
                    </script>
242
243
                    <tr>
                        <td class="groupheader" colspan="3" onclick="toggleVisibility('spexpand${item.collection.group}','inline'); toggleVisibility('sphide${item.collection.group}','inline');">
toaster's avatar
   
toaster committed
244
245
246
                            <span onclick="showGroup('grouptr${item.collection.group}')" id="spexpand${item.collection.group}" style="display:none;float: left;width: 25px;" >[+]</span>
                            <span onclick="hideGroup('grouptr${item.collection.group}')" id="sphide${item.collection.group}" style="display:inline;float: left;width: 25px;" >[-]</span>
                            ${item.collection.group}
247
248
249
                        </td>
                        <td class="groupheader" colspan="3" id="group${item.collection.group}"></td>
                    </tr>
toaster's avatar
toaster committed
250
251
                    <c:set var="counttotal" value="0" />
                    <c:set var="sizetotal" value="0" />
toaster's avatar
toaster committed
252
253
                </c:if>

254
                <tr class="statusrow grouptr${item.collection.group}" >
toaster's avatar
toaster committed
255
256
257
258
259
260
                    <td>

                        <c:choose>
                            <c:when test="${item.fileAuditRunning || item.tokenAuditRunning}">
                                <img src="images/running.jpg" title="Audit in progress" alt="running" />
                            </c:when>
261
262
263
                            <c:when test="${item.queued}">
                                <img src="images/queued.jpg" title="Audit is queued" alt="queued" />
                            </c:when>
toaster's avatar
toaster committed
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
                            <c:otherwise>
                                <img src="images/stopped.jpg" title="No audit in progress" alt="idle" />
                            </c:otherwise>
                        </c:choose>
                        <c:choose>
                            <c:when test="${'A'.bytes[0] == item.collection.state }">
                                <img src="images/file-ok.jpg" title="Last audit successful" alt="Last audit successful"/>
                            </c:when>
                            <c:when test="${'E'.bytes[0] == item.collection.state }">
                                <img src="images/error.jpg" title="Collection contains errors" alt="Collection contains errors"/>
                            </c:when>
                            <c:otherwise>
                                <img src="images/file-bad.jpg" title="Complete audit has not occured" alt="Complete audit has not occured"/>
                            </c:otherwise>
                        </c:choose>
                    </td>
                    <td>
281
                        <a href="Status?collectionid=${item.collection.id}&page=${page.page}&count=${page.count}">${item.collection.name}</a>
toaster's avatar
toaster committed
282
283
284
285
286
287
288
289
290
291
292
                    </td>
                    <td>${item.collection.storage}</td>
                    <td><h:DefaultValue test="${item.totalFiles > -1}" success="${item.totalFiles}" failure="Unknown" /></td>
                    <td>
                        <fmt:formatDate pattern="MMM dd yyyy" value="${item.collection.lastSync}"/>
                    </td>
                    <td>
                        <c:choose>
                            <c:when test="${item.fileAuditRunning || item.tokenAuditRunning}">
                                In Progress
                            </c:when>
293
294
295
                            <c:when test="${item.queued}">
                                Queued
                            </c:when>
toaster's avatar
toaster committed
296
                            <c:when test="${item.collection.lastSync == null || item.collection.settings['audit.period'] < 1 || pause.paused}">
toaster's avatar
toaster committed
297
298
                                Unknown
                            </c:when>
toaster's avatar
toaster committed
299
                            <c:when test="${today.time > (item.collection.lastSync.time + item.collection.settings['audit.period'] * 1000 * 60 * 60 * 24)}">
toaster's avatar
toaster committed
300
                                <span style="color: red; font-weight: bold">
toaster's avatar
toaster committed
301
                                    <d:DateAdd date="${item.collection.lastSync}" format="MMM dd yyyy" period="${item.collection.settings['audit.period']}"/>
toaster's avatar
toaster committed
302
303
304
                                </span>
                            </c:when>
                            <c:otherwise>
toaster's avatar
toaster committed
305
                                <d:DateAdd date="${item.collection.lastSync}" format="MMM dd yyyy" period="${item.collection.settings['audit.period']}"/>
toaster's avatar
toaster committed
306
307
308
309
310
311
                            </c:otherwise>
                        </c:choose>
                    </td>
                </tr>
                <c:set var="count" value="${count + 1}" />
                <c:set var="currgroup" value="${item.collection.group}" />
toaster's avatar
toaster committed
312
313
                <c:set var="counttotal" value="${counttotal + item.totalFiles}" />
                <c:set var="sizetotal" value="${sizetotal + item.totalSize}" />
toaster's avatar
toaster committed
314
            </c:forEach>
toaster's avatar
toaster committed
315
316
317
318
319
            <script type="text/javascript">
                myp=document.getElementById("group${currgroup}");
                myp.innerHTML='${counttotal} / <c:choose><c:when test="${sizetotal > 0}"><d:FileSize value="${sizetotal}" /></c:when><c:otherwise>0 B</c:otherwise></c:choose>';
            </script>

320
            <tr><td colspan="5"><br/><d:Auth role="Collection Modify" showUnauthenticated="true"><a href="ManageCollection">Add Collection</a></d:Auth> &nbsp;&nbsp;&nbsp&nbsp;&nbsp;
321
322
323
324
325
326
                    <d:Auth role="Audit">
                        <c:choose>
                            <c:when test="${pause.paused}"><a href="Pause?pause=0">Enable Automated Auditing</a></c:when>
                            <c:otherwise><a href="Pause?pause=1">Pause Automated Auditing</a></c:otherwise>
                        </c:choose>
                    </d:Auth>
toaster's avatar
toaster committed
327
328
329
330
331
332
333
334
335
336
                </td></tr>
            <tr><td colspan="5"><br /><img src="images/running.jpg" alt="running"/> - Audit in progress&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/stopped.jpg" alt="stopped"/> - Audit idle</td></tr>
            <tr><td colspan="5">* - Total files and status not updated until after first sync.</td></tr>
            <tr><td colspan="5"><c:choose>
                        <c:when test="${pause.paused}"><span id="inactiveaudit">Automated auditing is currently paused.</span> </c:when>
                        <c:otherwise>Automated auditing active.</c:otherwise>
                    </c:choose></td></tr>

        </table>

337
338
339
340
341
342
343
344
345
346
347
       <table id="linktable">
            <tr>
                <td align="left">
                    <%-- <a href="Status?count=${count}">|&lt;</a>&nbsp;&nbsp;&nbsp;
                    <a href="Status?page=${page - 1}&count=${count}">&lt;&lt;</a> --%>
                    <a href="${page.first}">|&lt;</a>&nbsp;&nbsp;&nbsp;
                    <a href="${page.previous}">&lt;&lt;</a>
                </td>
                <td align="center">
                    Show per page:
                    <a href="${page.getCount(100)}">100</a>
Michael Ritter's avatar
Michael Ritter committed
348
349
                    <a href="${page.getCount(500)}">500</a>
                    <a href="${page.getCount(1000)}">1000</a>
350
351
352
353
354
355
356
357
358
359
360
                </td>
                <td align="right">
                    <%--
                    <a href="Status?page=${page + 1}&count=${count}">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;
                    <a href="Status?count=${count}&start=0&top=0">&gt;|</a> --%>
                    <a href="${page.next}">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;
                    <a href="${page.end}">&gt;|</a>
                </td>
            </tr>
        </table>

toaster's avatar
toaster committed
361
362
363
        <jsp:include page="footer.jsp" />
    </body>
</html>