zone.js: implemented new zone transfer and notify options. Fixed minor status update issue. Implemented sync failed and notify failed status. Updated DNSKEY default value to 3600.

This commit is contained in:
Shreyas Zare
2022-05-14 13:52:16 +05:30
parent a29969ff85
commit 3b625a6899

View File

@@ -81,21 +81,29 @@ $(function () {
$("input[type=radio][name=rdZoneTransfer]").change(function () { $("input[type=radio][name=rdZoneTransfer]").change(function () {
var zoneTransfer = $('input[name=rdZoneTransfer]:checked').val(); var zoneTransfer = $('input[name=rdZoneTransfer]:checked').val();
if (zoneTransfer === "AllowOnlySpecifiedNameServers") { switch (zoneTransfer) {
$("#txtZoneTransferNameServers").prop("disabled", false); case "AllowOnlySpecifiedNameServers":
} case "AllowBothZoneAndSpecifiedNameServers":
else { $("#txtZoneTransferNameServers").prop("disabled", false);
$("#txtZoneTransferNameServers").prop("disabled", true); break;
default:
$("#txtZoneTransferNameServers").prop("disabled", true);
break;
} }
}); });
$("input[type=radio][name=rdZoneNotify]").change(function () { $("input[type=radio][name=rdZoneNotify]").change(function () {
var zoneTransfer = $('input[name=rdZoneNotify]:checked').val(); var zoneNotify = $('input[name=rdZoneNotify]:checked').val();
if (zoneTransfer === "SpecifiedNameServers") { switch (zoneNotify) {
$("#txtZoneNotifyNameServers").prop("disabled", false); case "SpecifiedNameServers":
} case "BothZoneAndSpecifiedNameServers":
else { $("#txtZoneNotifyNameServers").prop("disabled", false);
$("#txtZoneNotifyNameServers").prop("disabled", true); break;
default:
$("#txtZoneNotifyNameServers").prop("disabled", true);
break;
} }
}); });
@@ -294,11 +302,15 @@ function refreshZones(checkDisplay) {
var status = ""; var status = "";
if (zones[i].disabled) if (zones[i].disabled)
status = "<span id=\"tdStatus" + id + "\" class=\"label label-warning\">Disabled</span>"; status = "<span id=\"tdZoneStatus" + id + "\" class=\"label label-warning\">Disabled</span>";
else if (zones[i].isExpired) else if (zones[i].isExpired)
status = "<span id=\"tdStatus" + id + "\" class=\"label label-danger\">Expired</span>"; status = "<span id=\"tdZoneStatus" + id + "\" class=\"label label-danger\">Expired</span>";
else if (zones[i].syncFailed)
status = "<span id=\"tdZoneStatus" + id + "\" class=\"label label-warning\">Sync Failed</span>";
else if (zones[i].notifyFailed)
status = "<span id=\"tdZoneStatus" + id + "\" class=\"label label-warning\">Notify Failed</span>";
else else
status = "<span id=\"tdStatus" + id + "\" class=\"label label-success\">Enabled</span>"; status = "<span id=\"tdZoneStatus" + id + "\" class=\"label label-success\">Enabled</span>";
var expiry = zones[i].expiry; var expiry = zones[i].expiry;
if (expiry == null) if (expiry == null)
@@ -354,9 +366,8 @@ function refreshZones(checkDisplay) {
}); });
} }
function enableZone(objBtn, zone) { function enableZone(objBtn, zone, editZone) {
var btn = $(objBtn); var btn = $(objBtn);
var id = btn.attr("data-id");
btn.button('loading'); btn.button('loading');
@@ -365,10 +376,20 @@ function enableZone(objBtn, zone) {
success: function (responseJSON) { success: function (responseJSON) {
btn.button('reset'); btn.button('reset');
$("#btnEnableZone" + id).hide(); if (editZone) {
$("#btnDisableZone" + id).show(); $("#btnEnableZoneEditZone").hide();
$("#tdStatus" + id).attr("class", "label label-success"); $("#btnDisableZoneEditZone").show();
$("#tdStatus" + id).html("Enabled"); $("#titleStatusEditZone").attr("class", "label label-success");
$("#titleStatusEditZone").html("Enabled");
}
else {
var id = btn.attr("data-id");
$("#btnEnableZone" + id).hide();
$("#btnDisableZone" + id).show();
$("#tdZoneStatus" + id).attr("class", "label label-success");
$("#tdZoneStatus" + id).html("Enabled");
}
showAlert("success", "Zone Enabled!", "Zone '" + zone + "' was enabled successfully."); showAlert("success", "Zone Enabled!", "Zone '" + zone + "' was enabled successfully.");
}, },
@@ -381,12 +402,11 @@ function enableZone(objBtn, zone) {
}); });
} }
function disableZone(objBtn, zone) { function disableZone(objBtn, zone, editZone) {
if (!confirm("Are you sure you want to disable the zone '" + zone + "'?")) if (!confirm("Are you sure you want to disable the zone '" + zone + "'?"))
return; return;
var btn = $(objBtn); var btn = $(objBtn);
var id = btn.attr("data-id");
btn.button('loading'); btn.button('loading');
@@ -395,10 +415,20 @@ function disableZone(objBtn, zone) {
success: function (responseJSON) { success: function (responseJSON) {
btn.button('reset'); btn.button('reset');
$("#btnEnableZone" + id).show(); if (editZone) {
$("#btnDisableZone" + id).hide(); $("#btnEnableZoneEditZone").show();
$("#tdStatus" + id).attr("class", "label label-warning"); $("#btnDisableZoneEditZone").hide();
$("#tdStatus" + id).html("Disabled"); $("#titleStatusEditZone").attr("class", "label label-warning");
$("#titleStatusEditZone").html("Disabled");
}
else {
var id = btn.attr("data-id");
$("#btnEnableZone" + id).show();
$("#btnDisableZone" + id).hide();
$("#tdZoneStatus" + id).attr("class", "label label-warning");
$("#tdZoneStatus" + id).html("Disabled");
}
showAlert("success", "Zone Disabled!", "Zone '" + zone + "' was disabled successfully."); showAlert("success", "Zone Disabled!", "Zone '" + zone + "' was disabled successfully.");
}, },
@@ -483,6 +513,11 @@ function showZoneOptionsModal(zone) {
$("#txtZoneTransferNameServers").prop("disabled", false); $("#txtZoneTransferNameServers").prop("disabled", false);
break; break;
case "AllowBothZoneAndSpecifiedNameServers":
$("#rdZoneTransferAllowBothZoneAndSpecifiedNameServers").prop("checked", true);
$("#txtZoneTransferNameServers").prop("disabled", false);
break;
case "Deny": case "Deny":
default: default:
$("#rdZoneTransferDeny").prop("checked", true); $("#rdZoneTransferDeny").prop("checked", true);
@@ -508,6 +543,11 @@ function showZoneOptionsModal(zone) {
$("#txtZoneNotifyNameServers").prop("disabled", false); $("#txtZoneNotifyNameServers").prop("disabled", false);
break; break;
case "BothZoneAndSpecifiedNameServers":
$("#rdZoneNotifyBothZoneAndSpecifiedNameServers").prop("checked", true);
$("#txtZoneNotifyNameServers").prop("disabled", false);
break;
case "None": case "None":
default: default:
$("#rdZoneNotifyNone").prop("checked", true); $("#rdZoneNotifyNone").prop("checked", true);
@@ -846,6 +886,10 @@ function showEditZone(zone) {
status = "Disabled"; status = "Disabled";
else if (responseJSON.response.zone.isExpired) else if (responseJSON.response.zone.isExpired)
status = "Expired"; status = "Expired";
else if (responseJSON.response.zone.syncFailed)
status = "Sync Failed";
else if (responseJSON.response.zone.notifyFailed)
status = "Notify Failed";
else else
status = "Enabled"; status = "Enabled";
@@ -866,6 +910,8 @@ function showEditZone(zone) {
switch (status) { switch (status) {
case "Disabled": case "Disabled":
case "Sync Failed":
case "Notify Failed":
$("#titleStatusEditZone").attr("class", "label label-warning"); $("#titleStatusEditZone").attr("class", "label label-warning");
break; break;
@@ -3076,7 +3122,7 @@ function showSignZoneModal(zoneName) {
$("#txtDnssecSignZoneNSEC3Iterations").val("0"); $("#txtDnssecSignZoneNSEC3Iterations").val("0");
$("#txtDnssecSignZoneNSEC3SaltLength").val("0"); $("#txtDnssecSignZoneNSEC3SaltLength").val("0");
$("#txtDnssecSignZoneDnsKeyTtl").val("86400"); $("#txtDnssecSignZoneDnsKeyTtl").val("3600");
$("#txtDnssecSignZoneZskAutoRollover").val("90"); $("#txtDnssecSignZoneZskAutoRollover").val("90");
$("#modalDnssecSignZone").modal("show"); $("#modalDnssecSignZone").modal("show");