mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Fix upstream links yielding no results on the Query Log if names are shown
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* global upstreams */
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var THEME_COLORS = [
|
||||
"#f56954",
|
||||
@@ -97,7 +99,8 @@ const htmlLegendPlugin = {
|
||||
window.location.href = "queries.lp?type=" + item.text;
|
||||
} else if (chart.canvas.id === "forwardDestinationPieChart") {
|
||||
// Encode the forward destination as it may contain an "#" character
|
||||
window.location.href = "queries.lp?upstream=" + encodeURIComponent(item.text);
|
||||
const upstream = encodeURIComponent(upstreams[item.text]);
|
||||
window.location.href = "queries.lp?upstream=" + upstream;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ function updateClientsOverTime() {
|
||||
});
|
||||
}
|
||||
|
||||
var upstreams = {};
|
||||
function updateForwardDestinationsPie() {
|
||||
$.getJSON("/api/stats/upstreams", function (data) {
|
||||
var v = [],
|
||||
@@ -221,6 +222,12 @@ function updateForwardDestinationsPie() {
|
||||
label += "#" + item.port;
|
||||
}
|
||||
|
||||
// Store upstreams for generating links to the Query Log
|
||||
upstreams[label] = item.ip;
|
||||
if (item.port > 0) {
|
||||
upstreams[label] += "#" + item.port;
|
||||
}
|
||||
|
||||
var percent = (100 * item.count) / sum;
|
||||
values.push([label, percent, THEME_COLORS[i++ % THEME_COLORS.length]]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user