From b50595e3aeedc5997ffd77417099a3990ebba1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 20 Jan 2023 15:03:14 +0100 Subject: [PATCH] Don't use idstring in messages when it's not necessary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- scripts/pi-hole/js/groups-adlists.js | 18 ++++++++++++++---- scripts/pi-hole/js/groups-clients.js | 18 ++++++++++++++---- scripts/pi-hole/js/groups-domains.js | 18 ++++++++++++++---- scripts/pi-hole/js/groups.js | 18 ++++++++++++++---- scripts/pi-hole/js/messages.js | 23 ++++++++++++++--------- scripts/pi-hole/js/network.js | 9 ++------- 6 files changed, 72 insertions(+), 32 deletions(-) diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js index 9b6a702786..bbff8225be 100644 --- a/scripts/pi-hole/js/groups-adlists.js +++ b/scripts/pi-hole/js/groups-adlists.js @@ -465,7 +465,7 @@ function delItems(ids) { utils.disableAll(); var idstring = ids.join(", "); - utils.showAlert("info", "", "Deleting Adlist with ID: " + idstring, "..."); + utils.showAlert("info", "", "Deleting adlist(s) ...", ""); $.ajax({ url: "scripts/pi-hole/php/groups.php", @@ -479,7 +479,7 @@ function delItems(ids) { utils.showAlert( "success", "far fa-trash-alt", - "Successfully deleted adlists: " + idstring, + "Successfully deleted adlist(s): ", "" ); for (var id in ids) { @@ -488,7 +488,12 @@ function delItems(ids) { } } } else { - utils.showAlert("error", "", "Error while deleting adlists: " + idstring, response.message); + utils.showAlert( + "error", + "", + "Error while deleting adlist(s): " + idstring, + response.message + ); } // Clear selection after deletion @@ -497,7 +502,12 @@ function delItems(ids) { }) .fail(function (jqXHR, exception) { utils.enableAll(); - utils.showAlert("error", "", "Error while deleting adlists: " + idstring, jqXHR.responseText); + utils.showAlert( + "error", + "", + "Error while deleting adlist(s): " + idstring, + jqXHR.responseText + ); console.log(exception); // eslint-disable-line no-console }); } diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js index fa96c0382a..f2ad8246ab 100644 --- a/scripts/pi-hole/js/groups-clients.js +++ b/scripts/pi-hole/js/groups-clients.js @@ -362,7 +362,7 @@ function delItems(ids) { utils.disableAll(); var idstring = ids.join(", "); - utils.showAlert("info", "", "Deleting client with ID: " + idstring, "..."); + utils.showAlert("info", "", "Deleting client(s)...", ""); $.ajax({ url: "scripts/pi-hole/php/groups.php", @@ -376,7 +376,7 @@ function delItems(ids) { utils.showAlert( "success", "far fa-trash-alt", - "Successfully deleted clients: " + idstring, + "Successfully deleted client(s): ", "" ); for (var id in ids) { @@ -385,7 +385,12 @@ function delItems(ids) { } } } else { - utils.showAlert("error", "", "Error while deleting clients: " + idstring, response.message); + utils.showAlert( + "error", + "", + "Error while deleting client(s): " + idstring, + response.message + ); } // Clear selection after deletion @@ -394,7 +399,12 @@ function delItems(ids) { }) .fail(function (jqXHR, exception) { utils.enableAll(); - utils.showAlert("error", "", "Error while deleting clients: " + idstring, jqXHR.responseText); + utils.showAlert( + "error", + "", + "Error while deleting client(s): " + idstring, + jqXHR.responseText + ); console.log(exception); // eslint-disable-line no-console }); } diff --git a/scripts/pi-hole/js/groups-domains.js b/scripts/pi-hole/js/groups-domains.js index 486a5bbe5e..76d29d5e2f 100644 --- a/scripts/pi-hole/js/groups-domains.js +++ b/scripts/pi-hole/js/groups-domains.js @@ -455,7 +455,7 @@ function delItems(ids) { utils.disableAll(); var idstring = ids.join(", "); - utils.showAlert("info", "", "Deleting item with ID: " + idstring, "..."); + utils.showAlert("info", "", "Deleting domain(s)...", ""); $.ajax({ url: "scripts/pi-hole/php/groups.php", @@ -469,7 +469,7 @@ function delItems(ids) { utils.showAlert( "success", "far fa-trash-alt", - "Successfully deleted items: " + idstring, + "Successfully deleted domain(s): ", "" ); for (var id in ids) { @@ -478,7 +478,12 @@ function delItems(ids) { } } } else { - utils.showAlert("error", "", "Error while deleting items: " + idstring, response.message); + utils.showAlert( + "error", + "", + "Error while deleting domain(s): " + idstring, + response.message + ); } // Clear selection after deletion @@ -487,7 +492,12 @@ function delItems(ids) { }) .fail(function (jqXHR, exception) { utils.enableAll(); - utils.showAlert("error", "", "Error while deleting items: " + idstring, jqXHR.responseText); + utils.showAlert( + "error", + "", + "Error while deleting domain(s): " + idstring, + jqXHR.responseText + ); console.log(exception); // eslint-disable-line no-console }); } diff --git a/scripts/pi-hole/js/groups.js b/scripts/pi-hole/js/groups.js index dcc671462d..30efc06364 100644 --- a/scripts/pi-hole/js/groups.js +++ b/scripts/pi-hole/js/groups.js @@ -224,7 +224,7 @@ function delItems(ids) { utils.disableAll(); var idstring = ids.join(", "); - utils.showAlert("info", "", "Deleting group with ID: " + idstring, "..."); + utils.showAlert("info", "", "Deleting group(s)...", ""); $.ajax({ url: "scripts/pi-hole/php/groups.php", @@ -238,7 +238,7 @@ function delItems(ids) { utils.showAlert( "success", "far fa-trash-alt", - "Successfully deleted groups: " + idstring, + "Successfully deleted group(s): ", "" ); for (var id in ids) { @@ -247,7 +247,12 @@ function delItems(ids) { } } } else { - utils.showAlert("error", "", "Error while deleting groups: " + idstring, response.message); + utils.showAlert( + "error", + "", + "Error while deleting group(s): " + idstring, + response.message + ); } // Clear selection after deletion @@ -256,7 +261,12 @@ function delItems(ids) { }) .fail(function (jqXHR, exception) { utils.enableAll(); - utils.showAlert("error", "", "Error while deleting groups: " + idstring, jqXHR.responseText); + utils.showAlert( + "error", + "", + "Error while deleting group(s): " + idstring, + jqXHR.responseText + ); console.log(exception); // eslint-disable-line no-console }); } diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js index 3b7216edd1..a2668aca95 100644 --- a/scripts/pi-hole/js/messages.js +++ b/scripts/pi-hole/js/messages.js @@ -338,7 +338,7 @@ function delMsg(ids) { utils.disableAll(); var idstring = ids.join(", "); - utils.showAlert("info", "", "Deleting message with ID: " + idstring, "..."); + utils.showAlert("info", "", "Deleting message(s)..."); $.ajax({ url: "scripts/pi-hole/php/message.php", @@ -349,19 +349,19 @@ function delMsg(ids) { .done(function (response) { utils.enableAll(); if (response.success) { - utils.showAlert( - "success", - "far fa-trash-alt", - "Successfully deleted messages: " + idstring, - "" - ); + utils.showAlert("success", "far fa-trash-alt", "Successfully deleted message(s)", ""); for (var id in ids) { if (Object.hasOwnProperty.call(ids, id)) { table.row(id).remove().draw(false).ajax.reload(null, false); } } } else { - utils.showAlert("error", "", "Error while deleting message: " + idstring, response.message); + utils.showAlert( + "error", + "", + "Error while deleting message(s): " + idstring, + response.message + ); } // Clear selection after deletion @@ -373,7 +373,12 @@ function delMsg(ids) { ) .fail(function (jqXHR, exception) { utils.enableAll(); - utils.showAlert("error", "", "Error while deleting message: " + idstring, jqXHR.responseText); + utils.showAlert( + "error", + "", + "Error while deleting message(s): " + idstring, + jqXHR.responseText + ); console.log(exception); // eslint-disable-line no-console }); } diff --git a/scripts/pi-hole/js/network.js b/scripts/pi-hole/js/network.js index 20c6c678d1..7899374b06 100644 --- a/scripts/pi-hole/js/network.js +++ b/scripts/pi-hole/js/network.js @@ -65,7 +65,7 @@ function deleteNetworkEntry() { var id = tr.attr("data-id"); utils.disableAll(); - utils.showAlert("info", "", "Deleting network table entry with ID " + parseInt(id, 10), "..."); + utils.showAlert("info", "", "Deleting network table entry..."); $.ajax({ url: "scripts/pi-hole/php/network.php", method: "post", @@ -74,12 +74,7 @@ function deleteNetworkEntry() { success: function (response) { utils.enableAll(); if (response.success) { - utils.showAlert( - "success", - "far fa-trash-alt", - "Successfully deleted network table entry # ", - id - ); + utils.showAlert("success", "far fa-trash-alt", "Successfully deleted network table entry"); tableApi.row(tr).remove().draw(false).ajax.reload(null, false); } else { utils.showAlert(