commit 9a4afc84a64c52bcb1dff4ab0324aea5af69e9c1 Author: Iain R. Learmonth irl@fsfe.org Date: Sun Dec 17 19:23:12 2017 +0000
Improves the advanced search form for aggregated queries (Fixes: #24507)
* Empty search forms will cause aggregations to be performed on the whole network. * Added an AS+CC aggregation button to allow to aggregate by both for the entire network. --- js/views/search/main.js | 20 ++++++++++++-------- templates/search/main.html | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/js/views/search/main.js b/js/views/search/main.js index 5ad2a1d..58d6401 100644 --- a/js/views/search/main.js +++ b/js/views/search/main.js @@ -72,22 +72,26 @@ define([ return false; });
- $("#do-advanced-aggregation").bind('click', function(){ + var goAggregate = function(type) { var query = buildAdvancedQuery(); - document.location = "#aggregate/all/"+encodeURI(query); + document.location = "#aggregate/" + type + ((query) ? "/" + encodeURI(query) : ""); return false; + } + + $("#do-advanced-aggregation").bind('click', function(){ + return goAggregate("all") });
$("#do-advanced-aggregation-cc").bind('click', function(){ - var query = buildAdvancedQuery(); - document.location = "#aggregate/cc/"+encodeURI(query); - return false; + return goAggregate("cc") });
$("#do-advanced-aggregation-as").bind('click', function(){ - var query = buildAdvancedQuery(); - document.location = "#aggregate/as/"+encodeURI(query); - return false; + return goAggregate("as") + }); + + $("#do-advanced-aggregation-ascc").bind('click', function(){ + return goAggregate("ascc") });
$("#home-advanced-search").bind('submit', function(){ diff --git a/templates/search/main.html b/templates/search/main.html index c72158e..5c48a77 100644 --- a/templates/search/main.html +++ b/templates/search/main.html @@ -130,8 +130,9 @@ or exit relay filtered by the search parameters.</p> <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> <button id="do-advanced-aggregation-as" class="btn btn-secondary tip" type="button" title="Aggregate by Autonomous System">by AS</button> + <button id="do-advanced-aggregation-cc" class="btn btn-secondary tip" type="button" title="Aggregate by Country">by CC</button> + <button id="do-advanced-aggregation-ascc" class="btn btn-secondary tip" type="button" title="Aggregate by Autonomous System">by AS+CC</button> </p> </form> <p><sup>†</sup> These options are ignored when performing an aggregation as the aggregated searches are restricted to only currently running relays.</p>