Working on the first-round updates for the domain settings management view.

This commit is contained in:
Matt Scott 2023-02-19 12:46:11 -05:00
parent 6e10f97e9d
commit fd1bc4afa5

View File

@ -1,14 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}<title>Zone Settings - {{ SITE_NAME }}</title>{% endblock %}
{% block title %}
<title>
Domain Management - {{ SITE_NAME }}
</title>
{% endblock %}
{% block dashboard_stat %} {% block dashboard_stat %}
{% if status %}
{% if status %}
{% if status.get('status') == 'ok' %} {% if status.get('status') == 'ok' %}
<div class="alert alert-success"> <div class="alert alert-success">
<strong>Success!</strong> {{ status.get('msg') }} <strong>Success!</strong> {{ status.get('msg') }}
@ -24,43 +18,132 @@
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
<div class="content-header">
<div class="content-header">
<div class="container-fluid"> <div class="container-fluid">
<div class="row mb-2"> <div class="row mb-2">
<div class="col-sm-6"> <div class="col-sm-6">
<h1 class="m-0 text-dark"> <h1 class="m-0 text-dark">
Domain Settings Zone Settings - {{ domain.name | pretty_domain_name }}
<small>{{ domain.name | pretty_domain_name }}</small>
</h1> </h1>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<ol class="breadcrumb float-sm-right"> <ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li> <li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
<li class="breadcrumb-item active">Domain Settings: {{ domain.name | pretty_domain_name }}</li> <li class="breadcrumb-item active">Zone Settings - {{ domain.name | pretty_domain_name }}</li>
</ol> </ol>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12">
<div class="col-12 col-sm-4">
<form method="post"
action="{{ url_for('domain.change_account', domain_name=domain.name) }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<div class="card"> <div class="card">
<div class="card-header">
<h3 class="card-title">Change Zone Account</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div class="form-group">
<label for="selAccountId">Account</label>
<select id="selAccountId" name="accountid" class="form-control" style="width:15em;">
<option value="0">- No Account -</option>
{% for account in accounts %}
<option value="{{ account.id }}"
{% if domain_account.id == account.id %}selected{% endif %}>{{ account.name }}
</option>
{% endfor %}
</select>
</div>
<!-- /.form-group -->
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="submit" title="Update Account" class="btn btn-flat btn-primary"
id="change_soa_edit_api">
<i class="fa-solid fa-floppy-disk"></i>&nbsp;Update account
</button>
</div>
<!-- /.card-footer -->
</div>
<!-- /.card -->
</form>
</div>
<!-- /.col -->
<div class="col-12 col-sm-4">
<div class="card">
<div class="card-header">
<h3 class="card-title">Auto PTR creation</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div class="form-group">
<input type="checkbox" id="chkAutoPtr" class="auto_ptr_toggle"
{% for setting in domain.settings %}{% if setting.setting=='auto_ptr' and setting.value=='True' %}checked
{% endif %}{% endfor %}
{% if SETTING.get('auto_ptr') %}disabled="True" {% endif %}>
&nbsp;
<label for="chkAutoPtr">Allow automatic reverse pointer creation on record updates?</label>
{% if SETTING.get('auto_ptr') %}
<p><code>Auto-ptr is enabled globally on the PDA system!</code></p>
{% endif %}
</div>
<!-- /.form-group -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
<div class="col-12 col-sm-4">
<div class="card">
<div class="card-header">
<h3 class="card-title">DynDNS 2 Settings</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div class="form-group">
<input type="checkbox" id="chkDynDns" class="dyndns_on_demand_toggle"
{% for setting in domain.settings %}{% if setting.setting=='create_via_dyndns' and setting.value=='True' %}checked
{% endif %}{% endfor %}>
&nbsp;
<label for="chkDynDns">Allow on-demand creation of records via DynDNS updates?</label>
</div>
<!-- /.form-group -->
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-12 col-sm-4">
<form method="post" action="{{ url_for('domain.setting', domain_name=domain.name) }}"> <form method="post" action="{{ url_for('domain.setting', domain_name=domain.name) }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<div class="card">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Domain Access Control</h3> <h3 class="card-title">Domain Access Control</h3>
</div> </div>
<!-- /.card-header -->
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-2"> <div class="col-12">
<p>Users on the right have access to manage the records in <p>Users on the right have access to manage the records in
the {{ domain.name | pretty_domain_name }} domain.</p> the {{ domain.name | pretty_domain_name }} domain.</p>
<p>Click on users to move from between columns.</p> <p>Click on users to move from between columns.</p>
@ -69,101 +152,47 @@
and already have access to <b>ALL</b> domains. and already have access to <b>ALL</b> domains.
</p> </p>
</div> </div>
<div class="form-group col-2"> </div>
<!-- /.row -->
<div class="row">
<div class="col-12">
<div class="form-group">
<select multiple="multiple" class="form-control" id="domain_multi_user" <select multiple="multiple" class="form-control" id="domain_multi_user"
name="domain_multi_user[]"> name="domain_multi_user[]">
{% for user in users %} {% for user in users %}
<option {% if user.id in <option {% if user.id in
domain_user_ids %}selected{% endif %} value="{{ user.username }}" domain_user_ids %}selected{% endif %} value="{{ user.username }}"
{% if user.role.name== 'Administrator' %}style="color: red" {% endif %}>{{ {% if user.role.name== 'Administrator' %}style="color: red" {% endif %}>{{ user.username }}</option> {% endfor %}
user.username}}</option> {% endfor %}
</select> </select>
</div> </div>
<!-- /.form-group -->
</div> </div>
<div class="card-body"> </div>
<div class="col-offset-2"> <!-- /.row -->
<div class="form-group"> </div>
<button type="submit" class="btn btn-primary"> <!-- /.card-body -->
<i class="fa-solid fa-check"></i> <div class="card-footer">
Save <button type="submit" title="Save Changes" class="btn btn-primary">
<i class="fa-solid fa-floppy-disk"></i>
Save Changes
</button> </button>
</div> </div>
<!-- /.card-footer -->
</div> </div>
</div> <!-- /.card -->
</div>
</form> </form>
</div> </div>
<!-- /.col -->
</div> </div>
</div> <!-- /.row -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Account</h3> <h3 class="card-title">Change Zone Type</h3>
</div>
<div class="card-body">
<div class="col-12">
<div class="form-group">
<form method="post"
action="{{ url_for('domain.change_account', domain_name=domain.name) }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<select name="accountid" class="form-control" style="width:15em;">
<option value="0">- No Account -</option>
{% for account in accounts %}
<option value="{{ account.id }}"
{% if domain_account.id == account.id %}selected{% endif %}>{{ account.name }}
</option>
{% endfor %}
</select><br />
<button type="submit" class="btn btn-flat btn-primary" id="change_soa_edit_api">
<i class="fa-solid fa-check"></i>&nbsp;Change account for {{ domain.name | pretty_domain_name }}
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Auto PTR creation</h3>
</div>
<div class="card-body">
<p><input type="checkbox" id="{{ domain.name }}" class="auto_ptr_toggle"
{% for setting in domain.settings %}{% if setting.setting=='auto_ptr' and setting.value=='True' %}checked{% endif %}{% endfor %}
{% if SETTING.get('auto_ptr') %}disabled="True" {% endif %}>
&nbsp;Allow automatic reverse pointer creation on record updates?
{% if SETTING.get('auto_ptr') %}
<br/><code>Auto-ptr is enabled globally on the PDA system!</code>
{% endif %}
</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">DynDNS 2 Settings</h3>
</div>
<div class="card-body">
<p><input type="checkbox" id="{{ domain.name }}" class="dyndns_on_demand_toggle"
{% for setting in domain.settings %}{% if setting.setting=='create_via_dyndns' and setting.value=='True' %}checked{% endif %}{% endfor %}>
&nbsp;Allow on-demand creation of records via DynDNS updates?</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Change Type</h3>
</div> </div>
<!-- /.card-header -->
<div class="card-body"> <div class="card-body">
<p>The type decides how the domain will be replicated across multiple DNS servers.</p> <p>The type decides how the domain will be replicated across multiple DNS servers.</p>
<ul> <ul>
@ -172,11 +201,13 @@
PowerDNS server or you handle replication via your backend. PowerDNS server or you handle replication via your backend.
</li> </li>
<li> <li>
Primary - This PowerDNS server will serve as the primary and will send zone transfers Primary - This PowerDNS server will serve as the primary and will send zone
transfers
(AXFRs) to other servers configured as secondaries. (AXFRs) to other servers configured as secondaries.
</li> </li>
<li> <li>
Secondary - This PowerDNS server will serve as the secondaries and will request and receive Secondary - This PowerDNS server will serve as the secondaries and will request and
receive
zone transfers (AXFRs) from other servers configured as primaries. zone transfers (AXFRs) from other servers configured as primaries.
</li> </li>
</ul> </ul>
@ -188,33 +219,42 @@
<option value="native">Native</option> <option value="native">Native</option>
<option value="priamry">Primary</option> <option value="priamry">Primary</option>
<option value="secondary">Secondary</option> <option value="secondary">Secondary</option>
</select><br /> </select><br/>
<div class="form-group" style="display: none;" id="domain_primary_address_div"> <div class="form-group" style="display: none;" id="domain_primary_address_div">
<input type="text" class="form-control" name="domain_primary_address" <input type="text" class="form-control" name="domain_primary_address"
id="domain_primary_address" id="domain_primary_address"
placeholder="Enter valid Primary Server IP addresses (separated by commas)"> placeholder="Enter valid Primary Server IP addresses (separated by commas)">
</div> </div>
<button type="submit" class="btn btn-primary" id="change_type"> <button type="submit" title="Update Zone Type" class="btn btn-primary" id="change_type">
<i class="fa-solid fa-check"></i>&nbsp;Change type for {{ domain.name | pretty_domain_name }} <i class="fa-solid fa-floppy-disk"></i>&nbsp;Update Zone Type
</button> </button>
</form> </form>
</div> </div>
<!-- /.card-body -->
</div> </div>
<!-- /.card -->
</div> </div>
<!-- /.col -->
</div> </div>
<!-- /.row -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Change SOA-EDIT-API</h3> <h3 class="card-title">Change SOA-EDIT-API</h3>
</div> </div>
<!-- /.card-header -->
<div class="card-body"> <div class="card-body">
<p>The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change is made <p>The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change
is made
to the domain.</p> to the domain.</p>
<ul> <ul>
<li> <li>
DEFAULT - Generate a soa serial of YYYYMMDD01. If the current serial is lower than the DEFAULT - Generate a soa serial of YYYYMMDD01. If the current serial is lower than
generated serial, use the generated serial. If the current serial is higher or equal to the the
generated serial, use the generated serial. If the current serial is higher or equal
to the
generated serial, increase the current serial by 1. generated serial, increase the current serial by 1.
</li> </li>
<li> <li>
@ -228,7 +268,8 @@
</li> </li>
</ul> </ul>
<b>New SOA-EDIT-API Setting:</b> <b>New SOA-EDIT-API Setting:</b>
<form method="post" action="{{ url_for('domain.change_soa_edit_api', domain_name=domain.name) }}"> <form method="post"
action="{{ url_for('domain.change_soa_edit_api', domain_name=domain.name) }}">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}"> <input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<select name="soa_edit_api" class="form-control" style="width:15em;"> <select name="soa_edit_api" class="form-control" style="width:15em;">
<option selected value="0">- Unchanged -</option> <option selected value="0">- Unchanged -</option>
@ -236,38 +277,53 @@
<option>INCREASE</option> <option>INCREASE</option>
<option>EPOCH</option> <option>EPOCH</option>
<option>OFF</option> <option>OFF</option>
</select><br /> </select><br/>
<button type="submit" class="btn btn-primary" id="change_soa_edit_api"> <button type="submit" title="Update SOA-EDIT-API" class="btn btn-primary" id="change_soa_edit_api">
<i class="fa-solid fa-check"></i>&nbsp;Change SOA-EDIT-API setting for {{ domain.name | pretty_domain_name }} <i class="fa-solid fa-floppy-disk"></i>&nbsp;Update SOA-EDIT-API
</button> </button>
</form> </form>
</div> </div>
<!-- /.card-body -->
</div> </div>
<!-- /.card -->
</div> </div>
<!-- /.col -->
</div> </div>
<!-- /.row -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Domain Deletion</h3> <h3 class="card-title">Remove Zone</h3>
</div> </div>
<!-- /.card-header -->
<div class="card-body"> <div class="card-body">
<p>This function is used to remove a domain from PowerDNS-Admin <b>AND</b> PowerDNS. All records and <p>This function is used to remove a domain from PowerDNS-Admin <b>AND</b> PowerDNS. All
records and
user privileges associated with this domain will also be removed. This change cannot be user privileges associated with this domain will also be removed. This change cannot be
reverted.</p> reverted.</p>
<button type="button" class="btn btn-danger float-left delete_domain" <button type="button" title="Delete Zone" class="btn btn-danger float-left delete_domain"
id="{{ domain.name }}"> id="{{ domain.name }}">
<i class="fa-solid fa-trash"></i>&nbsp;DELETE DOMAIN {{ domain.name | pretty_domain_name }} <i class="fa-solid fa-trash"></i>&nbsp;Delete Zone
</button> </button>
</div> </div>
<!-- /.card-body -->
</div> </div>
<!-- /.card -->
</div> </div>
<!-- /.col -->
</div> </div>
<!-- /.row -->
</div> </div>
</section> <!-- /.container-fluid -->
</div>
<!-- /.content -->
</section>
{% endblock %} {% endblock %}
{% block extrascripts %} {% block extrascripts %}
<script> <script>
//initialize pretty checkboxes //initialize pretty checkboxes
$('.dyndns_on_demand_toggle').iCheck({ $('.dyndns_on_demand_toggle').iCheck({
checkboxClass: 'icheckbox_square-blue', checkboxClass: 'icheckbox_square-blue',
@ -369,10 +425,10 @@
} }
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block modals %} {% block modals %}
<div class="modal fade" id="modal_delete_domain"> <div class="modal fade" id="modal_delete_domain">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -387,9 +443,10 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary float-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary float-left" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-danger" id="button_delete_confirm"> <button type="button" class="btn btn-danger" id="button_delete_confirm">
Delete</button> Delete
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
{% endblock %} {% endblock %}