Some improvements #6

Merged
sophie merged 4 commits from kunsi-improvements into main 2021-04-11 08:59:27 +00:00
Showing only changes of commit a0a359d5dd - Show all commits

View file

@ -107,13 +107,15 @@ class StatusPage:
def render_service_details(self):
# generate list of hosts by scanning services for unique host_name
host_names = set()
host_names = {}
for service in self.get_api_result():
host_names.add(service['attrs']['host_name'])
host_names[service['joins']['host']['vars']['pretty_name']] = service['attrs']['host_name']
# render html for each host_name
html_output = []
for host in sorted(host_names):
html_output.append(self.render_services_per_host(host))
# Can't use .values() here, since we want to sort by prettyname
for prettyname, hostname in sorted(host_names.items()):
html_output.append(self.render_services_per_host(hostname))
return ''.join(html_output)