diff --git a/app/static/custom/js/custom.js b/app/static/custom/js/custom.js index cfb6e97..a7bef21 100644 --- a/app/static/custom/js/custom.js +++ b/app/static/custom/js/custom.js @@ -112,4 +112,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 += '
'+ + '

'+dnssec[i]['keytype']+'

'+ + 'DNSKEY'+ + ''+ + '
'+ + '
'; + if(dnssec[i]['ds']){ + var dsList = dnssec[i]['ds']; + dnssec_msg += 'DS'; + for (var j = 0; j < dsList.length; j++){ + dnssec_msg += ''; + } + } + dnssec_msg += ''; + } + } + modal.find('.modal-body p').replaceWith(dnssec_msg); + + } + modal.modal('show'); + }); } \ No newline at end of file diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html index 819130b..cbd8a13 100644 --- a/app/templates/dashboard.html +++ b/app/templates/dashboard.html @@ -31,8 +31,8 @@
-

{{ domains|length }}

-

{% if domains|length > 1 %}Domains{% else %}Domain{% endif %}

+

{{ domain_count }}

+

{% if domain_count > 1 %}Domains{% else %}Domain{% endif %}

@@ -152,11 +152,11 @@ {% if domain.dnssec %} - {% else %} - {% 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'); + }); {% endblock %} {% block modals %} @@ -245,4 +249,27 @@
+ + {% endblock %} diff --git a/app/templates/domain.html b/app/templates/domain.html index a348b4f..8618733 100644 --- a/app/templates/domain.html +++ b/app/templates/domain.html @@ -217,6 +217,7 @@ var table = $("#tbl_records").DataTable(); saveRow(table, nEditing); nEditing = null; + nNew = false; }); diff --git a/app/views.py b/app/views.py index 49d43be..873ae3f 100644 --- a/app/views.py +++ b/app/views.py @@ -136,7 +136,7 @@ def dashboard(): domains = User(id=current_user.id).get_domain() # stats for dashboard - domains = Domain.query.all() + domain_count = Domain.query.count() users = User.query.all() history_number = History.query.count() history = History.query.limit(4) @@ -146,7 +146,7 @@ def dashboard(): uptime = filter(lambda uptime: uptime['name'] == 'uptime', statistics)[0]['value'] else: uptime = 0 - return render_template('dashboard.html', domains=domains, users=users, history_number=history_number, uptime=uptime, histories=history) + return render_template('dashboard.html', domains=domains, domain_count=domain_count, users=users, history_number=history_number, uptime=uptime, histories=history) @app.route('/domain/', methods=['GET', 'POST'])