diff --git a/contrib/status/js/eddn.js b/contrib/status/js/eddn.js index 7e46ba4..50bf177 100644 --- a/contrib/status/js/eddn.js +++ b/contrib/status/js/eddn.js @@ -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(); } diff --git a/contrib/status/status.html b/contrib/status/status.html index f3739aa..b059e85 100644 --- a/contrib/status/status.html +++ b/contrib/status/status.html @@ -35,6 +35,7 @@ 1 min @@ -63,7 +64,7 @@ -

Last updated N/A

+

EDDN version N/A. Uptime: N/A. Last updated N/A

Relay

@@ -93,7 +94,7 @@
-

Last updated N/A

+

EDDN version N/A. Uptime: N/A. Last updated N/A