Fix DNSSEC popup on dashboard template.

This commit is contained in:
Ivan Filippov 2016-04-29 10:23:05 -06:00
parent a313eb2203
commit 64a297d5fb
2 changed files with 66 additions and 2 deletions

View File

@ -113,4 +113,41 @@ function SelectElement(elementID, valueToSelect)
{
var element = document.getElementById(elementID);
element.value = valueToSelect;
}
function getdnssec(url){
$.getJSON(url, function(data) {
var modal = $("#modal_dnssec_info");
if (data['status'] == 'error'){
modal.find('.modal-body p').text(data['msg']);
}
else {
dnssec_msg = '';
var dnssec = data['dnssec'];
for (var i = 0; i < dnssec.length; i++) {
if (dnssec[i]['active']){
dnssec_msg += '<form>'+
'<h3><strong>'+dnssec[i]['keytype']+'</strong></h3>'+
'<strong>DNSKEY</strong>'+
'<input class="form-control" autocomplete="off" type="text" readonly="true" value="'+dnssec[i]['dnskey']+'">'+
'</form>'+
'<br/>';
if(dnssec[i]['ds']){
var dsList = dnssec[i]['ds'];
dnssec_msg += '<strong>DS</strong>';
for (var j = 0; j < dsList.length; j++){
dnssec_msg += '<input class="form-control" autocomplete="off" type="text" readonly="true" value="'+dsList[j]+'">';
}
}
dnssec_msg += '</form>';
}
}
modal.find('.modal-body p').replaceWith(dnssec_msg);
}
modal.modal('show');
});
}

View File

@ -152,11 +152,11 @@
</td>
<td>
{% if domain.dnssec %}
<button type="button" class="btn btn-flat dnssec">
<button type="button" class="btn btn-flat dnssec button_dnssec" id="{{ domain.name }}">
<i class="fa fa-lock"></i>&nbsp;Enabled
</button>
{% else %}
<button type="button" class="btn btn-flat dnssec">
<button type="button" class="btn btn-flat dnssec button_dnssec" id="{{ domain.name }}">
<i class="fa fa-unlock-alt"></i>&nbsp;Disabled
</button>
{% endif %}
@ -219,6 +219,10 @@
modal.find('.modal-body p').text(info);
modal.modal('show');
});
$(document).on("click", ".button_dnssec", function() {
var domain = $(this).prop('id');
getdnssec('/domain/' + domain + '/dnssec');
});
</script>
{% endblock %}
{% block modals %}
@ -245,4 +249,27 @@
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<div class="modal fade" id="modal_dnssec_info">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">DNSSEC</h4>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-right"
data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
{% endblock %}