statistics.html: Filter hood when clicking sectors in pie charts

Fixes #107

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2017-12-20 16:58:38 +01:00
parent a3ee0edead
commit 5e8e399a70
2 changed files with 7 additions and 2 deletions

View File

@ -358,7 +358,7 @@ function global_router_firmwares_graph() {
});
placeholder.bind("plotclick", function(event, pos, obj) {
if (obj && obj.series.label != "Other") {
window.location.href = routers_page_url + "?q=firmware:^" + obj.series.label + "$";
window.location.href = routers_page_url + encodeURI("?q=firmware:^" + obj.series.label + "$ " + hoodstr);
}
});
}
@ -383,7 +383,7 @@ function global_router_models_graph() {
});
placeholder.bind("plotclick", function(event, pos, obj) {
if (obj && obj.series.label != "Other") {
window.location.href = routers_page_url + "?q=hardware:^" + obj.series.label.replace(/ /g, '_') + "$";
window.location.href = routers_page_url + encodeURI("?q=hardware:^" + obj.series.label.replace(/ /g, '_') + "$ " + hoodstr);
}
});
}

View File

@ -148,6 +148,11 @@
var router_firmwares = {{ router_firmwares|tojson }};
var router_models = {{ router_models|tojson }};
var routers_page_url = "{{ url_for('router_list') }}";
var hood = "{{selecthood}}";
var hoodstr = "";
if (hood != "All Hoods") {
hoodstr = "hood:^" + hood.replace(/ /g, '_') + "$";
}
$(document).ready(function() {
global_client_graph();
global_router_graph();