mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-04-12 15:08:22 +00:00
Export PDNS version to frontend
This commit is contained in:
parent
83475ae17c
commit
d5d0948ab8
2
.gitignore
vendored
2
.gitignore
vendored
@ -31,3 +31,5 @@ db_repository/*
|
|||||||
upload/avatar/*
|
upload/avatar/*
|
||||||
tmp/*
|
tmp/*
|
||||||
.ropeproject
|
.ropeproject
|
||||||
|
.sonarlint/*
|
||||||
|
pdns.db
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
<small>{{ current_user.role.name }}</small>
|
<small>{{ current_user.role.name }}</small>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- Menu Footer-->
|
<!-- Menu Footer-->
|
||||||
<li class="user-footer">
|
<li class="user-footer">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
|
@ -206,6 +206,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block extrascripts %}
|
{% block extrascripts %}
|
||||||
<script>
|
<script>
|
||||||
|
PDNS_VERSION = '{{ pdns_version }}'
|
||||||
// set up history data table
|
// set up history data table
|
||||||
$("#tbl_history").DataTable({
|
$("#tbl_history").DataTable({
|
||||||
"paging" : false,
|
"paging" : false,
|
||||||
@ -214,7 +215,7 @@
|
|||||||
"ordering" : false,
|
"ordering" : false,
|
||||||
"info" : false,
|
"info" : false,
|
||||||
"autoWidth" : false
|
"autoWidth" : false
|
||||||
});
|
});
|
||||||
// set up domain list
|
// set up domain list
|
||||||
$("#tbl_domain_list").DataTable({
|
$("#tbl_domain_list").DataTable({
|
||||||
"paging" : true,
|
"paging" : true,
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td width="6%">
|
<td width="6%">
|
||||||
<button type="button" class="btn btn-flat btn-warning""> <i class="fa fa-exclamation-circle"></i> </button>
|
<button type="button" class="btn btn-flat btn-warning""> <i class="fa fa-exclamation-circle"></i> </button>
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<!-- hidden column that we can sort on -->
|
<!-- hidden column that we can sort on -->
|
||||||
@ -109,6 +109,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block extrascripts %}
|
{% block extrascripts %}
|
||||||
<script>
|
<script>
|
||||||
|
PDNS_VERSION = '{{ pdns_version }}'
|
||||||
// superglobals
|
// superglobals
|
||||||
window.records_allow_edit = {{ editable_records|tojson }};
|
window.records_allow_edit = {{ editable_records|tojson }};
|
||||||
window.nEditing = null;
|
window.nEditing = null;
|
||||||
@ -148,7 +149,7 @@
|
|||||||
],
|
],
|
||||||
"orderFixed": [[7, 'asc']]
|
"orderFixed": [[7, 'asc']]
|
||||||
});
|
});
|
||||||
|
|
||||||
// handle delete button
|
// handle delete button
|
||||||
$(document.body).on("click", ".button_delete", function(e) {
|
$(document.body).on("click", ".button_delete", function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -156,25 +157,25 @@
|
|||||||
var table = $("#tbl_records").DataTable();
|
var table = $("#tbl_records").DataTable();
|
||||||
var record = $(this).prop('id');
|
var record = $(this).prop('id');
|
||||||
var nRow = $(this).parents('tr')[0];
|
var nRow = $(this).parents('tr')[0];
|
||||||
var info = "Are you sure you want to delete " + record + "?";
|
var info = "Are you sure you want to delete " + record + "?";
|
||||||
modal.find('.modal-body p').text(info);
|
modal.find('.modal-body p').text(info);
|
||||||
modal.find('#button_delete_confirm').click(function() {
|
modal.find('#button_delete_confirm').click(function() {
|
||||||
table.row(nRow).remove().draw();
|
table.row(nRow).remove().draw();
|
||||||
modal.modal('hide');
|
modal.modal('hide');
|
||||||
})
|
})
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
|
|
||||||
});
|
});
|
||||||
// handle edit button
|
// handle edit button
|
||||||
$(document.body).on("click", ".button_edit, .row_record", function(e) {
|
$(document.body).on("click", ".button_edit, .row_record", function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if ($(this).is('tr')) {
|
if ($(this).is('tr')) {
|
||||||
var nRow = $(this)[0];
|
var nRow = $(this)[0];
|
||||||
} else {
|
} else {
|
||||||
var nRow = $(this).parents('tr')[0];
|
var nRow = $(this).parents('tr')[0];
|
||||||
}
|
}
|
||||||
var table = $("#tbl_records").DataTable();
|
var table = $("#tbl_records").DataTable();
|
||||||
|
|
||||||
if (nEditing == nRow) {
|
if (nEditing == nRow) {
|
||||||
/* click on row already being edited, do nothing */
|
/* click on row already being edited, do nothing */
|
||||||
} else if (nEditing !== null && nEditing != nRow && nNew == false) {
|
} else if (nEditing !== null && nEditing != nRow && nNew == false) {
|
||||||
@ -194,13 +195,13 @@
|
|||||||
nEditing = nRow;
|
nEditing = nRow;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// handle apply changes button
|
// handle apply changes button
|
||||||
$(document.body).on("click",".button_apply_changes", function() {
|
$(document.body).on("click",".button_apply_changes", function() {
|
||||||
var modal = $("#modal_apply_changes");
|
var modal = $("#modal_apply_changes");
|
||||||
var table = $("#tbl_records").DataTable();
|
var table = $("#tbl_records").DataTable();
|
||||||
var domain = $(this).prop('id');
|
var domain = $(this).prop('id');
|
||||||
var info = "Are you sure you want to apply your changes?";
|
var info = "Are you sure you want to apply your changes?";
|
||||||
modal.find('.modal-body p').text(info);
|
modal.find('.modal-body p').text(info);
|
||||||
modal.find('#button_apply_confirm').click(function() {
|
modal.find('#button_apply_confirm').click(function() {
|
||||||
var data = getTableData(table);
|
var data = getTableData(table);
|
||||||
@ -208,9 +209,9 @@
|
|||||||
modal.modal('hide');
|
modal.modal('hide');
|
||||||
})
|
})
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// handle add record button
|
// handle add record button
|
||||||
$(document.body).on("click", ".button_add_record", function (e) {
|
$(document.body).on("click", ".button_add_record", function (e) {
|
||||||
if (nNew || nEditing) {
|
if (nNew || nEditing) {
|
||||||
@ -221,7 +222,7 @@
|
|||||||
}
|
}
|
||||||
// clear search first
|
// clear search first
|
||||||
$("#tbl_records").DataTable().search('').columns().search('').draw();
|
$("#tbl_records").DataTable().search('').columns().search('').draw();
|
||||||
|
|
||||||
// add new row
|
// add new row
|
||||||
var default_type = records_allow_edit[0]
|
var default_type = records_allow_edit[0]
|
||||||
var nRow = jQuery('#tbl_records').dataTable().fnAddData(['', default_type, 'Active', 3600, '', '', '', '0']);
|
var nRow = jQuery('#tbl_records').dataTable().fnAddData(['', default_type, 'Active', 3600, '', '', '', '0']);
|
||||||
@ -230,7 +231,7 @@
|
|||||||
nEditing = nRow;
|
nEditing = nRow;
|
||||||
nNew = true;
|
nNew = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
//handle cancel button
|
//handle cancel button
|
||||||
$(document.body).on("click", ".button_cancel", function (e) {
|
$(document.body).on("click", ".button_cancel", function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -244,7 +245,7 @@
|
|||||||
nEditing = null;
|
nEditing = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//handle save button
|
//handle save button
|
||||||
$(document.body).on("click", ".button_save", function (e) {
|
$(document.body).on("click", ".button_save", function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -253,13 +254,13 @@
|
|||||||
nEditing = null;
|
nEditing = null;
|
||||||
nNew = false;
|
nNew = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
//handle update_from_master button
|
//handle update_from_master button
|
||||||
$(document.body).on("click", ".button_update_from_master", function (e) {
|
$(document.body).on("click", ".button_update_from_master", function (e) {
|
||||||
var domain = $(this).prop('id');
|
var domain = $(this).prop('id');
|
||||||
applyChanges({'domain': domain}, $SCRIPT_ROOT + '/domain/' + domain + '/update');
|
applyChanges({'domain': domain}, $SCRIPT_ROOT + '/domain/' + domain + '/update');
|
||||||
});
|
});
|
||||||
|
|
||||||
{% if record_helper_setting %}
|
{% if record_helper_setting %}
|
||||||
//handle wacky record types
|
//handle wacky record types
|
||||||
$(document.body).on("focus", "#current_edit_record_data", function (e) {
|
$(document.body).on("focus", "#current_edit_record_data", function (e) {
|
||||||
@ -276,7 +277,7 @@
|
|||||||
<input type=\"text\" class=\"form-control\" name=\"caa_value\" id=\"caa_value\" placeholder=\"eg. letsencrypt.org\"> \
|
<input type=\"text\" class=\"form-control\" name=\"caa_value\" id=\"caa_value\" placeholder=\"eg. letsencrypt.org\"> \
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
var parts = record_data.val().split(" ");
|
var parts = record_data.val().split(" ");
|
||||||
var form = " <label for=\"caa_flag\">CAA Flag</label> \
|
var form = " <label for=\"caa_flag\">CAA Flag</label> \
|
||||||
<input type=\"text\" class=\"form-control\" name=\"caa_flag\" id=\"caa_flag\" placeholder=\"0\" value=\"" + parts[0] + "\"> \
|
<input type=\"text\" class=\"form-control\" name=\"caa_flag\" id=\"caa_flag\" placeholder=\"0\" value=\"" + parts[0] + "\"> \
|
||||||
<label for=\"caa_tag\">CAA Tag</label> \
|
<label for=\"caa_tag\">CAA Tag</label> \
|
||||||
@ -333,7 +334,7 @@
|
|||||||
<input type=\"text\" class=\"form-control\" name=\"srv_target\" id=\"srv_target\" placeholder=\"sip.example.com\"> \
|
<input type=\"text\" class=\"form-control\" name=\"srv_target\" id=\"srv_target\" placeholder=\"sip.example.com\"> \
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
var parts = record_data.val().split(" ");
|
var parts = record_data.val().split(" ");
|
||||||
var form = " <label for=\"srv_priority\">SRV Priority</label> \
|
var form = " <label for=\"srv_priority\">SRV Priority</label> \
|
||||||
<input type=\"text\" class=\"form-control\" name=\"srv_priority\" id=\"srv_priority\" placeholder=\"0\" value=\"" + parts[0] + "\"> \
|
<input type=\"text\" class=\"form-control\" name=\"srv_priority\" id=\"srv_priority\" placeholder=\"0\" value=\"" + parts[0] + "\"> \
|
||||||
<label for=\"srv_weight\">SRV Weight</label> \
|
<label for=\"srv_weight\">SRV Weight</label> \
|
||||||
@ -374,7 +375,7 @@
|
|||||||
<input type=\"text\" class=\"form-control\" name=\"soa_minimumttl\" id=\"soa_minimumttl\" placeholder=\"300\"> \
|
<input type=\"text\" class=\"form-control\" name=\"soa_minimumttl\" id=\"soa_minimumttl\" placeholder=\"300\"> \
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
var parts = record_data.val().split(" ");
|
var parts = record_data.val().split(" ");
|
||||||
var form = " <label for=\"soa_primaryns\">Primary Name Server</label> \
|
var form = " <label for=\"soa_primaryns\">Primary Name Server</label> \
|
||||||
<input type=\"text\" class=\"form-control\" name=\"soa_primaryns\" id=\"soa_primaryns\" value=\"" + parts[0] + "\"> \
|
<input type=\"text\" class=\"form-control\" name=\"soa_primaryns\" id=\"soa_primaryns\" value=\"" + parts[0] + "\"> \
|
||||||
<label for=\"soa_adminemail\">Primary Contact</label> \
|
<label for=\"soa_adminemail\">Primary Contact</label> \
|
||||||
@ -392,7 +393,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
modal.find('.modal-body p').html(form);
|
modal.find('.modal-body p').html(form);
|
||||||
modal.find('#button_save').click(function() {
|
modal.find('#button_save').click(function() {
|
||||||
soa_primaryns = modal.find('#soa_primaryns').val();
|
soa_primaryns = modal.find('#soa_primaryns').val();
|
||||||
soa_adminemail = modal.find('#soa_adminemail').val();
|
soa_adminemail = modal.find('#soa_adminemail').val();
|
||||||
soa_serial = modal.find('#soa_serial').val();
|
soa_serial = modal.find('#soa_serial').val();
|
||||||
@ -400,7 +401,7 @@
|
|||||||
soa_failedzonerefresh = modal.find('#soa_failedzonerefresh').val();
|
soa_failedzonerefresh = modal.find('#soa_failedzonerefresh').val();
|
||||||
soa_zoneexpiry = modal.find('#soa_zoneexpiry').val();
|
soa_zoneexpiry = modal.find('#soa_zoneexpiry').val();
|
||||||
soa_minimumttl = modal.find('#soa_minimumttl').val();
|
soa_minimumttl = modal.find('#soa_minimumttl').val();
|
||||||
|
|
||||||
data = soa_primaryns + " " + soa_adminemail + " " + soa_serial + " " + soa_zonerefresh + " " + soa_failedzonerefresh + " " + soa_zoneexpiry + " " + soa_minimumttl;
|
data = soa_primaryns + " " + soa_adminemail + " " + soa_serial + " " + soa_zonerefresh + " " + soa_failedzonerefresh + " " + soa_zoneexpiry + " " + soa_minimumttl;
|
||||||
record_data.val(data);
|
record_data.val(data);
|
||||||
modal.modal('hide');
|
modal.modal('hide');
|
||||||
|
@ -439,7 +439,7 @@ def dashboard():
|
|||||||
uptime = filter(lambda uptime: uptime['name'] == 'uptime', statistics)[0]['value']
|
uptime = filter(lambda uptime: uptime['name'] == 'uptime', statistics)[0]['value']
|
||||||
else:
|
else:
|
||||||
uptime = 0
|
uptime = 0
|
||||||
return render_template('dashboard.html', domains=domains, domain_count=domain_count, 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,pdns_version=app.config['PDNS_VERSION'])
|
||||||
|
|
||||||
|
|
||||||
@app.route('/domain/<path:domain_name>', methods=['GET', 'POST'])
|
@app.route('/domain/<path:domain_name>', methods=['GET', 'POST'])
|
||||||
@ -479,7 +479,7 @@ def domain(domain_name):
|
|||||||
editable_records = app.config['FORWARD_RECORDS_ALLOW_EDIT']
|
editable_records = app.config['FORWARD_RECORDS_ALLOW_EDIT']
|
||||||
else:
|
else:
|
||||||
editable_records = app.config['REVERSE_RECORDS_ALLOW_EDIT']
|
editable_records = app.config['REVERSE_RECORDS_ALLOW_EDIT']
|
||||||
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records)
|
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records,pdns_version=app.config['PDNS_VERSION'])
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin/domain/add', methods=['GET', 'POST'])
|
@app.route('/admin/domain/add', methods=['GET', 'POST'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user