diff --git a/powerdnsadmin/routes/admin.py b/powerdnsadmin/routes/admin.py
index f308d6c..b2621bd 100644
--- a/powerdnsadmin/routes/admin.py
+++ b/powerdnsadmin/routes/admin.py
@@ -92,8 +92,9 @@ def extract_changelogs_from_a_history_entry(out_changes, history_entry, change_n
if history_entry.detail is None:
return
- detail_dict = json.loads(history_entry.detail.replace("'", '"'))
- if "add_rrests" not in detail_dict:
+ if "add_rrests" in history_entry.detail:
+ detail_dict = json.loads(history_entry.detail.replace("\'", ''))
+ else: # not a record entry
return
add_rrests = detail_dict['add_rrests']
@@ -757,17 +758,14 @@ class DetailedHistory():
self.history = history
self.detailed_msg = ""
self.change_set = change_set
-
- if history.detail is None:
+
+ if not history.detail:
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
-
- detail_dict = json.loads(history.detail.replace("'", '"'))
+ if 'add_rrest' not in history.detail:
+ 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
self.detailed_msg = """
Domain type: | {0} |
Account: | {1} |
@@ -845,7 +843,7 @@ class DetailedHistory():
Domain type: | {1} |
Masters: | {2} |
- """.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:
self.detailed_msg = """
@@ -854,14 +852,14 @@ class DetailedHistory():
Description: | {2} |
Accessible domains with this API key: | {3} |
- """.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:
self.detailed_msg = """
Domain Type: | {0} |
Domain Master IPs: | {1} |
- """.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
def convert_histories(histories):
@@ -869,8 +867,7 @@ def convert_histories(histories):
detailedHistories = []
j = 0
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 != None and ('add_rrests' in json.loads(histories[i].detail.replace("'", '"')) or 'del_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):
extract_changelogs_from_a_history_entry(changes_set, histories[i], j)
if j in changes_set:
detailedHistories.append(DetailedHistory(histories[i], changes_set[j]))
diff --git a/powerdnsadmin/routes/domain.py b/powerdnsadmin/routes/domain.py
index 1142aea..e3b61cc 100644
--- a/powerdnsadmin/routes/domain.py
+++ b/powerdnsadmin/routes/domain.py
@@ -340,7 +340,8 @@ def record_changelog(domain_name, record_name, record_type):
for i in indexes_to_pop:
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)
diff --git a/powerdnsadmin/templates/domain_changelog.html b/powerdnsadmin/templates/domain_changelog.html
index 5d5e903..a6b530a 100644
--- a/powerdnsadmin/templates/domain_changelog.html
+++ b/powerdnsadmin/templates/domain_changelog.html
@@ -4,7 +4,11 @@
{% block dashboard_stat %}