Skip to content

Commit 24e9364

Browse files
authored
Merge pull request #20: Add new group ID display
2 parents 77065a5 + bd43f74 commit 24e9364

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

docker-test/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8
55

66
RUN apt-get update -y \
77
&& apt-get install -y --no-install-recommends apt-transport-https locales locales-all python3-pip python3-setuptools python3-dev curl libsasl2-dev libldap2-dev libssl-dev libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev build-essential libmariadb-dev-compat \
8+
git \
89
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
910
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
1011
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \

powerdnsadmin/routes/domainconnect.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,7 @@ def template_edit_post(provider_id=None, service_id=None):
403403
dc = DomainConnect(templ["providerId"], templ["serviceId"], template=templ)
404404
dc_apply_result = dc.apply_template(zone_records=[], domain=request.form["domain"],
405405
host=request.form["host"],
406-
group_ids=[s.strip() for s in request.form["group"].split(",")]
407-
if len(request.form["group"].strip()) > 0 else None,
406+
group_ids=request.form.getlist('group'),
408407
params=request.form, ignore_signature=True, multi_aware=True)
409408
result = transform_records_to_pdns_format(request.form["domain"], dc_apply_result[2])
410409
except Exception as e:
@@ -416,6 +415,8 @@ def template_edit_post(provider_id=None, service_id=None):
416415
return render_template('dc_template_edit.html', new=service_id is None or provider_id is None,
417416
template_raw=request.form["_template"], template=templ,
418417
params=variables,
418+
groups=DomainConnectTemplates.get_group_ids(templ),
419+
group_values=request.form.getlist('group'),
419420
records=result, error=error, templateerror=templateerror)
420421

421422

@@ -427,7 +428,8 @@ def template_edit(provider_id, service_id):
427428
dc = DomainConnect(provider_id, service_id, template_path=Setting().get('dc_template_folder'))
428429
template = dc.data
429430
return render_template('dc_template_edit.html', new=False, template=template,
430-
params=DomainConnectTemplates.get_variable_names(template, {'domain': 'example.com'}))
431+
params=DomainConnectTemplates.get_variable_names(template, {'domain': 'example.com'}),
432+
groups=DomainConnectTemplates.get_group_ids(template))
431433

432434

433435
@dc_api_bp.route('/admin/templates/new', methods=['GET'])
@@ -519,7 +521,8 @@ def template_new():
519521
]
520522
}
521523
return render_template('dc_template_edit.html', new=True, template=template,
522-
params=DomainConnectTemplates.get_variable_names(template, {'domain': 'example.com'}))
524+
params=DomainConnectTemplates.get_variable_names(template, {'domain': 'example.com'}),
525+
groups=DomainConnectTemplates.get_group_ids(template))
523526

524527

525528
@dc_api_bp.route('/admin/templates/providers/<string:provider_id>/services/<string:service_id>/save', methods=['POST'])

powerdnsadmin/templates/dc_template_edit.html

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,26 @@ <h3 class="box-title">Variables</h3>
6464
<input type="hidden" name="_test_template" id="variable_test_template" value="false"/>
6565
<div class="box-body">
6666
{% for k, v in params.items() %}
67-
<div class="row">
68-
<label class="col-xs-2" for="param_{{ k }}">
69-
{{ k }}
70-
</label>
71-
<div>
72-
<input type="text" id="param_{{ k }}" name="{{ k }}" class="input col-xs-9" value="{{ v }}"/>
67+
{% if k != "group" %}
68+
<div class="row">
69+
<label class="col-xs-2" for="param_{{ k }}">
70+
{{ k }}
71+
</label>
72+
<div>
73+
<input type="text" id="param_{{ k }}" name="{{ k }}" class="input col-xs-9" value="{{ v }}"/>
74+
</div>
7375
</div>
74-
</div>
76+
{% else %}
77+
{% for g in groups %}
78+
<div class="row">
79+
<label class="col-xs-2" for="group-{{ g }}">Group {{ g }}</label>
80+
<div>
81+
<input type="checkbox" class="input col-xs-1" id="group-{{ g }}" name="group" value="{{ g }}" {% if g in group_values %}checked{% endif %} >
82+
</div>
83+
</div>
84+
{% endfor %}
85+
<hr>
86+
{% endif %}
7587
{% endfor %}
7688
</div>
7789
<div class="box-body">

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ Jinja2==3.0.3
3232
itsdangerous==2.0.1
3333
werkzeug==2.0.3
3434
cryptography==36.0.2
35-
git+https://github.com/Domain-Connect/DomainConnectApplyZone.git@v3.1.0-dev-templatelist_v4#egg=domainconnectzone
35+
git+https://github.com/Domain-Connect/DomainConnectApplyZone.git@v3.1.0-dev-templatelist_v5#egg=domainconnectzone
3636
Flask-WTF==1.0.1

0 commit comments

Comments
 (0)