mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-08 11:25:40 +00:00
Cleaned up a UX issue with the zone records list editor view.
This commit is contained in:
parent
3ee63aca8c
commit
4d0cf87338
@ -1,24 +1,17 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
<title>
|
||||
{{ domain.name | pretty_domain_name }} - {{ SITE_NAME }}
|
||||
</title>
|
||||
{% endblock %}
|
||||
{% block title %}<title>Zone Records - {{ domain.name | pretty_domain_name }} - {{ SITE_NAME }}</title>{% endblock %}
|
||||
|
||||
{% block dashboard_stat %}
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0 text-dark">
|
||||
Domain: <b>{{ domain.name | pretty_domain_name }}</b>
|
||||
</h1>
|
||||
<h1 class="m-0 text-dark">Zone Records - {{ domain.name | pretty_domain_name }}</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
||||
<li class="breadcrumb-item active">Domain: {{ domain.name | pretty_domain_name }}</li>
|
||||
<li class="breadcrumb-item active">Zone Records - {{ domain.name | pretty_domain_name }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@ -27,42 +20,54 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="content">
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% if domain.type != 'Slave' %}
|
||||
<button type="button" style="position: relative; margin-left: 20px" class="btn btn-primary float-left button_add_record" id="{{ domain.name }}">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
Add Record
|
||||
</button>
|
||||
<button type="button" style="position: relative; margin-left: 20px" class="btn btn-primary float-right button_apply_changes" id="{{ domain.name }}" value="{{ domain.serial }}">
|
||||
<i class="fa-solid fa-save"></i>
|
||||
Apply Changes
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="button" style="position: relative; margin-left: 20px" class="btn btn-primary float-left button_update_from_primary" id="{{ domain.name }}">
|
||||
<i class="fa-solid fa-sync"></i>
|
||||
Update from Primary
|
||||
</button>
|
||||
{% endif %}
|
||||
<h3 class="card-title">Zone Editor</h3>
|
||||
<div class="card-tools">
|
||||
{% if current_user.role.name in ['Administrator', 'Operator'] %}
|
||||
<button type="button" style="position: relative; margin-left: 20px" class="btn btn-primary float-left btn-danger" onclick="window.location.href='{{ url_for('domain.setting', domain_name=domain.name) }}'">
|
||||
<button type="button" title="Zone Settings"
|
||||
class="btn btn-primary btn-danger"
|
||||
onclick="window.location.href='{{ url_for('domain.setting', domain_name=domain.name) }}'">
|
||||
<i class="fa-solid fa-toolbox"></i>
|
||||
Admin
|
||||
Zone Settings
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if current_user.role.name in ['Administrator', 'Operator'] or SETTING.get('allow_user_view_history') %}
|
||||
<button type="button" style="position: relative; margin-left: 20px" class="btn btn-primary button_changelog" id="{{ domain.name }}">
|
||||
<button type="button" title="Zone Changelog"
|
||||
class="btn btn-primary ml-2 button_changelog" id="{{ domain.name }}">
|
||||
<i class="fa-solid fa-history" aria-hidden="true"></i>
|
||||
Changelog
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if domain.type != 'Slave' %}
|
||||
<button type="button" title="Add Record"
|
||||
class="btn btn-primary ml-2 button_add_record" id="{{ domain.name }}">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
Add Record
|
||||
</button>
|
||||
<button type="button" title="Save Changes"
|
||||
class="btn btn-primary ml-2 button_apply_changes"
|
||||
id="{{ domain.name }}"
|
||||
value="{{ domain.serial }}">
|
||||
<i class="fa-solid fa-save"></i>
|
||||
Save Changes
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="button" title="Update from Primary"
|
||||
class="btn btn-primary ml-2 button_update_from_primary"
|
||||
id="{{ domain.name }}">
|
||||
<i class="fa-solid fa-sync"></i>
|
||||
Update from Primary
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="tbl_records" class="table table-bordered table-striped">
|
||||
</div>
|
||||
<div class="card-body table-responsive">
|
||||
<table id="tbl_records" class="table table-bordered table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
@ -75,7 +80,7 @@
|
||||
<th>Edit</th>
|
||||
<th>Delete</th>
|
||||
{% if current_user.role.name in ['Administrator', 'Operator'] or SETTING.get('allow_user_view_history') %}
|
||||
<th >Changelog</th>
|
||||
<th>Changelog</th>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<th>Invisible Sorting Column</th>
|
||||
@ -90,29 +95,31 @@
|
||||
<td>{{ record.status }}</td>
|
||||
<td>{{ record.ttl }}</td>
|
||||
<td>{{ record.data | pretty_domain_name }}</td>
|
||||
{% if domain.type != 'Secondary' %}
|
||||
{% if domain.type != 'Slave' %}
|
||||
<td>{{ record.comment }}</td>
|
||||
<td width="6%">
|
||||
<td>
|
||||
{% if record.is_allowed_edit() %}
|
||||
<button type="button" class="btn btn-warning button_edit">
|
||||
<button type="button" class="btn btn-sm btn-warning button_edit">
|
||||
<i class="fa-solid fa-edit"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-warning">
|
||||
<button type="button" class="btn btn-sm btn-warning">
|
||||
<i class="fa-solid fa-exclamation-circle"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td width="6%">
|
||||
<td>
|
||||
{% if record.is_allowed_delete() %}
|
||||
<button type="button" class="btn btn-danger button_delete">
|
||||
<button type="button" class="btn btn-sm btn-danger button_delete">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if current_user.role.name in ['Administrator', 'Operator'] or SETTING.get('allow_user_view_history') %}
|
||||
<td width="6%">
|
||||
<button type="button" onclick="show_record_changelog('{{record.name}}','{{record.type}}',event)" class="btn btn-primary">
|
||||
<td>
|
||||
<button type="button"
|
||||
onclick="show_record_changelog('{{ record.name }}','{{ record.type }}',event)"
|
||||
class="btn btn-primary">
|
||||
<i class="fa-solid fa-history" aria-hidden="true"></i>
|
||||
</button>
|
||||
</td>
|
||||
@ -129,11 +136,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
{% block head_styles %}
|
||||
<style>
|
||||
/* Page Specific Overrides */
|
||||
table#tbl_records thead th:nth-child(1),
|
||||
table#tbl_records thead th:nth-child(2),
|
||||
table#tbl_records thead th:nth-child(3),
|
||||
table#tbl_records thead th:nth-child(4) { width: 100px; }
|
||||
table#tbl_records tbody td { text-align: center; }
|
||||
table#tbl_records tbody td:nth-child(0n+5),
|
||||
table#tbl_records tbody td:nth-child(0n+6) { text-align: left; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrascripts %}
|
||||
<script>
|
||||
<script>
|
||||
// superglobals
|
||||
window.records_allow_edit = {{ editable_records | tojson }};
|
||||
window.ttl_options = {{ ttl_options | tojson }};
|
||||
@ -142,24 +162,24 @@
|
||||
|
||||
// set up user data table
|
||||
$("#tbl_records").DataTable({
|
||||
"paging" : true,
|
||||
"lengthChange" : true,
|
||||
"searching" : true,
|
||||
"ordering" : true,
|
||||
"info" : true,
|
||||
"autoWidth" : false,
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
{% if SETTING.get('default_record_table_size') | string in ['5','15','20'] %}
|
||||
"lengthMenu": [ [5, 15, 20, -1],
|
||||
"lengthMenu": [[5, 15, 20, -1],
|
||||
[5, 15, 20, "All"]],
|
||||
{% else %}
|
||||
"lengthMenu": [ [5, 15, 20, {{ SETTING.get('default_record_table_size') }}, -1],
|
||||
"lengthMenu": [[5, 15, 20, {{ SETTING.get('default_record_table_size') }}, -1],
|
||||
[5, 15, 20, {{ SETTING.get('default_record_table_size') }}, "All"]],
|
||||
{% endif %}
|
||||
"pageLength": {{ SETTING.get('default_record_table_size') }},
|
||||
"language": {
|
||||
"lengthMenu": " _MENU_ records"
|
||||
},
|
||||
"retrieve" : true,
|
||||
"retrieve": true,
|
||||
"columnDefs": [
|
||||
{
|
||||
type: 'natural',
|
||||
@ -175,17 +195,13 @@
|
||||
visible: false,
|
||||
{% if domain.type != 'Slave' %}
|
||||
{% if current_user.role.name in ['Administrator', 'Operator'] or SETTING.get('allow_user_view_history') %}
|
||||
targets: [ 9 ]
|
||||
targets: [9]
|
||||
{% else %}
|
||||
targets: [ 8 ]
|
||||
targets: [8]
|
||||
{% endif %}
|
||||
{% else %}
|
||||
targets: [ 5 ]
|
||||
targets: [5]
|
||||
{% endif %}
|
||||
},
|
||||
{
|
||||
className: "length-break",
|
||||
targets: [ 4, 5 ]
|
||||
}
|
||||
],
|
||||
{% if domain.type != 'Slave' %}
|
||||
@ -204,14 +220,15 @@
|
||||
e.stopPropagation();
|
||||
window.location.href = "/domain/{{domain.name}}/changelog/" + record_name + "./" + record_type;
|
||||
}
|
||||
|
||||
// handle changelog button
|
||||
$(document.body).on("click", ".button_changelog", function(e) {
|
||||
$(document.body).on("click", ".button_changelog", function (e) {
|
||||
e.stopPropagation();
|
||||
window.location.href = "/domain/{{domain.name}}/changelog";
|
||||
});
|
||||
|
||||
// handle delete button
|
||||
$(document.body).on("click", ".button_delete", function(e) {
|
||||
$(document.body).on("click", ".button_delete", function (e) {
|
||||
e.stopPropagation();
|
||||
var modal = $("#modal_delete");
|
||||
var table = $("#tbl_records").DataTable();
|
||||
@ -221,18 +238,18 @@
|
||||
modal.find('.modal-body p').text(info);
|
||||
modal.modal('show');
|
||||
|
||||
$("#button_delete_confirm").unbind().one('click', function(e) {
|
||||
$("#button_delete_confirm").unbind().one('click', function (e) {
|
||||
table.row(nRow).remove().draw();
|
||||
modal.modal('hide');
|
||||
});
|
||||
|
||||
$("#button_delete_cancel").unbind().one('click', function(e) {
|
||||
$("#button_delete_cancel").unbind().one('click', function (e) {
|
||||
modal.modal('hide');
|
||||
});
|
||||
});
|
||||
// handle edit button and record click
|
||||
{% if domain.type != 'Slave' %}
|
||||
$(document.body).on("click", ".button_edit{% if quick_edit %}, .row_record{% endif %}", function(e) {
|
||||
$(document.body).on("click", ".button_edit{% if quick_edit %}, .row_record{% endif %}", function (e) {
|
||||
e.stopPropagation();
|
||||
if ($(this).is('tr')) {
|
||||
var nRow = $(this)[0];
|
||||
@ -263,7 +280,7 @@
|
||||
{% endif %}
|
||||
|
||||
// handle apply changes button
|
||||
$(document.body).on("click",".button_apply_changes", function() {
|
||||
$(document.body).on("click", ".button_apply_changes", function () {
|
||||
if (nNew || nEditing) {
|
||||
showErrorModal("Previous record not saved. Please save it before applying the changes.");
|
||||
return;
|
||||
@ -277,7 +294,7 @@
|
||||
modal.find('.modal-body p').text(info);
|
||||
|
||||
// following unbind("click") is to avoid multiple times execution
|
||||
modal.find('#button_apply_confirm').unbind("click").click(function() {
|
||||
modal.find('#button_apply_confirm').unbind("click").click(function () {
|
||||
var data = {'serial': serial, 'record': getTableData(table), '_csrf_token': '{{ csrf_token() }}'};
|
||||
applyRecordChanges(data, domain);
|
||||
modal.modal('hide');
|
||||
@ -334,7 +351,10 @@
|
||||
//handle update_from_primary button
|
||||
$(document.body).on("click", ".button_update_from_primary", function (e) {
|
||||
var domain = $(this).prop('id');
|
||||
applyChanges({'domain': domain, '_csrf_token': '{{ csrf_token() }}'}, $SCRIPT_ROOT + '/domain/' + domain + '/update', true);
|
||||
applyChanges({
|
||||
'domain': domain,
|
||||
'_csrf_token': '{{ csrf_token() }}'
|
||||
}, $SCRIPT_ROOT + '/domain/' + domain + '/update', true);
|
||||
});
|
||||
|
||||
{% if SETTING.get('record_helper') %}
|
||||
@ -363,7 +383,7 @@
|
||||
";
|
||||
}
|
||||
modal.find('.modal-body p').html(form);
|
||||
modal.find('#button_save').click(function() {
|
||||
modal.find('#button_save').click(function () {
|
||||
caa_flag = modal.find('#caa_flag').val();
|
||||
caa_tag = modal.find('#caa_tag').val();
|
||||
caa_value = modal.find('#caa_value').val();
|
||||
@ -389,7 +409,7 @@
|
||||
";
|
||||
}
|
||||
modal.find('.modal-body p').html(form);
|
||||
modal.find('#button_save').click(function() {
|
||||
modal.find('#button_save').click(function () {
|
||||
mx_server = modal.find('#mx_server').val();
|
||||
mx_priority = modal.find('#mx_priority').val();
|
||||
data = mx_priority + " " + mx_server;
|
||||
@ -425,7 +445,7 @@
|
||||
";
|
||||
}
|
||||
modal.find('.modal-body p').html(form);
|
||||
modal.find('#button_save').click(function() {
|
||||
modal.find('#button_save').click(function () {
|
||||
srv_priority = modal.find('#srv_priority').val();
|
||||
srv_weight = modal.find('#srv_weight').val();
|
||||
srv_port = modal.find('#srv_port').val();
|
||||
@ -475,7 +495,7 @@
|
||||
";
|
||||
}
|
||||
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_adminemail = modal.find('#soa_adminemail').val();
|
||||
soa_serial = modal.find('#soa_serial').val();
|
||||
@ -514,7 +534,7 @@
|
||||
";
|
||||
}
|
||||
modal.find('.modal-body p').html(form);
|
||||
modal.find('#button_save').click(function() {
|
||||
modal.find('#button_save').click(function () {
|
||||
tlsa_certificate_usage = modal.find('#tlsa_certificate_usage').val();
|
||||
tlsa_selector = modal.find('#tlsa_selector').val();
|
||||
tlsa_matching = modal.find('#tlsa_matching').val();
|
||||
@ -532,9 +552,9 @@
|
||||
<textarea style=\"min-width: 100%;color: #333;\" placeholder=\"Your TXT record data\" rows=\"5\" id=\"txt_record\" name=\"txt_record\">" + txt_data + "</textarea> \
|
||||
";
|
||||
modal.find('.modal-body p').html(form);
|
||||
modal.find('#button_save').click(function() {
|
||||
modal.find('#button_save').click(function () {
|
||||
data = modal.find('#txt_record').val();
|
||||
if (! /^".*"$/.test(data)) {
|
||||
if (!/^".*"$/.test(data)) {
|
||||
data = '"' + data + '"';
|
||||
}
|
||||
record_data.val(data);
|
||||
@ -551,10 +571,10 @@
|
||||
<textarea style=\"min-width: 100%;color: #333;\" placeholder=\"Your LUA snippet\" rows=\"5\" id=\"lua_record\" name=\"lua_record\">" + lua_data + "</textarea> \
|
||||
";
|
||||
modal.find('.modal-body p').html(form);
|
||||
modal.find('#button_save').click(function() {
|
||||
modal.find('#button_save').click(function () {
|
||||
type = modal.find('#lua_type').val();
|
||||
data = modal.find('#lua_record').val();
|
||||
if (! /^".*"$/.test(data)) {
|
||||
if (!/^".*"$/.test(data)) {
|
||||
data = '"' + data + '"';
|
||||
}
|
||||
data = type + ' ' + data;
|
||||
@ -566,11 +586,11 @@
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
window.onload = function() {
|
||||
window.onload = function () {
|
||||
document.getElementById("loading-spinner").style.display = "none";
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block modals %}
|
||||
@ -587,7 +607,8 @@
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary pull-left" id="button_delete_cancel" data-dismiss="modal">
|
||||
<button type="button" class="btn btn-secondary pull-left" id="button_delete_cancel"
|
||||
data-dismiss="modal">
|
||||
<i class="fa-solid fa-window-close"></i> Close
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" id="button_delete_confirm">
|
||||
|
Loading…
Reference in New Issue
Block a user