Display new stats on the status page.

This commit is contained in:
James Muscat committed 2015-04-23 18:03:47 +01:00
1 parent 976454c358
commit 52e4f78ffb
2 files changed
+34 -2

No files matched your search

+31
View File
@@ -1,3 +1,26 @@
secondsToDurationString = function(seconds) {
var hours = Math.floor(seconds / 3600);
var minutes = Math.floor((seconds - (hours * 3600)) / 60);
var seconds = seconds - (hours * 3600) - (minutes * 60);
var days = 0;
if (hours > 24) {
days = Math.floor(hours / 24)
hours = Math.floor((seconds - days * 24) / 3600);
}
if (hours < 10) {hours = "0" + hours;}
if (minutes < 10) {minutes = "0" + minutes;}
if (seconds < 10) {seconds = "0" + seconds;}
if (days > 0) {
return days + "d " + hours + ":" + minutes + ":" + seconds;
}
else {
return hours + ":" + minutes + ":" + seconds;
}
}
displayGatewayStats = function(stats) {
$("#gateway_inbound_1min").html((stats["inbound"] || {})["1min"] || 0);
$("#gateway_inbound_5min").html((stats["inbound"] || {})["5min"] || 0);
@@ -12,6 +35,10 @@ displayGatewayStats = function(stats) {
$("#gateway_outbound_60min").html((stats["outbound"] || {})["60min"] || 0);
d = new Date();
$("#update_gateway_timestamp").html(d.toString("yyyy-MM-dd HH:mm:ss"));
$("#gateway_version").html(stats['version'] || "N/A");
if (stats['uptime']) {
$("#gateway_uptime").html(secondsToDurationString(stats['uptime']));
}
formatStats();
}
@@ -25,6 +52,10 @@ displayRelayStats = function(stats) {
$("#relay_outbound_60min").html((stats["outbound"] || {})["60min"] || 0);
d = new Date();
$("#update_relay_timestamp").html(d.toString("yyyy-MM-dd HH:mm:ss"));
$("#relay_version").html(stats['version'] || "N/A");
if (stats['uptime']) {
$("#relay_uptime").html(secondsToDurationString(stats['uptime']));
}
formatStats();
}
+3 -2
View File
@@ -35,6 +35,7 @@
<td class="form-inline">
<select id="gateway" class="form-control">
<option value="http://eddn-gateway.elite-markets.net:8080/stats/">eddn-gateway.elite-markets.net</option>
<option value="http://localhost:8080/stats/">localhost</option>
</select>
</td>
<th>1 min</th>
@@ -63,7 +64,7 @@
</tr>
</tbody>
</table>
<p class="text-muted small">Last updated <span id="update_gateway_timestamp">N/A</span></p>
<p class="text-muted small">EDDN version <span id="gateway_version">N/A</span>. Uptime: <span id="gateway_uptime">N/A</span>. Last updated <span id="update_gateway_timestamp">N/A</span></p>
<h2>Relay</h2>
<table class="table">
<thead>
@@ -93,7 +94,7 @@
</tr>
</tbody>
</table>
<p class="text-muted small">Last updated <span id="update_relay_timestamp">N/A</span></p>
<p class="text-muted small">EDDN version <span id="relay_version">N/A</span>. Uptime: <span id="relay_uptime">N/A</span>. Last updated <span id="update_relay_timestamp">N/A</span></p>
</div>
<div class="panel-footer">
<p>The <em>Elite: Dangerous Data Network</em> is volunteer-run and not affiliated with Frontier Developments.</p>