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;
}
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){
$.getJSON(url, function(data) {
@ -127,10 +142,11 @@ function getdnssec(url){
else {
dnssec_msg = '';
var dnssec = data['dnssec'];
if (dnssec.length == 0) {
if (dnssec.length == 0 && PDNS_VERSION > 4.1) {
dnssec_msg = '<h3>Enable DNSSEC?';
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);
}
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%;">
<i class="fa fa-lock"></i>&nbsp;Enabled
</button>
{% else %}
<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
@ -243,6 +244,12 @@
var domain = $(this).prop('id');
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>
{% endblock %}
{% block modals %}