Show server status on it's own page too.

This commit is contained in:
A. Svensson 2015-03-16 17:02:17 +01:00
parent 0fd24aa8de
commit 933957bef6
2 changed files with 34 additions and 12 deletions

View File

@ -63,6 +63,21 @@ body {
padding-bottom: 40px; padding-bottom: 40px;
} }
#server_status {
padding: 8px;
}
.status_online {
}
.status_unknown {
background-color: #FCF8E3;
}
.status_offline {
background-color: #F2DEDE;
}
#player_stats th{ #player_stats th{
width: 25%; width: 25%;
} }

View File

@ -16,6 +16,25 @@
<button class="btn btn-default">No homepage</button> <button class="btn btn-default">No homepage</button>
{% endif %} {% endif %}
<h3>Status</h3>
{% with delta_hours=server.last_updated|hours_since_now %}
{% if delta_hours > 24 %}
<p id="server_status" class="status_offline">
<span title="Offline: not seen since the last day." class="glyphicon glyphicon-remove-sign"></span>
{% elif delta_hours >= 1 %}
<p id="server_status" class="status_unknown">
<span title="Unknown: not seen since the last hour." class="glyphicon glyphicon-question-sign"></span>
{% else %}
<p id="server_status" class="status_online">
<span title="Online" class="glyphicon glyphicon-ok-sign"></span>
{% endif %}
{% endwith %}
Last seen <span class="bold" title="{{server.last_updated|date:'r'}} GMT">
{{server.last_updated|timesince}}
</span>ago.
</p>
<h3>Players</h3> <h3>Players</h3>
<table id="player_stats" class="table table-hover"> <table id="player_stats" class="table table-hover">
<thead> <thead>
@ -27,15 +46,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% with delta_hours=server.last_updated|hours_since_now %}
{% if delta_hours > 24 %}
<tr class="danger">
{% elif delta_hours >= 1 %}
<tr class="warning">
{% else %}
<tr> <tr>
{% endif %}
{% endwith %}
<th>{{server.players_current}}</th> <th>{{server.players_current}}</th>
<th>{{server.players_avg}}</th> <th>{{server.players_avg}}</th>
<th>{{server.players_min}}</th> <th>{{server.players_min}}</th>
@ -43,10 +54,6 @@
</tr> </tr>
</table> </table>
<p>Last updated <span class="bold" title="{{server.last_updated|date:'r'}} GMT">
{{server.last_updated|timesince}}
</span>ago.</p>
<h3>Weekly history</h3> <h3>Weekly history</h3>
<div id="weekly_history"></div> <div id="weekly_history"></div>
<h3>Average per day</h3> <h3>Average per day</h3>