Module: check_mk
Branch: master
Commit: 799797d96ba79179ba77d2a41359314eab1f7116
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=799797d96ba791…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 16 13:39:34 2018 +0100
Cleaned up host list painter function
Change-Id: I6cfce5a05dcd8ea6a02e1617abd878c1c6b44124
---
web/plugins/views/painters.py | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 37ed04c..59c780d 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -1762,18 +1762,21 @@ multisite_painters["host_services"] = {
def paint_host_list(site, hosts):
- h = ""
- first = True
+ entries = []
for host in hosts:
- if first:
- first = False
- else:
- h += ", "
- link = "view.py?view_name=hoststatus&site=%s&host=%s" %
(html.urlencode(site), html.urlencode(host))
+ args = [
+ ("view_name", "hoststatus"),
+ ("site", site),
+ ("host", host),
+ ]
+
if html.var("display_options"):
- link += "&display_options=%s" %
html.var("display_options")
- h += "<a href=\"%s\">%s</a></div>" % (link,
host)
- return "", h
+ args.append(("display_options",
html.var("display_options")))
+
+ url = html.makeuri_contextless(args, filename="view.py")
+ entries.append(html.render_a(host, href=url))
+
+ return "", HTML(", ").join(entries)
multisite_painters["host_parents"] = {
"title" : _("Host's parents"),