[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [atlas/master] Completes advanced search form (Fixes: #23782, #24461)



commit c71dd3714edd33f82e7bfc5e747fadfabe0fd5b6
Author: Iain R. Learmonth <irl@xxxxxxxx>
Date:   Sat Dec 2 16:37:44 2017 +0000

    Completes advanced search form (Fixes: #23782, #24461)
---
 css/atlas.css              |  5 +++++
 js/views/search/main.js    | 13 +++++++++++++
 templates/search/main.html | 22 ++++++++++++++++++++--
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/css/atlas.css b/css/atlas.css
index ac1c410..3fd9cdb 100644
--- a/css/atlas.css
+++ b/css/atlas.css
@@ -87,3 +87,8 @@ dd {
 td a {
     padding-right: 0 !important;
 }
+
+.day-spinner {
+    width: 120px;
+    display: inline;
+}
diff --git a/js/views/search/main.js b/js/views/search/main.js
index 92ae96f..5ad2a1d 100644
--- a/js/views/search/main.js
+++ b/js/views/search/main.js
@@ -60,27 +60,40 @@ define([
               if($('#advanced-search-hostname').val().trim() != "") query += "host_name:" + $('#advanced-search-hostname').val().trim().split(" ")[0] + " ";
               if($('#advanced-search-type').val() !== "") query += "type:" + $('#advanced-search-type').val() + " ";
               if($('#advanced-search-running').val() !== "") query += "running:" + $('#advanced-search-running').val() + " ";
+              if($('#advanced-search-first-seen-from').val() !== "0" || $('#advanced-search-first-seen-to').val() !== "0") query += "first_seen_days:" + $('#advanced-search-first-seen-from').val() + "-" + $('#advanced-search-first-seen-to').val() + " ";
+              if($('#advanced-search-last-seen-from').val() !== "0" || $('#advanced-search-last-seen-to').val() !== "0") query += "last_seen_days:" + $('#advanced-search-last-seen-from').val() + "-" + $('#advanced-search-last-seen-to').val() + " ";
+              if($('#advanced-search-version').val().trim() != "") query += "version:" + $('#advanced-search-version').val().trim().split(" ")[0] + " ";
               return query;
             }
 
             $("#do-advanced").bind('click', function(){
                 var query = buildAdvancedQuery();
                 document.location = "#search/"+encodeURI(query);
+                return false;
             });
 
             $("#do-advanced-aggregation").bind('click', function(){
                 var query = buildAdvancedQuery();
                 document.location = "#aggregate/all/"+encodeURI(query);
+                return false;
             });
 
             $("#do-advanced-aggregation-cc").bind('click', function(){
                 var query = buildAdvancedQuery();
                 document.location = "#aggregate/cc/"+encodeURI(query);
+                return false;
             });
 
             $("#do-advanced-aggregation-as").bind('click', function(){
                 var query = buildAdvancedQuery();
                 document.location = "#aggregate/as/"+encodeURI(query);
+                return false;
+            });
+
+            $("#home-advanced-search").bind('submit', function(){
+                var query = buildAdvancedQuery();
+                document.location = "#search/"+encodeURI(query);
+                return false;
             });
 
             $(".tip").tooltip();
diff --git a/templates/search/main.html b/templates/search/main.html
index 6dc522b..9af49ae 100644
--- a/templates/search/main.html
+++ b/templates/search/main.html
@@ -44,6 +44,8 @@ probabilities of using relays in a particular country or AS as a guard, middle
 or exit relay filtered by the search parameters.</p>
 <div class="panel panel-default"><div class="panel-body">
   <form id="home-advanced-search">
+    <div class="row">
+    <div class="col-md-6">
     <div class="form-group">
       <label for="advanced-search-nickname">Nickname:</label>
       <input type="text" class="form-control search-query" autocorrect="off" autocapitalize="off" id="advanced-search-nickname">
@@ -89,11 +91,25 @@ or exit relay filtered by the search parameters.</p>
         <input type="text" id="advanced-search-as" class="search-query form-control">
       </div>
      </div>
+    </div><!-- col-md-6 -->
+    <div class="col-md-6">
     <div class="form-group">
-      <label for="advanced-search-nickname">Hostname:</label>
+      <label for="advanced-search-hostname">Hostname:</label>
       <input type="text" class="form-control search-query" autocorrect="off" autocapitalize="off" id="advanced-search-hostname">
     </div>
     <div class="form-group">
+      <label>First Seen:</label><br>
+      From <input type="number" id="advanced-search-first-seen-from" class="form-control day-spinner" value="0"> to <input type="number" id="advanced-search-first-seen-to" class="form-control day-spinner" value="0"> days ago
+    </div>
+    <div class="form-group">
+      <label>Last Seen:</label><br>
+      From <input type="number" id="advanced-search-last-seen-from" class="form-control day-spinner" value="0"> to <input type="number" id="advanced-search-last-seen-to" class="form-control day-spinner" value="0"> days ago
+    </div>
+    <div class="form-group">
+      <label for="advanced-search-version">Version:</label>
+      <input type="text" class="form-control search-query" autocorrect="off" autocapitalize="off" id="advanced-search-version">
+    </div>
+    <div class="form-group">
       <label for="advanced-search-flag">Type<sup>&dagger;</sup>:</label>
       <select class="form-control" id="advanced-search-type">
         <option value="">Any</option>
@@ -109,7 +125,9 @@ or exit relay filtered by the search parameters.</p>
         <option value="false">Only Offline Relays</option>
       </select>
     </div>
-    <p><button id="do-advanced" class="btn btn-primary" type="button">Advanced Search</button></p>
+    </div><!-- col-md-6 -->
+    </div><!-- row -->
+    <p><button id="do-advanced" class="btn btn-primary" type="submit">Advanced Search</button></p>
     <p>
       <button id="do-advanced-aggregation" class="btn btn-primary" type="button">Advanced Aggregation</button>
       <button id="do-advanced-aggregation-cc" class="btn btn-secondary tip" type="button" title="Aggregate by Country">by CC</button>

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits