From acac90f79d5903447b8bade67ccfb4b5f112f797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Tue, 17 Jan 2023 07:16:18 +0100 Subject: [PATCH 1/2] Tweak deleting message 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 | 2 +- scripts/pi-hole/js/groups-clients.js | 2 +- scripts/pi-hole/js/groups-domains.js | 2 +- scripts/pi-hole/js/groups.js | 2 +- scripts/pi-hole/js/messages.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js index e8e9cb2c5..9b6a70278 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 Adlists: " + idstring, "..."); + utils.showAlert("info", "", "Deleting Adlist with ID: " + idstring, "..."); $.ajax({ url: "scripts/pi-hole/php/groups.php", diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js index ec77bc61d..fa96c0382 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 clients: " + idstring, "..."); + utils.showAlert("info", "", "Deleting client with ID: " + idstring, "..."); $.ajax({ url: "scripts/pi-hole/php/groups.php", diff --git a/scripts/pi-hole/js/groups-domains.js b/scripts/pi-hole/js/groups-domains.js index f1228dd53..486a5bbe5 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 items: " + idstring, "..."); + utils.showAlert("info", "", "Deleting item with ID: " + idstring, "..."); $.ajax({ url: "scripts/pi-hole/php/groups.php", diff --git a/scripts/pi-hole/js/groups.js b/scripts/pi-hole/js/groups.js index 8f21d460d..dcc671462 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 groups: " + idstring, "..."); + utils.showAlert("info", "", "Deleting group with ID: " + idstring, "..."); $.ajax({ url: "scripts/pi-hole/php/groups.php", diff --git a/scripts/pi-hole/js/messages.js b/scripts/pi-hole/js/messages.js index a480d550c..3b7216edd 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 messages: " + idstring, "..."); + utils.showAlert("info", "", "Deleting message with ID: " + idstring, "..."); $.ajax({ url: "scripts/pi-hole/php/message.php", From 44739552912bb3b946ccc93f25e9e0fed51c10c1 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 2/2] 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 9b6a70278..bbff8225b 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) ...", "
    " + address + "
"); $.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): ", "
    " + address + "
" ); 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 fa96c0382..f2ad8246a 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)...", "
    " + items + "
"); $.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): ", "
    " + items + "
" ); 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 486a5bbe5..76d29d5e2 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)...", "
    " + items + "
"); $.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): ", "
    " + items + "
" ); 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 dcc671462..30efc0636 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)...", "
    " + items + "
"); $.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): ", "
    " + items + "
" ); 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 3b7216edd..a2668aca9 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 20c6c678d..7899374b0 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(