mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Show different warning in the case that at least one of the domains to be added were already present
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -59,6 +59,10 @@ function getFullName() {
|
||||
<button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
Failure! Something went wrong, see output below:<br/><br/><pre><span id="err"></span></pre>
|
||||
</div>
|
||||
<div id="alWarning" class="alert alert-warning alert-dismissible fade in" role="alert" hidden="true">
|
||||
<button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
At least one domain was already present, see output below:<br/><br/><pre><span id="warn"></span></pre>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Domain List -->
|
||||
|
||||
@@ -140,23 +140,35 @@ function add(arg) {
|
||||
var alInfo = $("#alInfo");
|
||||
var alSuccess = $("#alSuccess");
|
||||
var alFailure = $("#alFailure");
|
||||
var alWarning = $("#alWarning");
|
||||
var err = $("#err");
|
||||
var warn = $("#warn");
|
||||
alInfo.show();
|
||||
alSuccess.hide();
|
||||
alFailure.hide();
|
||||
alWarning.hide();
|
||||
$.ajax({
|
||||
url: "scripts/pi-hole/php/add.php",
|
||||
method: "post",
|
||||
data: {"domain":domain.val().trim(), "list":locallistType, "token":token},
|
||||
success: function(response) {
|
||||
if (!wild && response.indexOf("] Pi-hole blocking is ") === -1 ||
|
||||
if (!wild && response.indexOf(" already exists in ") !== -1) {
|
||||
alWarning.show();
|
||||
warn.html(response);
|
||||
alWarning.delay(8000).fadeOut(2000, function() {
|
||||
alWarning.hide();
|
||||
});
|
||||
alInfo.delay(8000).fadeOut(2000, function() {
|
||||
alInfo.hide();
|
||||
});
|
||||
} else if (!wild && response.indexOf("] Pi-hole blocking is ") === -1 ||
|
||||
wild && response.length > 1) {
|
||||
alFailure.show();
|
||||
err.html(response);
|
||||
alFailure.delay(4000).fadeOut(2000, function() {
|
||||
alFailure.delay(8000).fadeOut(2000, function() {
|
||||
alFailure.hide();
|
||||
});
|
||||
alInfo.delay(4000).fadeOut(2000, function() {
|
||||
alInfo.delay(8000).fadeOut(2000, function() {
|
||||
alInfo.hide();
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user