mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Merge branch 'quotes-fix'
Conflicts: powerdnsadmin/routes/admin.py
This commit is contained in:
parent
591055d4aa
commit
caa48b7fe5
@ -92,8 +92,9 @@ def extract_changelogs_from_a_history_entry(out_changes, history_entry, change_n
|
|||||||
if history_entry.detail is None:
|
if history_entry.detail is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
detail_dict = json.loads(history_entry.detail.replace("'", '"'))
|
if "add_rrests" in history_entry.detail:
|
||||||
if "add_rrests" not in detail_dict:
|
detail_dict = json.loads(history_entry.detail.replace("\'", ''))
|
||||||
|
else: # not a record entry
|
||||||
return
|
return
|
||||||
|
|
||||||
add_rrests = detail_dict['add_rrests']
|
add_rrests = detail_dict['add_rrests']
|
||||||
@ -757,17 +758,14 @@ class DetailedHistory():
|
|||||||
self.history = history
|
self.history = history
|
||||||
self.detailed_msg = ""
|
self.detailed_msg = ""
|
||||||
self.change_set = change_set
|
self.change_set = change_set
|
||||||
|
|
||||||
if history.detail is None:
|
if not history.detail:
|
||||||
self.detailed_msg = ""
|
self.detailed_msg = ""
|
||||||
# if 'Create account' in history.msg:
|
|
||||||
# account = Account.query.filter(
|
|
||||||
# Account.name == history.msg.split(' ')[2]).first()
|
|
||||||
# self.detailed_msg = str(account.get_user())
|
|
||||||
# # WRONG, cannot do query afterwards, db may have changed
|
|
||||||
return
|
return
|
||||||
|
if 'add_rrest' not in history.detail:
|
||||||
detail_dict = json.loads(history.detail.replace("'", '"'))
|
detail_dict = json.loads(history.detail.replace("'", '"'))
|
||||||
|
else:
|
||||||
|
detail_dict = json.loads(history.detail.replace("\'", ''))
|
||||||
if 'domain_type' in detail_dict.keys() and 'account_id' in detail_dict.keys(): # this is a domain creation
|
if 'domain_type' in detail_dict.keys() and 'account_id' in detail_dict.keys(): # this is a domain creation
|
||||||
self.detailed_msg = """
|
self.detailed_msg = """
|
||||||
<table class="table table-bordered table-striped"><tr><td>Domain type:</td><td>{0}</td></tr> <tr><td>Account:</td><td>{1}</td></tr></table>
|
<table class="table table-bordered table-striped"><tr><td>Domain type:</td><td>{0}</td></tr> <tr><td>Account:</td><td>{1}</td></tr></table>
|
||||||
@ -845,7 +843,7 @@ class DetailedHistory():
|
|||||||
<tr><td>Domain type:</td><td>{1}</td></tr>
|
<tr><td>Domain type:</td><td>{1}</td></tr>
|
||||||
<tr><td>Masters:</td><td>{2}</td></tr>
|
<tr><td>Masters:</td><td>{2}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
""".format(detail_dict['domain'], detail_dict['type'], str(detail_dict['masters']).replace("]","").replace("[", ""))
|
""".format(detail_dict['domain'], detail_dict['type'], str(detail_dict['masters']).replace("]","").replace("[", "") if 'masters' in detail_dict else "")
|
||||||
elif 'Delete API key' in history.msg:
|
elif 'Delete API key' in history.msg:
|
||||||
self.detailed_msg = """
|
self.detailed_msg = """
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
@ -854,14 +852,14 @@ class DetailedHistory():
|
|||||||
<tr><td>Description:</td><td>{2}</td></tr>
|
<tr><td>Description:</td><td>{2}</td></tr>
|
||||||
<tr><td>Accessible domains with this API key:</td><td>{3}</td></tr>
|
<tr><td>Accessible domains with this API key:</td><td>{3}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
""".format(detail_dict['key'], detail_dict['role'], detail_dict['description'], str(detail_dict['domains']).replace("]","").replace("[", ""))
|
""".format(detail_dict['key'], detail_dict['role'], detail_dict['description'], str(detail_dict['domains']).replace("]","").replace("[", "") if 'domains' in detail_dict else "")
|
||||||
elif 'reverse' in history.msg:
|
elif 'reverse' in history.msg:
|
||||||
self.detailed_msg = """
|
self.detailed_msg = """
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
<tr><td>Domain Type: </td><td>{0}</td></tr>
|
<tr><td>Domain Type: </td><td>{0}</td></tr>
|
||||||
<tr><td>Domain Master IPs:</td><td>{1}</td></tr>
|
<tr><td>Domain Master IPs:</td><td>{1}</td></tr>
|
||||||
</table>
|
</table>
|
||||||
""".format(detail_dict['domain_type'], detail_dict['domain_master_ips'])
|
""".format(detail_dict['domain_type'], detail_dict['domain_master_ips'] if 'domain_master_ips' in detail_dict else "")
|
||||||
|
|
||||||
# convert a list of History objects into DetailedHistory objects
|
# convert a list of History objects into DetailedHistory objects
|
||||||
def convert_histories(histories):
|
def convert_histories(histories):
|
||||||
@ -869,8 +867,7 @@ def convert_histories(histories):
|
|||||||
detailedHistories = []
|
detailedHistories = []
|
||||||
j = 0
|
j = 0
|
||||||
for i in range(len(histories)):
|
for i in range(len(histories)):
|
||||||
# if histories[i].detail != None and 'add_rrests' in json.loads(histories[i].detail.replace("'", '"')):
|
if histories[i].detail and ('add_rrests' in histories[i].detail or 'del_rrests' in histories[i].detail):
|
||||||
if histories[i].detail != None and ('add_rrests' in json.loads(histories[i].detail.replace("'", '"')) or 'del_rrests' in json.loads(histories[i].detail.replace("'", '"'))):
|
|
||||||
extract_changelogs_from_a_history_entry(changes_set, histories[i], j)
|
extract_changelogs_from_a_history_entry(changes_set, histories[i], j)
|
||||||
if j in changes_set:
|
if j in changes_set:
|
||||||
detailedHistories.append(DetailedHistory(histories[i], changes_set[j]))
|
detailedHistories.append(DetailedHistory(histories[i], changes_set[j]))
|
||||||
|
@ -340,7 +340,8 @@ def record_changelog(domain_name, record_name, record_type):
|
|||||||
for i in indexes_to_pop:
|
for i in indexes_to_pop:
|
||||||
changes_set_of_record.pop(i)
|
changes_set_of_record.pop(i)
|
||||||
|
|
||||||
return render_template('domain_changelog.html', domain=domain, allHistoryChanges=changes_set_of_record)
|
return render_template('domain_changelog.html', domain=domain, allHistoryChanges=changes_set_of_record,
|
||||||
|
record_name = record_name, record_type = record_type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,11 @@
|
|||||||
{% block dashboard_stat %}
|
{% block dashboard_stat %}
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<h1>
|
<h1>
|
||||||
|
{% if record_name and record_type %}
|
||||||
|
Record changelog: <b>{{ record_name}}   {{ record_type }}</b>
|
||||||
|
{% else %}
|
||||||
Domain changelog: <b>{{ domain.name | pretty_domain_name }}</b>
|
Domain changelog: <b>{{ domain.name | pretty_domain_name }}</b>
|
||||||
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li><a href="{{ url_for('dashboard.dashboard') }}"><i class="fa fa-dashboard"></i> Home</a></li>
|
<li><a href="{{ url_for('dashboard.dashboard') }}"><i class="fa fa-dashboard"></i> Home</a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user