mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 04:38:28 +00:00
@@ -76,11 +76,11 @@ function updateTopClientsChart() {
|
|||||||
data.top_sources[utils.escapeHtml(client)] = data.top_sources[client];
|
data.top_sources[utils.escapeHtml(client)] = data.top_sources[client];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.indexOf("|") !== -1) {
|
if (client.indexOf("|") === -1) {
|
||||||
|
clientname = client;
|
||||||
|
} else {
|
||||||
var idx = client.indexOf("|");
|
var idx = client.indexOf("|");
|
||||||
clientname = client.substr(0, idx);
|
clientname = client.substr(0, idx);
|
||||||
} else {
|
|
||||||
clientname = client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
percentage = (data.top_sources[client] / sum) * 100;
|
percentage = (data.top_sources[client] / sum) * 100;
|
||||||
|
|||||||
@@ -95,15 +95,15 @@ var tableApi, statistics;
|
|||||||
function handleAjaxError(xhr, textStatus) {
|
function handleAjaxError(xhr, textStatus) {
|
||||||
if (textStatus === "timeout") {
|
if (textStatus === "timeout") {
|
||||||
alert("The server took too long to send the data.");
|
alert("The server took too long to send the data.");
|
||||||
} else if (xhr.responseText.indexOf("Connection refused") !== -1) {
|
} else if (xhr.responseText.indexOf("Connection refused") === -1) {
|
||||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
|
||||||
} else {
|
|
||||||
alert(
|
alert(
|
||||||
"An unknown error occurred while loading the data.\n" +
|
"An unknown error occurred while loading the data.\n" +
|
||||||
xhr.responseText +
|
xhr.responseText +
|
||||||
"\nCheck the server's log files (/var/log/lighttpd/error-pihole.log) for details.\n\nYou may need to increase PHP memory limit." +
|
"\nCheck the server's log files (/var/log/lighttpd/error-pihole.log) for details.\n\nYou may need to increase PHP memory limit." +
|
||||||
"\n\nYou can find more info in pi-hole's FAQ:\nhttps://docs.pi-hole.net/main/faq/#error-while-loading-data-from-the-long-term-database"
|
"\n\nYou can find more info in pi-hole's FAQ:\nhttps://docs.pi-hole.net/main/faq/#error-while-loading-data-from-the-long-term-database"
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#all-queries_processing").hide();
|
$("#all-queries_processing").hide();
|
||||||
@@ -457,10 +457,10 @@ $(function () {
|
|||||||
});
|
});
|
||||||
$("#all-queries tbody").on("click", "button", function () {
|
$("#all-queries tbody").on("click", "button", function () {
|
||||||
var data = tableApi.row($(this).parents("tr")).data();
|
var data = tableApi.row($(this).parents("tr")).data();
|
||||||
if ([1, 4, 5, 9, 10, 11].indexOf(data[4]) !== -1) {
|
if ([1, 4, 5, 9, 10, 11].indexOf(data[4]) === -1) {
|
||||||
utils.addFromQueryLog(data[2], "white");
|
|
||||||
} else {
|
|
||||||
utils.addFromQueryLog(data[2], "black");
|
utils.addFromQueryLog(data[2], "black");
|
||||||
|
} else {
|
||||||
|
utils.addFromQueryLog(data[2], "white");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ function eventsource() {
|
|||||||
// Detect ${OVER}
|
// Detect ${OVER}
|
||||||
var newString = "<------";
|
var newString = "<------";
|
||||||
|
|
||||||
if (e.data.indexOf(newString) !== -1) {
|
if (e.data.indexOf(newString) === -1) {
|
||||||
|
ta.append(e.data);
|
||||||
|
} else {
|
||||||
ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
|
ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
|
||||||
ta.append(e.data.replace(newString, ""));
|
ta.append(e.data.replace(newString, ""));
|
||||||
} else {
|
|
||||||
ta.append(e.data);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ $(function () {
|
|||||||
statusEl.on("change", editGroup);
|
statusEl.on("change", editGroup);
|
||||||
|
|
||||||
$("td:eq(3)", row).html('<input id="desc_' + data.id + '" class="form-control">');
|
$("td:eq(3)", row).html('<input id="desc_' + data.id + '" class="form-control">');
|
||||||
var desc = data.description !== null ? data.description : "";
|
var desc = data.description === null ? "" : data.description;
|
||||||
var descEl = $("#desc_" + data.id, row);
|
var descEl = $("#desc_" + data.id, row);
|
||||||
descEl.val(utils.unescapeHtml(desc));
|
descEl.val(utils.unescapeHtml(desc));
|
||||||
descEl.on("change", editGroup);
|
descEl.on("change", editGroup);
|
||||||
|
|||||||
@@ -491,13 +491,13 @@ function updateTopClientsChart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client = utils.escapeHtml(client);
|
client = utils.escapeHtml(client);
|
||||||
if (client.indexOf("|") !== -1) {
|
if (client.indexOf("|") === -1) {
|
||||||
|
clientname = client;
|
||||||
|
clientip = client;
|
||||||
|
} else {
|
||||||
idx = client.indexOf("|");
|
idx = client.indexOf("|");
|
||||||
clientname = client.substr(0, idx);
|
clientname = client.substr(0, idx);
|
||||||
clientip = client.substr(idx + 1, client.length - idx);
|
clientip = client.substr(idx + 1, client.length - idx);
|
||||||
} else {
|
|
||||||
clientname = client;
|
|
||||||
clientip = client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
url =
|
url =
|
||||||
@@ -531,7 +531,7 @@ function updateTopClientsChart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client = utils.escapeHtml(client);
|
client = utils.escapeHtml(client);
|
||||||
if (client.indexOf("|") !== -1) {
|
if (client.indexOf("|") === -1) {
|
||||||
idx = client.indexOf("|");
|
idx = client.indexOf("|");
|
||||||
clientname = client.substr(0, idx);
|
clientname = client.substr(0, idx);
|
||||||
clientip = client.substr(idx + 1, client.length - idx);
|
clientip = client.substr(idx + 1, client.length - idx);
|
||||||
@@ -719,10 +719,10 @@ function updateSummaryData(runOnce) {
|
|||||||
}, 500);
|
}, 500);
|
||||||
})
|
})
|
||||||
.done(function () {
|
.done(function () {
|
||||||
if (!FTLoffline) {
|
if (FTLoffline) {
|
||||||
setTimer(1);
|
|
||||||
} else {
|
|
||||||
setTimer(10);
|
setTimer(10);
|
||||||
|
} else {
|
||||||
|
setTimer(1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fail(function () {
|
.fail(function () {
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ var DAY_IN_SECONDS = 24 * 60 * 60;
|
|||||||
function handleAjaxError(xhr, textStatus) {
|
function handleAjaxError(xhr, textStatus) {
|
||||||
if (textStatus === "timeout") {
|
if (textStatus === "timeout") {
|
||||||
alert("The server took too long to send the data.");
|
alert("The server took too long to send the data.");
|
||||||
} else if (xhr.responseText.indexOf("Connection refused") !== -1) {
|
} else if (xhr.responseText.indexOf("Connection refused") === -1) {
|
||||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
|
||||||
} else {
|
|
||||||
alert("An unknown error occurred while loading the data.\n" + xhr.responseText);
|
alert("An unknown error occurred while loading the data.\n" + xhr.responseText);
|
||||||
|
} else {
|
||||||
|
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#network-entries_processing").hide();
|
$("#network-entries_processing").hide();
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ var colTypes = ["time", "query type", "domain", "client", "status", "reply type"
|
|||||||
function handleAjaxError(xhr, textStatus) {
|
function handleAjaxError(xhr, textStatus) {
|
||||||
if (textStatus === "timeout") {
|
if (textStatus === "timeout") {
|
||||||
alert("The server took too long to send the data.");
|
alert("The server took too long to send the data.");
|
||||||
} else if (xhr.responseText.indexOf("Connection refused") !== -1) {
|
} else if (xhr.responseText.indexOf("Connection refused") === -1) {
|
||||||
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
|
||||||
} else {
|
|
||||||
alert("An unknown error occurred while loading the data.\n" + xhr.responseText);
|
alert("An unknown error occurred while loading the data.\n" + xhr.responseText);
|
||||||
|
} else {
|
||||||
|
alert("An error occurred while loading the data: Connection refused. Is FTL running?");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#all-queries_processing").hide();
|
$("#all-queries_processing").hide();
|
||||||
|
|||||||
@@ -366,15 +366,15 @@ $(function () {
|
|||||||
var bargraphs = $("#bargraphs");
|
var bargraphs = $("#bargraphs");
|
||||||
var chkboxData = localStorage ? localStorage.getItem("barchart_chkbox") : null;
|
var chkboxData = localStorage ? localStorage.getItem("barchart_chkbox") : null;
|
||||||
|
|
||||||
if (chkboxData !== null) {
|
if (chkboxData === null) {
|
||||||
// Restore checkbox state
|
|
||||||
bargraphs.prop("checked", chkboxData === "true");
|
|
||||||
} else {
|
|
||||||
// Initialize checkbox
|
// Initialize checkbox
|
||||||
bargraphs.prop("checked", true);
|
bargraphs.prop("checked", true);
|
||||||
if (localStorage) {
|
if (localStorage) {
|
||||||
localStorage.setItem("barchart_chkbox", true);
|
localStorage.setItem("barchart_chkbox", true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Restore checkbox state
|
||||||
|
bargraphs.prop("checked", chkboxData === "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bargraphs.on("click", function () {
|
bargraphs.on("click", function () {
|
||||||
@@ -386,15 +386,15 @@ $(function () {
|
|||||||
var colorfulQueryLog = $("#colorfulQueryLog");
|
var colorfulQueryLog = $("#colorfulQueryLog");
|
||||||
var chkboxData = localStorage ? localStorage.getItem("colorfulQueryLog_chkbox") : null;
|
var chkboxData = localStorage ? localStorage.getItem("colorfulQueryLog_chkbox") : null;
|
||||||
|
|
||||||
if (chkboxData !== null) {
|
if (chkboxData === null) {
|
||||||
// Restore checkbox state
|
|
||||||
colorfulQueryLog.prop("checked", chkboxData === "true");
|
|
||||||
} else {
|
|
||||||
// Initialize checkbox
|
// Initialize checkbox
|
||||||
colorfulQueryLog.prop("checked", false);
|
colorfulQueryLog.prop("checked", false);
|
||||||
if (localStorage) {
|
if (localStorage) {
|
||||||
localStorage.setItem("colorfulQueryLog_chkbox", false);
|
localStorage.setItem("colorfulQueryLog_chkbox", false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Restore checkbox state
|
||||||
|
colorfulQueryLog.prop("checked", chkboxData === "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
colorfulQueryLog.on("click", function () {
|
colorfulQueryLog.on("click", function () {
|
||||||
@@ -452,15 +452,15 @@ $(function () {
|
|||||||
var nonfatalwarnigns = $("#hideNonfatalDnsmasqWarnings");
|
var nonfatalwarnigns = $("#hideNonfatalDnsmasqWarnings");
|
||||||
var chkboxData = localStorage ? localStorage.getItem("hideNonfatalDnsmasqWarnings_chkbox") : null;
|
var chkboxData = localStorage ? localStorage.getItem("hideNonfatalDnsmasqWarnings_chkbox") : null;
|
||||||
|
|
||||||
if (chkboxData !== null) {
|
if (chkboxData === null) {
|
||||||
// Restore checkbox state
|
|
||||||
nonfatalwarnigns.prop("checked", chkboxData === "true");
|
|
||||||
} else {
|
|
||||||
// Initialize checkbox
|
// Initialize checkbox
|
||||||
nonfatalwarnigns.prop("checked", false);
|
nonfatalwarnigns.prop("checked", false);
|
||||||
if (localStorage) {
|
if (localStorage) {
|
||||||
localStorage.setItem("hideNonfatalDnsmasqWarnings_chkbox", false);
|
localStorage.setItem("hideNonfatalDnsmasqWarnings_chkbox", false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Restore checkbox state
|
||||||
|
nonfatalwarnigns.prop("checked", chkboxData === "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
nonfatalwarnigns.on("click", function () {
|
nonfatalwarnigns.on("click", function () {
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ function stateLoadCallback(itemName) {
|
|||||||
// Receive previous state from client's local storage area
|
// Receive previous state from client's local storage area
|
||||||
if (localStorage === null) {
|
if (localStorage === null) {
|
||||||
var item = backupStorage[itemName];
|
var item = backupStorage[itemName];
|
||||||
data = typeof item === "undefined" ? null : item;
|
data = item === "undefined" ? null : item;
|
||||||
} else {
|
} else {
|
||||||
data = localStorage.getItem(itemName);
|
data = localStorage.getItem(itemName);
|
||||||
}
|
}
|
||||||
@@ -310,15 +310,7 @@ function addFromQueryLog(domain, list) {
|
|||||||
},
|
},
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
alProcessing.hide();
|
alProcessing.hide();
|
||||||
if (!response.success) {
|
if (response.success) {
|
||||||
// Failure
|
|
||||||
alNetworkErr.hide();
|
|
||||||
alCustomErr.html(response.message);
|
|
||||||
alFailure.fadeIn(1000);
|
|
||||||
setTimeout(function () {
|
|
||||||
alertModal.modal("hide");
|
|
||||||
}, 10000);
|
|
||||||
} else {
|
|
||||||
// Success
|
// Success
|
||||||
alSuccess.children(alDomain).text(domain);
|
alSuccess.children(alDomain).text(domain);
|
||||||
alSuccess.children(alList).text(listtype);
|
alSuccess.children(alList).text(listtype);
|
||||||
@@ -326,6 +318,14 @@ function addFromQueryLog(domain, list) {
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
alertModal.modal("hide");
|
alertModal.modal("hide");
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
// Failure
|
||||||
|
alNetworkErr.hide();
|
||||||
|
alCustomErr.html(response.message);
|
||||||
|
alFailure.fadeIn(1000);
|
||||||
|
setTimeout(function () {
|
||||||
|
alertModal.modal("hide");
|
||||||
|
}, 10000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user