mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 04:38:28 +00:00
Use the much quicker /api/info/messages/count to get the number of available messages
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -368,20 +368,20 @@ function checkMessages() {
|
|||||||
? localStorage.getItem("hideNonfatalDnsmasqWarnings_chkbox") === "true"
|
? localStorage.getItem("hideNonfatalDnsmasqWarnings_chkbox") === "true"
|
||||||
: false;
|
: false;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/api/info/messages" + (ignoreNonfatal ? "?filter_dnsmasq_warnings=true" : ""),
|
url: "/api/info/messages/count" + (ignoreNonfatal ? "?filter_dnsmasq_warnings=true" : ""),
|
||||||
method: "GET",
|
method: "GET",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
})
|
})
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
if (data.messages.length > 0) {
|
if (data.count > 0) {
|
||||||
var more = '\nAccess "Tools/Pi-hole diganosis" for further details.';
|
var more = '\nAccess "Tools/Pi-hole diganosis" for further details.';
|
||||||
var title =
|
var title =
|
||||||
data.messages.length > 1
|
data.count > 1
|
||||||
? "There are " + data.messages.length + " warnings." + more
|
? "There are " + data.count + " warnings." + more
|
||||||
: "There is one warning." + more;
|
: "There is one warning." + more;
|
||||||
|
|
||||||
$(".warning-count").prop("title", title);
|
$(".warning-count").prop("title", title);
|
||||||
$(".warning-count").text(data.messages.length);
|
$(".warning-count").text(data.count);
|
||||||
$(".warning-count").removeClass("hidden");
|
$(".warning-count").removeClass("hidden");
|
||||||
} else {
|
} else {
|
||||||
$(".warning-count").addClass("hidden");
|
$(".warning-count").addClass("hidden");
|
||||||
|
|||||||
Reference in New Issue
Block a user