Ticket #9814: 0001-9814-added-downtime-if-the-relay-isnt-running.patch

File 0001-9814-added-downtime-if-the-relay-isnt-running.patch, 1.9 KB (added by rndm, 6 years ago)

Patch to display the downtime if a relay isn't running

  • js/models/relay.js

    From ce4c1492f89f98e4479658818abd83b013ce393b Mon Sep 17 00:00:00 2001
    From: Christian <me@rndm.de>
    Date: Wed, 9 Oct 2013 20:29:16 +0200
    Subject: [PATCH] #9814 added downtime if the relay isnt running
    
    ---
     js/models/relay.js          | 2 ++
     templates/details/main.html | 5 +++++
     2 files changed, 7 insertions(+)
    
    diff --git a/js/models/relay.js b/js/models/relay.js
    index 3730d79..06608dc 100644
    a b define([ 
    155155                    //console.log(relay.uptime.hrfull);
    156156                    relay.uptime = relay.last_restarted ? relay.uptime.millisecs : null;
    157157                    relay.last_restarted = relay.last_restarted ? relay.last_restarted : null;
     158                    relay.last_seen = relay.last_seen ? relay.last_seen : null;
     159                    relay.downtime = relay.last_seen ? model.parsedate(relay.last_seen).hrfull : null;
    158160                    relay.as_no = relay.as_number ? relay.as_number : null;
    159161                    relay.as_name = relay.as_name ? relay.as_name : null;
    160162                    model.set({badexit: false});
  • templates/details/main.html

    diff --git a/templates/details/main.html b/templates/details/main.html
    index 722504d..9625c0b 100644
    a b  
    9898    <div class="span4">
    9999    <h3>Status</h3>
    100100
     101    <% if (relay.get('running')) { %>
    101102    <dt><span class="tip" data-content="Time since when this relay is online." data-original-title="Uptime">Uptime</span></dt>
    102103    <dd><%= relay.get('uptime_hrfull') %></dd>
     104    <% } else { %>
     105    <dt><span class="tip" data-content="Time since when this relay is offline." data-original-title="Downtime">Downtime</span></dt>
     106    <dd><%= relay.get('downtime') %></dd>
     107    <% } %>
    103108
    104109    <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>
    105110    <dd><%= relay.get('running') %></dd>