diff --git a/DnsServerCore/www/js/dhcp.js b/DnsServerCore/www/js/dhcp.js
index bc91a2a8..4d33c5c7 100644
--- a/DnsServerCore/www/js/dhcp.js
+++ b/DnsServerCore/www/js/dhcp.js
@@ -174,13 +174,13 @@ function refreshDhcpScopes(checkDisplay) {
if (checkDisplay == null)
checkDisplay = false;
- var divDhcpViewScopes = $("#divDhcpViewScopes");
+ var divDhcpEditScope = $("#divDhcpEditScope");
- if (checkDisplay && (divDhcpViewScopes.css('display') === "none"))
+ if (checkDisplay && (divDhcpEditScope.css("display") != "none"))
return;
+ var divDhcpViewScopes = $("#divDhcpViewScopes");
var divDhcpViewScopesLoader = $("#divDhcpViewScopesLoader");
- var divDhcpEditScope = $("#divDhcpEditScope");
divDhcpViewScopes.hide();
divDhcpEditScope.hide();
@@ -193,7 +193,7 @@ function refreshDhcpScopes(checkDisplay) {
var tableHtmlRows = "";
for (var i = 0; i < dhcpScopes.length; i++) {
- tableHtmlRows += "
| " + htmlEncode(dhcpScopes[i].name) + " | " + dhcpScopes[i].startingAddress + " - " + dhcpScopes[i].endingAddress + " " + dhcpScopes[i].subnetMask + " | " + dhcpScopes[i].networkAddress + " " + dhcpScopes[i].broadcastAddress + " | " + (dhcpScopes[i].interfaceAddress == null ? "" : dhcpScopes[i].interfaceAddress) + " | ";
+ tableHtmlRows += "
| " + htmlEncode(dhcpScopes[i].name) + " | " + dhcpScopes[i].startingAddress + " - " + dhcpScopes[i].endingAddress + " " + dhcpScopes[i].subnetMask + " | " + dhcpScopes[i].networkAddress + " " + dhcpScopes[i].broadcastAddress + " | " + (dhcpScopes[i].interfaceAddress == null ? "" : dhcpScopes[i].interfaceAddress) + " | ";
tableHtmlRows += "";
if (dhcpScopes[i].enabled)
@@ -201,7 +201,7 @@ function refreshDhcpScopes(checkDisplay) {
else
tableHtmlRows += "";
- tableHtmlRows += " |
";
+ tableHtmlRows += "";
}
$("#tableDhcpScopesBody").html(tableHtmlRows);
@@ -534,7 +534,7 @@ function enableDhcpScope(scopeName) {
});
}
-function deleteDhcpScope(scopeName) {
+function deleteDhcpScope(index, scopeName) {
if (!confirm("Are you sure you want to delete the DHCP scope '" + scopeName + "'?"))
return;
@@ -549,7 +549,17 @@ function deleteDhcpScope(scopeName) {
HTTPRequest({
url: "/api/deleteDhcpScope?token=" + token + "&name=" + scopeName,
success: function (responseJSON) {
- refreshDhcpScopes();
+ $("#trDhcpScopeRow" + index).remove();
+
+ var dhcpLeasesLength = $('#tableDhcpScopesBody >tr').length;
+ if (dhcpLeasesLength > 0)
+ $("#tableDhcpScopesFooter").html("| Total Scopes: " + dhcpLeasesLength + " |
");
+ else
+ $("#tableDhcpScopesFooter").html("| No Scope Found |
");
+
+ divDhcpViewScopes.show();
+ divDhcpViewScopesLoader.hide();
+
showAlert("success", "Scope Deleted!", "DHCP Scope was deleted successfully.");
},
error: function () {