Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak deleting message #2498

Merged
merged 2 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions scripts/pi-hole/js/groups-adlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function delItems(ids) {

utils.disableAll();
var idstring = ids.join(", ");
utils.showAlert("info", "", "Deleting Adlists: " + idstring, "...");
utils.showAlert("info", "", "Deleting adlist(s) ...", "<ul>" + address + "</ul>");

$.ajax({
url: "scripts/pi-hole/php/groups.php",
Expand All @@ -479,7 +479,7 @@ function delItems(ids) {
utils.showAlert(
"success",
"far fa-trash-alt",
"Successfully deleted adlists: " + idstring,
"Successfully deleted adlist(s): ",
"<ul>" + address + "</ul>"
);
for (var id in ids) {
Expand All @@ -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
Expand All @@ -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
});
}
Expand Down
18 changes: 14 additions & 4 deletions scripts/pi-hole/js/groups-clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ function delItems(ids) {

utils.disableAll();
var idstring = ids.join(", ");
utils.showAlert("info", "", "Deleting clients: " + idstring, "...");
utils.showAlert("info", "", "Deleting client(s)...", "<ul>" + items + "</ul>");

$.ajax({
url: "scripts/pi-hole/php/groups.php",
Expand All @@ -376,7 +376,7 @@ function delItems(ids) {
utils.showAlert(
"success",
"far fa-trash-alt",
"Successfully deleted clients: " + idstring,
"Successfully deleted client(s): ",
"<ul>" + items + "</ul>"
);
for (var id in ids) {
Expand All @@ -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
Expand All @@ -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
});
}
Expand Down
18 changes: 14 additions & 4 deletions scripts/pi-hole/js/groups-domains.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function delItems(ids) {

utils.disableAll();
var idstring = ids.join(", ");
utils.showAlert("info", "", "Deleting items: " + idstring, "...");
utils.showAlert("info", "", "Deleting domain(s)...", "<ul>" + items + "</ul>");

$.ajax({
url: "scripts/pi-hole/php/groups.php",
Expand All @@ -469,7 +469,7 @@ function delItems(ids) {
utils.showAlert(
"success",
"far fa-trash-alt",
"Successfully deleted items: " + idstring,
"Successfully deleted domain(s): ",
"<ul>" + items + "</ul>"
);
for (var id in ids) {
Expand All @@ -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
Expand All @@ -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
});
}
Expand Down
18 changes: 14 additions & 4 deletions scripts/pi-hole/js/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function delItems(ids) {

utils.disableAll();
var idstring = ids.join(", ");
utils.showAlert("info", "", "Deleting groups: " + idstring, "...");
utils.showAlert("info", "", "Deleting group(s)...", "<ul>" + items + "</ul>");

$.ajax({
url: "scripts/pi-hole/php/groups.php",
Expand All @@ -238,7 +238,7 @@ function delItems(ids) {
utils.showAlert(
"success",
"far fa-trash-alt",
"Successfully deleted groups: " + idstring,
"Successfully deleted group(s): ",
"<ul>" + items + "</ul>"
);
for (var id in ids) {
Expand All @@ -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
Expand All @@ -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
});
}
Expand Down
23 changes: 14 additions & 9 deletions scripts/pi-hole/js/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function delMsg(ids) {

utils.disableAll();
var idstring = ids.join(", ");
utils.showAlert("info", "", "Deleting messages: " + idstring, "...");
utils.showAlert("info", "", "Deleting message(s)...");

$.ajax({
url: "scripts/pi-hole/php/message.php",
Expand All @@ -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
Expand All @@ -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
});
}
9 changes: 2 additions & 7 deletions scripts/pi-hole/js/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(
Expand Down