[tor-commits] [atlas/master] Display a relay's downtime when it's offline.

phw at torproject.org phw at torproject.org
Sat Oct 12 17:35:09 UTC 2013


commit efbfb130ed25ddfee3f52b549d610257999da71d
Author: Philipp Winter <phw at torproject.org>
Date:   Thu Oct 10 00:50:22 2013 +0200

    Display a relay's downtime when it's offline.
    
    Thanks to "rndm" for the patch.
---
 js/models/relay.js          |    2 ++
 templates/details/main.html |    7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/js/models/relay.js b/js/models/relay.js
index 3730d79..06608dc 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -155,6 +155,8 @@ define([
                     //console.log(relay.uptime.hrfull);
                     relay.uptime = relay.last_restarted ? relay.uptime.millisecs : null;
                     relay.last_restarted = relay.last_restarted ? relay.last_restarted : null;
+                    relay.last_seen = relay.last_seen ? relay.last_seen : null;
+                    relay.downtime = relay.last_seen ? model.parsedate(relay.last_seen).hrfull : null;
                     relay.as_no = relay.as_number ? relay.as_number : null;
                     relay.as_name = relay.as_name ? relay.as_name : null;
                     model.set({badexit: false});
diff --git a/templates/details/main.html b/templates/details/main.html
index 722504d..76f83d2 100644
--- a/templates/details/main.html
+++ b/templates/details/main.html
@@ -98,8 +98,13 @@
     <div class="span4">
     <h3>Status</h3>
 
-    <dt><span class="tip" data-content="Time since when this relay is online." data-original-title="Uptime">Uptime</span></dt>
+    <% if (relay.get('running') === false) { %>
+    <dt><span class="tip" data-content="The time since this relay was last seen online." data-original-title="Downtime">Downtime</span></dt>
+    <dd><%= relay.get('downtime') %></dd>
+    <% } else {%>
+    <dt><span class="tip" data-content="The time since this relay is online." data-original-title="Uptime">Uptime</span></dt>
     <dd><%= relay.get('uptime_hrfull') %></dd>
+    <% } %>
 
     <dt><span class="tip" data-content="Whether this relay is listed in the current Tor directory or not." data-original-title="Running">Running</span></dt>
     <dd><%= relay.get('running') %></dd>





More information about the tor-commits mailing list