enable dnssec ui functions

This commit is contained in:
Jeroen Boonstra 2018-03-05 11:18:29 +01:00
parent a829509324
commit 747de090f9
2 changed files with 25 additions and 2 deletions

View File

@ -116,6 +116,21 @@ function SelectElement(elementID, valueToSelect)
element.value = valueToSelect; element.value = valueToSelect;
} }
function enable_dns_sec(url) {
$.getJSON(url, function(data) {
var modal = $("#modal_dnssec_info");
if (data['status'] == 'error'){
modal.find('.modal-body p').text(data['msg']);
}
else {
modal.modal('hide');
//location.reload();
window.location.reload(true);
}
})
}
function getdnssec(url){ function getdnssec(url){
$.getJSON(url, function(data) { $.getJSON(url, function(data) {
@ -127,10 +142,11 @@ function getdnssec(url){
else { else {
dnssec_msg = ''; dnssec_msg = '';
var dnssec = data['dnssec']; var dnssec = data['dnssec'];
if (dnssec.length == 0) {
if (dnssec.length == 0 && PDNS_VERSION > 4.1) {
dnssec_msg = '<h3>Enable DNSSEC?'; dnssec_msg = '<h3>Enable DNSSEC?';
modal.find('.modal-body p').html(dnssec_msg); modal.find('.modal-body p').html(dnssec_msg);
dnssec_footer = '<button type="button" class="btn btn-flat btn-success button_save pull-left">Enable</button><button type="button" class="btn btn-flat btn-default pull-right" data-dismiss="modal">Cancel</button>'; dnssec_footer = '<button type="button" class="btn btn-flat btn-success button_dnssec_enable pull-left" id="example.com">Enable</button><button type="button" class="btn btn-flat btn-default pull-right" data-dismiss="modal">Cancel</button>';
modal.find('.modal-footer ').html(dnssec_footer); modal.find('.modal-footer ').html(dnssec_footer);
} }
for (var i = 0; i < dnssec.length; i++) { for (var i = 0; i < dnssec.length; i++) {

View File

@ -158,6 +158,7 @@
<button type="button" class="btn btn-flat dnssec btn-success button_dnssec" id="{{ domain.name }}" style="width:100%;"> <button type="button" class="btn btn-flat dnssec btn-success button_dnssec" id="{{ domain.name }}" style="width:100%;">
<i class="fa fa-lock"></i>&nbsp;Enabled <i class="fa fa-lock"></i>&nbsp;Enabled
</button> </button>
{% else %} {% else %}
<button type="button" class="btn btn-flat dnssec button_dnssec" id="{{ domain.name }}" style="width:100%;"> <button type="button" class="btn btn-flat dnssec button_dnssec" id="{{ domain.name }}" style="width:100%;">
<i class="fa fa-unlock-alt"></i>&nbsp;Disabled <i class="fa fa-unlock-alt"></i>&nbsp;Disabled
@ -243,6 +244,12 @@
var domain = $(this).prop('id'); var domain = $(this).prop('id');
getdnssec($SCRIPT_ROOT + '/domain/' + domain + '/dnssec'); getdnssec($SCRIPT_ROOT + '/domain/' + domain + '/dnssec');
}); });
$(document.body).on("click", ".button_dnssec_enable", function() {
var domain = $(this).prop('id');
enable_dns_sec($SCRIPT_ROOT + '/domain/' + domain + '/dnssec/enable');
});
</script> </script>
{% endblock %} {% endblock %}
{% block modals %} {% block modals %}