Last change
on this file since 1092 was
1080,
checked in by work@…, 12 years ago
|
- created a generic info template showing build, deploy and uptime information
- added information to application.properties, to be modified by build scripts
|
File size:
1.2 KB
|
Line | |
---|
1 | <g:if test="${(meta(name: 'app.build.display.info') as int) as boolean}"> |
---|
2 | <div class="info"> |
---|
3 | <table> |
---|
4 | <tr> |
---|
5 | <td colspan="2">${meta(name: 'app.name')} ${meta(name: 'app.version')} ${meta(name: 'app.build.type')} build</td> |
---|
6 | </tr> |
---|
7 | <tr> |
---|
8 | <td>revision</td> |
---|
9 | <td>: ${meta(name: 'app.build.svn.revision')}</td> |
---|
10 | </tr> |
---|
11 | <tr> |
---|
12 | <td>deployed</td> |
---|
13 | <td>: <span id="info-deployed" /></td> |
---|
14 | </tr> |
---|
15 | <tr> |
---|
16 | <td>uptime</td> |
---|
17 | <td>: <span id="info-uptime" /></td> |
---|
18 | </tr> |
---|
19 | </table> |
---|
20 | |
---|
21 | <script type="text/javascript"> |
---|
22 | var deployed = ${meta(name: 'app.build.timestamp')}; |
---|
23 | |
---|
24 | // change deployed time |
---|
25 | $('#info-deployed').html(new Date((deployed * 1000)).toLocaleString()); |
---|
26 | |
---|
27 | // start uptime counter |
---|
28 | updateUptime(); |
---|
29 | |
---|
30 | // uptime |
---|
31 | function updateUptime() { |
---|
32 | var currentTime = Math.floor(new Date().getTime() / 1000); |
---|
33 | var seconds = currentTime - deployed; |
---|
34 | var minutes = Math.floor(seconds / 60); |
---|
35 | var seconds = seconds - (minutes * 60); |
---|
36 | var hours = Math.floor(minutes / 60); |
---|
37 | var minutes = minutes - (hours * 60); |
---|
38 | var days = Math.floor(hours / 24); |
---|
39 | var hours = hours - (days * 24); |
---|
40 | |
---|
41 | $('#info-uptime').html(days + 'd, ' + hours + 'h, ' + minutes + 'm, ' + seconds + 's'); |
---|
42 | |
---|
43 | setTimeout("updateUptime();", 1000); |
---|
44 | } |
---|
45 | </script> |
---|
46 | </div> |
---|
47 | </g:if> |
---|
Note: See
TracBrowser
for help on using the repository browser.