mirror of
https://github.com/pi-hole/web.git
synced 2026-04-28 04:33:58 +01:00
@@ -34,6 +34,7 @@ function showAlert(type, icon, title, message) {
|
||||
} else {
|
||||
$.notify(opts);
|
||||
}
|
||||
|
||||
break;
|
||||
case "warning":
|
||||
opts = {
|
||||
@@ -47,6 +48,7 @@ function showAlert(type, icon, title, message) {
|
||||
} else {
|
||||
$.notify(opts);
|
||||
}
|
||||
|
||||
break;
|
||||
case "error":
|
||||
opts = {
|
||||
@@ -60,9 +62,9 @@ function showAlert(type, icon, title, message) {
|
||||
} else {
|
||||
$.notify(opts);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,9 +113,7 @@ $(document).ready(function() {
|
||||
|
||||
var disabled = data.enabled === 0;
|
||||
$("td:eq(1)", row).html(
|
||||
'<input type="checkbox" id="status"' +
|
||||
(disabled ? "" : " checked") +
|
||||
">"
|
||||
'<input type="checkbox" id="status"' + (disabled ? "" : " checked") + ">"
|
||||
);
|
||||
var status = $("#status", row);
|
||||
status.bootstrapToggle({
|
||||
@@ -158,6 +158,7 @@ $(document).ready(function() {
|
||||
if (data === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
data = JSON.parse(data);
|
||||
// Always start on the first page to show most recent queries
|
||||
data.start = 0;
|
||||
@@ -202,31 +203,16 @@ function addGroup() {
|
||||
data: { action: "add_group", name: name, desc: desc, token: token },
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert(
|
||||
"success",
|
||||
"glyphicon glyphicon-plus",
|
||||
"Successfully added group",
|
||||
name
|
||||
);
|
||||
showAlert("success", "glyphicon glyphicon-plus", "Successfully added group", name);
|
||||
$("#new_name").val("");
|
||||
$("#new_desc").val("");
|
||||
table.ajax.reload();
|
||||
} else {
|
||||
showAlert(
|
||||
"error",
|
||||
"",
|
||||
"Error while adding new group",
|
||||
response.message
|
||||
);
|
||||
showAlert("error", "", "Error while adding new group", response.message);
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, exception) {
|
||||
showAlert(
|
||||
"error",
|
||||
"",
|
||||
"Error while adding new group",
|
||||
jqXHR.responseText
|
||||
);
|
||||
showAlert("error", "", "Error while adding new group", jqXHR.responseText);
|
||||
console.log(exception);
|
||||
}
|
||||
});
|
||||
@@ -271,12 +257,7 @@ function editGroup() {
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert(
|
||||
"success",
|
||||
"glyphicon glyphicon-pencil",
|
||||
"Successfully " + done + " group",
|
||||
name
|
||||
);
|
||||
showAlert("success", "glyphicon glyphicon-pencil", "Successfully " + done + " group", name);
|
||||
} else {
|
||||
showAlert(
|
||||
"error",
|
||||
@@ -311,32 +292,17 @@ function deleteGroup() {
|
||||
data: { action: "delete_group", id: id, token: token },
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
showAlert(
|
||||
"success",
|
||||
"glyphicon glyphicon-trash",
|
||||
"Successfully deleted group ",
|
||||
name
|
||||
);
|
||||
showAlert("success", "glyphicon glyphicon-trash", "Successfully deleted group ", name);
|
||||
table
|
||||
.row(tr)
|
||||
.remove()
|
||||
.draw(false);
|
||||
} else {
|
||||
showAlert(
|
||||
"error",
|
||||
"",
|
||||
"Error while deleting group with ID " + id,
|
||||
response.message
|
||||
);
|
||||
showAlert("error", "", "Error while deleting group with ID " + id, response.message);
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, exception) {
|
||||
showAlert(
|
||||
"error",
|
||||
"",
|
||||
"Error while deleting group with ID " + id,
|
||||
jqXHR.responseText
|
||||
);
|
||||
showAlert("error", "", "Error while deleting group with ID " + id, jqXHR.responseText);
|
||||
console.log(exception);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user