[tor-commits] [compass/master] Some additions. Have no idea if they're good

karsten at torproject.org karsten at torproject.org
Mon Jan 7 07:09:40 UTC 2013


commit 4f1f552a0e4c7bd2644e554ca5c8bc00c81bb721
Author: Chris Wacek <cwacek at cs.georgetown.edu>
Date:   Tue Dec 4 11:55:46 2012 -0500

    Some additions. Have no idea if they're good
---
 templates/index.html  |   63 ++++++++++++++++++++++++++++++++++++++++--------
 templates/result.html |    2 +-
 2 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/templates/index.html b/templates/index.html
index 3ef758a..80043ab 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="en" ng-app="Compass">
   <head>
     <meta charset="utf-8">
     <title>Compass</title>
@@ -8,8 +8,8 @@
     <meta name="author" content="Sathyanarayanan Gunasekaran">
 
     <!-- Le styles -->
-    <link href="{{ url_for('static', filename='css/bootstrap.css') }}" rel="stylesheet">
-    <link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
+    <link href="static/css/bootstrap.css" rel="stylesheet">
+    <link href="static/css/style.css" rel="stylesheet">
     <style type="text/css">
       body {
         padding-top: 60px;
@@ -33,12 +33,10 @@
             <span class="icon-bar"></span>
             <span class="icon-bar"></span>
           </a>
-          <a class="brand" href="{{
-        url_for('index') }}"><img src="{{ url_for('static', filename='img/compass-logo.jpg') }}" /></a>
+          <a class="brand" href="/"><img src="static/img/compass-logo.jpg" /></a>
           <div class="nav-collapse">
             <ul class="nav">
-              <li class="active"><a href="{{
-        url_for('index') }}">Home</a></li>
+              <li class="active"><a href="/">Home</a></li>
               <li><a href="https://trac.torproject.org/projects/tor/ticket/6498">Trac
               Ticket #6498</a></li>
             </ul>
@@ -47,7 +45,7 @@
       </div>
     </div>
 
-    <div class="container">
+    <div class="container" ng-controller="CompassCtrl">
       <div class="hero-unit">
         <form class="form-horizontal" action=""
               method=get id="form">
@@ -58,13 +56,13 @@
               <label class="control-label" for="inactive">Inactive</label>
             <div class="controls">
               <label class="checkbox">
-                <input type="checkbox" id="inactive" value="True" name="inactive">
+                <input type="checkbox" id="inactive" value="True" name="inactive" ng-model='inactive'>
                   include relays in selection that aren't currently running </label>
             </div>
             <label class="control-label" for="guards">Guards</label>
             <div class="controls">
               <label class="checkbox">
-                <input type="checkbox" id="guards_only" value="True" name="guards_only">
+                <input type="checkbox" id="guards_only" value="True" name="guards_only" ng-model='guards_only'>
                  select only relays suitable for guard position
               </label>
             </div>
@@ -147,7 +145,48 @@
 
       <div class="loading"><img src="{{ url_for('static', filename='img/loader.gif') }}" /></div>
       <hr>
-      <div id="result"></div>
+      <div id="result" ></div>
+      <table class="table table-striped">
+      <thead>
+      <tr>
+      <th>#</th>
+      <th><span rel="tooltip" title="Relative bandwidth weight assigned to this relay by the directory authorities">Consensus Weights</span></th>
+      <th><span rel="tooltip" title="Relative advertised bandwidth of this relay compared to the total advertised bandwidth in the network">Advertised Bandwidth</span></th>
+      <th><span rel="tooltip" title=" Probability of this relay to be selected for the guard position">Guard Probability</span></th>
+      <th><span rel="tooltip" title="Probability of this relay to be selected for the middle position">Middle Probability</span></th>
+      <th><span rel="tooltip" title="Probability of this relay to be selected for the exit position">Exit Probability</span></th>
+      <th>Nickname</th>
+      <th>Fingerprint</th>
+      <th>Exit</th>
+      <th>Guard</th>
+      <th>Country</th>
+      <th>Autonomous System</th>
+      </tr>
+      </thead>                                         
+      <tbody>
+      <tr ng-repeat="relay in relayResults.results">
+        <td> [[ relay.index ]] </td>
+        <td> [[ relay.cw ]] </td>
+        <td> [[ relay.adv_bw]] </td>
+        <td>[[ relay.p_guard ]]</td>
+        <td>[[ relay.p_middle ]]</td>
+        <td>[[ relay.p_exit ]]</td>
+        <td>[[ relay.nick ]]</td>
+        <!-- it's not a fingerprint -->
+        {% if relay.fp|length != 40 %}
+        <td>[[ relay.fp ]]</td>
+        {% else %}
+        <td><a href="https://atlas.torproject.org/#details/[[ relay.fp ]]">[[ relay.fp[:8] ]]</a></td>
+        {% endif %}
+        <td>[[ relay.exit ]]</td>
+        <td>[[ relay.guard ]]</td>
+        <td>[[ relay.cc ]]</td>
+        <td>[[ relay.as_info ]]</td>
+      <tr>
+      </tbody>
+      </table>
+
+
 
       <footer>
         The Tor Project - 2012<br>
@@ -166,6 +205,8 @@
     <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
     <script src="{{ url_for('static', filename='js/bootstrap-tooltip.js') }}"></script>
     <script src="{{ url_for('static', filename='js/custom.js') }}"></script>
+    <script src="{{ url_for('static', filename='js/angular/angular.js') }}"></script>
+    <script src="{{ url_for('static', filename='js/angularize.js') }}"></script>
     <script>
       doAjax();
       setOptions();
diff --git a/templates/result.html b/templates/result.html
index 5fad51c..3d4b57a 100644
--- a/templates/result.html
+++ b/templates/result.html
@@ -1,4 +1,4 @@
-<div class="hero-unit">
+<div class="hero-unit" ng-app ngController="TorRelayCtrl">
   <table class="table table-striped table-condensed table-hover table-bordered">
     <thead>
       <tr>





More information about the tor-commits mailing list