Merge pull request #38 from ivanfilippov/new_ui

Results of first round of testing
This commit is contained in:
Ivan Filippov 2016-04-29 10:31:29 -06:00
commit 5842617b31
4 changed files with 71 additions and 6 deletions

View File

@ -113,3 +113,40 @@ 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

@ -31,8 +31,8 @@
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3>{{ domains|length }}</h3>
<p>{% if domains|length > 1 %}Domains{% else %}Domain{% endif %}</p>
<h3>{{ domain_count }}</h3>
<p>{% if domain_count > 1 %}Domains{% else %}Domain{% endif %}</p>
</div>
<div class="icon">
<i class="fa fa-book"></i>
@ -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 %}

View File

@ -217,6 +217,7 @@
var table = $("#tbl_records").DataTable();
saveRow(table, nEditing);
nEditing = null;
nNew = false;
});
</script>

View File

@ -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/<string:domain_name>', methods=['GET', 'POST'])