mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-04 19:15:30 +00:00
Fix js code as suggestion from LGTM
This commit is contained in:
parent
e6f82160c1
commit
43830e5e63
@ -1,7 +1,6 @@
|
|||||||
var dnssecKeyList = []
|
var dnssecKeyList = []
|
||||||
|
|
||||||
function applyChanges(data, url, showResult, refreshPage) {
|
function applyChanges(data, url, showResult, refreshPage) {
|
||||||
var success = false;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : "POST",
|
type : "POST",
|
||||||
url : url,
|
url : url,
|
||||||
@ -36,7 +35,6 @@ function applyChanges(data, url, showResult, refreshPage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyRecordChanges(data, domain) {
|
function applyRecordChanges(data, domain) {
|
||||||
var success = false;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : "POST",
|
type : "POST",
|
||||||
url : $SCRIPT_ROOT + '/domain/' + domain + '/apply',
|
url : $SCRIPT_ROOT + '/domain/' + domain + '/apply',
|
||||||
@ -67,8 +65,6 @@ function applyRecordChanges(data, domain) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTableData(table) {
|
function getTableData(table) {
|
||||||
var rData = []
|
|
||||||
|
|
||||||
// reformat - pretty format
|
// reformat - pretty format
|
||||||
var records = []
|
var records = []
|
||||||
table.rows().every(function() {
|
table.rows().every(function() {
|
||||||
@ -86,16 +82,14 @@ function getTableData(table) {
|
|||||||
|
|
||||||
function saveRow(oTable, nRow) {
|
function saveRow(oTable, nRow) {
|
||||||
|
|
||||||
|
var status = 'Disabled';
|
||||||
var jqInputs = $(oTable.row(nRow).node()).find("input");
|
var jqInputs = $(oTable.row(nRow).node()).find("input");
|
||||||
var jqSelect = $(oTable.row(nRow).node()).find("select");
|
var jqSelect = $(oTable.row(nRow).node()).find("select");
|
||||||
|
|
||||||
if (jqSelect[1].value == 'false') {
|
if (jqSelect[1].value == 'false') {
|
||||||
status = 'Active';
|
status = 'Active';
|
||||||
} else {
|
|
||||||
status = 'Disabled';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
oTable.cell(nRow,0).data(jqInputs[0].value);
|
oTable.cell(nRow,0).data(jqInputs[0].value);
|
||||||
oTable.cell(nRow,1).data(jqSelect[0].value);
|
oTable.cell(nRow,1).data(jqSelect[0].value);
|
||||||
oTable.cell(nRow,2).data(status);
|
oTable.cell(nRow,2).data(status);
|
||||||
@ -114,12 +108,12 @@ function saveRow(oTable, nRow) {
|
|||||||
|
|
||||||
function restoreRow(oTable, nRow) {
|
function restoreRow(oTable, nRow) {
|
||||||
var aData = oTable.row(nRow).data();
|
var aData = oTable.row(nRow).data();
|
||||||
var jqTds = $('>td', nRow);
|
|
||||||
oTable.row(nRow).data(aData);
|
oTable.row(nRow).data(aData);
|
||||||
oTable.draw();
|
oTable.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
function editRow(oTable, nRow) {
|
function editRow(oTable, nRow) {
|
||||||
|
var isDisabled = 'true';
|
||||||
var aData = oTable.row(nRow).data();
|
var aData = oTable.row(nRow).data();
|
||||||
var jqTds = oTable.cells(nRow,'').nodes();
|
var jqTds = oTable.cells(nRow,'').nodes();
|
||||||
var record_types = "";
|
var record_types = "";
|
||||||
@ -139,9 +133,6 @@ function editRow(oTable, nRow) {
|
|||||||
if (aData[2] == 'Active'){
|
if (aData[2] == 'Active'){
|
||||||
isDisabled = 'false';
|
isDisabled = 'false';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
isDisabled = 'true';
|
|
||||||
}
|
|
||||||
|
|
||||||
SelectElement('record_type', aData[1]);
|
SelectElement('record_type', aData[1]);
|
||||||
SelectElement('record_status', isDisabled);
|
SelectElement('record_status', isDisabled);
|
||||||
@ -172,13 +163,14 @@ function enable_dns_sec(url) {
|
|||||||
function getdnssec(url, domain){
|
function getdnssec(url, domain){
|
||||||
|
|
||||||
$.getJSON(url, function(data) {
|
$.getJSON(url, function(data) {
|
||||||
|
var dnssec_footer = '';
|
||||||
var modal = $("#modal_dnssec_info");
|
var modal = $("#modal_dnssec_info");
|
||||||
|
|
||||||
if (data['status'] == 'error'){
|
if (data['status'] == 'error'){
|
||||||
modal.find('.modal-body p').text(data['msg']);
|
modal.find('.modal-body p').text(data['msg']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dnssec_msg = '';
|
var dnssec_msg = '';
|
||||||
var dnssec = data['dnssec'];
|
var dnssec = data['dnssec'];
|
||||||
|
|
||||||
if (dnssec.length == 0 && parseFloat(PDNS_VERSION) >= 4.1) {
|
if (dnssec.length == 0 && parseFloat(PDNS_VERSION) >= 4.1) {
|
||||||
|
@ -20,22 +20,22 @@
|
|||||||
<section class="content">
|
<section class="content">
|
||||||
{% with errors = get_flashed_messages(category_filter=["error"]) %} {% if errors %}
|
{% with errors = get_flashed_messages(category_filter=["error"]) %} {% if errors %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<button type="button" class="close" data-dismiss="alert"
|
<button type="button" class="close" data-dismiss="alert"
|
||||||
aria-hidden="true">×</button>
|
aria-hidden="true">×</button>
|
||||||
<h4>
|
<h4>
|
||||||
<i class="icon fa fa-ban"></i> Error!
|
<i class="icon fa fa-ban"></i> Error!
|
||||||
</h4>
|
</h4>
|
||||||
<div class="alert-message block-message error">
|
<div class="alert-message block-message error">
|
||||||
<a class="close" href="#">x</a>
|
<a class="close" href="#">x</a>
|
||||||
<ul>
|
<ul>
|
||||||
{%- for msg in errors %}
|
{%- for msg in errors %}
|
||||||
<li>{{ msg }}</li> {% endfor -%}
|
<li>{{ msg }}</li> {% endfor -%}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %} {% endwith %}
|
{% endif %} {% endwith %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -45,11 +45,11 @@
|
|||||||
<h3 class="box-title">Templates</h3>
|
<h3 class="box-title">Templates</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<a href="{{ url_for('create_template') }}">
|
<a href="{{ url_for('create_template') }}">
|
||||||
<button type="button" class="btn btn-flat btn-primary pull-left">
|
<button type="button" class="btn btn-flat btn-primary pull-left">
|
||||||
Create Template <i class="fa fa-plus"></i>
|
Create Template <i class="fa fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<table id="tbl_template_list" class="table table-bordered table-striped">
|
<table id="tbl_template_list" class="table table-bordered table-striped">
|
||||||
@ -75,15 +75,15 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ url_for('edit_template', template=template.name) }}">
|
<a href="{{ url_for('edit_template', template=template.name) }}">
|
||||||
<button type="button" class="btn btn-flat btn-warning button_edit" id="">
|
<button type="button" class="btn btn-flat btn-warning button_edit" id="btn_edit">
|
||||||
Edit <i class="fa fa-edit"></i>
|
Edit <i class="fa fa-edit"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ url_for('delete_template', template=template.name) }}">
|
<a href="{{ url_for('delete_template', template=template.name) }}">
|
||||||
<button type="button" class="btn btn-flat btn-danger button_delete" id="">
|
<button type="button" class="btn btn-flat btn-danger button_delete" id="btn_delete">
|
||||||
Delete <i class="fa fa-trash"></i>
|
Delete <i class="fa fa-trash"></i>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -161,8 +161,7 @@
|
|||||||
// handle checkbox toggling
|
// handle checkbox toggling
|
||||||
$('.otp_toggle').on('ifToggled', function(event) {
|
$('.otp_toggle').on('ifToggled', function(event) {
|
||||||
var enable_otp = $(this).prop('checked');
|
var enable_otp = $(this).prop('checked');
|
||||||
var username = $(this).prop('id');
|
var postdata = {
|
||||||
postdata = {
|
|
||||||
'action' : 'enable_otp',
|
'action' : 'enable_otp',
|
||||||
'data' : {
|
'data' : {
|
||||||
'enable_otp' : enable_otp
|
'enable_otp' : enable_otp
|
||||||
|
Loading…
Reference in New Issue
Block a user