[tor-commits] [metrics-web/master] More intuitive sorting for aggregated AS/countries

karsten at torproject.org karsten at torproject.org
Mon Jul 9 13:36:16 UTC 2018


commit 8e0953f130018a32f3a7295e264a8afcc5dcdb38
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Mon Jul 9 13:53:59 2018 +0100

    More intuitive sorting for aggregated AS/countries
    
    Fixes: #25242
---
 .../web/templates/rs/aggregate/search.html         | 28 ++++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/web/templates/rs/aggregate/search.html b/src/main/resources/web/templates/rs/aggregate/search.html
index 9a6b6c5..5775057 100644
--- a/src/main/resources/web/templates/rs/aggregate/search.html
+++ b/src/main/resources/web/templates/rs/aggregate/search.html
@@ -62,28 +62,36 @@
       <%= aggregate.version %>
     </td>
     <% } %>
-    <td>
       <% if ((typeof aggregate.country) == "string") { %>
-        <a href="#search/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %><% } %>"><img class="inline country" src="/images/cc/<%= aggregate.country %>.png"> <%= countries[aggregate.country] %></a>
+        <td data-order="0000000001<%= countries[aggregate.country] %>">
+          <a href="#search/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("country:") == -1) { %>country:<%= aggregate.country  %><% } %>"><img class="inline country" src="/images/cc/<%= aggregate.country %>.png"> <%= countries[aggregate.country] %></a>
+        </td>
       <% } else { %>
         <% if ((typeof aggregate.as) == "string") { %>
-          (<a href="#aggregate/ascc/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("as:") == -1) { %>as:<%= aggregate.as %><% } %>"><%= aggregate.country.size %> distinct</a>)
+          <td data-order="<%= aggregate.country.size.toString().padStart(10, "0") %>">
+            (<a href="#aggregate/ascc/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("as:") == -1) { %>as:<%= aggregate.as %><% } %>"><%= aggregate.country.size %> distinct</a>)
+          </td>
         <% } else { %>
-          (<a href="#aggregate/cc<%= (query || aggregate.version) ? "/" : "" %><% (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %>"><%= aggregate.country.size %> distinct</a>)
+          <td data-order="<%= aggregate.country.size.toString().padStart(10, "0") %>">
+            (<a href="#aggregate/cc<%= (query || aggregate.version) ? "/" : "" %><% (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %>"><%= aggregate.country.size %> distinct</a>)
+          </td>
         <% } %>
       <% } %>
-    </td>
-    <td>
       <% if ((typeof aggregate.as) == "string") { %>
-        <a href="#search/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("as:") == -1) { %>as:<%= aggregate.as  %><% } %>"><%= aggregate.as_name %> (<%= aggregate.as %>)</a>
+        <td data-order="0000000001<%= aggregate.as_name %>">
+          <a href="#search/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("as:") == -1) { %>as:<%= aggregate.as  %><% } %>"><%= aggregate.as_name %> (<%= aggregate.as %>)</a>
+          </td>
       <% } else { %>
         <% if ((typeof aggregate.country) == "string") { %>
-          (<a href="#aggregate/ascc/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("country:") == -1) { %>country:<%= aggregate.country %><% } %>"><%= aggregate.as.size %> distinct</a>)
+          <td data-order="<%= aggregate.as.size.toString().padStart(10, "0") %>">
+            (<a href="#aggregate/ascc/<%= (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %><% if (query.indexOf("country:") == -1) { %>country:<%= aggregate.country %><% } %>"><%= aggregate.as.size %> distinct</a>)
+          </td>
         <% } else { %>
-          (<a href="#aggregate/as<%= (query || aggregate.version) ? "/" : "" %><% (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %>"><%= aggregate.as.size %> distinct</a>)
+          <td data-order="<%= aggregate.as.size.toString().padStart(10, "0") %>">
+            (<a href="#aggregate/as<%= (query || aggregate.version) ? "/" : "" %><% (query) ? query + " " : "" %><%= (aggregate.version) ? "version:" + aggregate.version + " " : "" %>"><%= aggregate.as.size %> distinct</a>)
+          </td>
         <% } %>
       <% } %>
-    </td>
     <td data-order="<%= aggregate.consensus_weight_fraction %>"><span class="tip" title="<%= aggregate.consensus_weight %>"><%= (aggregate.consensus_weight_fraction * 100).toFixed(4) %>%</span></td>
     <td data-order="<%= aggregate.advertised_bandwidth %>"><%= hrBandwidth(aggregate.advertised_bandwidth) %></span></td>
     <td data-order="<%= aggregate.guard_probability %>"><%= (aggregate.guard_probability * 100).toFixed(4) %>%</td>





More information about the tor-commits mailing list