Fix Zone Type can not be changed from "native" when adding or modifying zones (#1502)

This commit is contained in:
Matt Scott 2023-04-02 15:07:57 -04:00 committed by GitHub
commit cacfc042e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions

View File

@ -66,7 +66,7 @@ def domain(domain_name):
current_app.logger.debug("Fetched rrsets: \n{}".format(pretty_json(rrsets))) current_app.logger.debug("Fetched rrsets: \n{}".format(pretty_json(rrsets)))
# API server might be down, misconfigured # API server might be down, misconfigured
if not rrsets and domain.type != 'Slave': if not rrsets and domain.type != 'slave':
abort(500) abort(500)
quick_edit = Setting().get('record_quick_edit') quick_edit = Setting().get('record_quick_edit')
@ -206,7 +206,7 @@ def changelog(domain_name):
current_app.logger.debug("Fetched rrsets: \n{}".format(pretty_json(rrsets))) current_app.logger.debug("Fetched rrsets: \n{}".format(pretty_json(rrsets)))
# API server might be down, misconfigured # API server might be down, misconfigured
if not rrsets and domain.type != 'Slave': if not rrsets and domain.type != 'slave':
abort(500) abort(500)
records_allow_to_edit = Setting().get_records_allow_to_edit() records_allow_to_edit = Setting().get_records_allow_to_edit()
@ -294,7 +294,7 @@ def record_changelog(domain_name, record_name, record_type):
current_app.logger.debug("Fetched rrsets: \n{}".format(pretty_json(rrsets))) current_app.logger.debug("Fetched rrsets: \n{}".format(pretty_json(rrsets)))
# API server might be down, misconfigured # API server might be down, misconfigured
if not rrsets and domain.type != 'Slave': if not rrsets and domain.type != 'slave':
abort(500) abort(500)
# get all changelogs for this domain, in descening order # get all changelogs for this domain, in descening order

View File

@ -76,11 +76,16 @@
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="radio_type" id="radio_type_secondary" <input type="radio" name="radio_type" id="radio_type_secondary"
value="secondary"> value="slave">
Secondary Secondary
</label> </label>
</div> </div>
</div> </div>
<div class="form-group" style="display: none;" id="domain_master_address_div">
<input type="text" class="form-control" name="domain_master_address"
id="domain_master_address"
placeholder="Enter valid Primary Server IP addresses (separated by commas)">
</div>
<div class="form-group"> <div class="form-group">
<label for="domain_template">Zone Template</label> <label for="domain_template">Zone Template</label>
<select class="form-control" id="domain_template" name="domain_template"> <select class="form-control" id="domain_template" name="domain_template">
@ -90,11 +95,6 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div class="form-group" style="display: none;" id="domain_primary_address_div">
<input type="text" class="form-control" name="domain_primary_address"
id="domain_primary_address"
placeholder="Enter valid Primary Server IP addresses (separated by commas)">
</div>
<div class="form-group"> <div class="form-group">
<label>SOA-EDIT-API</label> <label>SOA-EDIT-API</label>
<div class="radio"> <div class="radio">
@ -228,10 +228,10 @@
<script> <script>
$("input[name=radio_type]").change(function () { $("input[name=radio_type]").change(function () {
var type = $(this).val(); var type = $(this).val();
if (type == "secondary") { if (type == "slave") {
$("#domain_primary_address_div").show(); $("#domain_master_address_div").show();
} else { } else {
$("#domain_primary_address_div").hide(); $("#domain_master_address_div").hide();
} }
}); });
</script> </script>

View File

@ -220,12 +220,12 @@
<select name="domain_type" class="form-control" style="width:15em;"> <select name="domain_type" class="form-control" style="width:15em;">
<option selected value="0">- Unchanged -</option> <option selected value="0">- Unchanged -</option>
<option value="native">Native</option> <option value="native">Native</option>
<option value="primary">Primary</option> <option value="master">Primary</option>
<option value="secondary">Secondary</option> <option value="slave">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_master_address_div">
<input type="text" class="form-control" name="domain_primary_address" <input type="text" class="form-control" name="domain_master_address"
id="domain_primary_address" id="domain_master_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" title="Update Zone Type" class="btn btn-primary" id="change_type"> <button type="submit" title="Update Zone Type" class="btn btn-primary" id="change_type">
@ -422,10 +422,10 @@
// zone primary address input handeling // zone primary address input handeling
$("select[name=domain_type]").change(function () { $("select[name=domain_type]").change(function () {
var type = $(this).val(); var type = $(this).val();
if (type == "secondary") { if (type == "slave") {
$("#domain_primary_address_div").show(); $("#domain_master_address_div").show();
} else { } else {
$("#domain_primary_address_div").hide(); $("#domain_master_address_div").hide();
} }
}); });