Module: check_mk
Branch: master
Commit: afa0e29be89f63dedf96ec3d9e738abd7df0ef21
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afa0e29be89f63…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Feb 13 19:38:08 2011 +0100
Multisite: fix host pnp icons in service views
---
ChangeLog | 2 ++
web/plugins/views/painters.py | 19 +++++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 63f08d9..b390c1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,8 @@
Multisite:
* FIX: fix "too many values to unpack" when editing views in single layout
mode (such as host or service detail)
+ * FIX: fix PNP icon in cases where host and service icons are displayed in
+ same view (found by Wolfgang Barth)
1.1.9i8:
Multisite:
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index c2e826d..0831b53 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -120,19 +120,22 @@ def pnp_cleanup(s):
.replace('/', '_') \
.replace('\\', '_')
-def pnp_url(row, what = 'graph'):
+def pnp_url(row, what, how = 'graph'):
sitename = row["site"]
host = pnp_cleanup(row["host_name"])
- svc = pnp_cleanup(row.get("service_description", "_HOST_"))
+ if what == "host":
+ svc = "_HOST_"
+ else:
+ svc = pnp_cleanup(row["service_description"])
site = html.site_status[sitename]["site"]
url = site["url_prefix"] +
("pnp4nagios/index.php/%s?host=%s&srv=%s" % \
- (what, htmllib.urlencode(host), htmllib.urlencode(svc)))
- if what == 'graph':
+ (how, htmllib.urlencode(host), htmllib.urlencode(svc)))
+ if how == 'graph':
url += "&theme=multisite&baseurl=%scheck_mk/" %
htmllib.urlencode(site["url_prefix"])
return url
-def pnp_popup_url(row):
- return pnp_url(row, 'popup')
+def pnp_popup_url(row, what):
+ return pnp_url(row, what, 'popup')
def logwatch_url(sitename, notes_url):
i = notes_url.index("/check_mk/logwatch.py")
@@ -185,11 +188,11 @@ def paint_icons(what, row): # what is "host" or
"service"
pnpgraph_present = row[prefix + "pnpgraph_present"]
if pnpgraph_present == 1:
if 'X' in html.display_options:
- url = pnp_url(row)
+ url = pnp_url(row, what)
else:
url = ""
output += '<a href="%s"
onmouseover="displayHoverMenu(event, get_url_sync(\'%s\'))"
onmouseout="hoverHide()">' \
- '<img class=icon
src="images/icon_pnp.png"></a>' % (url, pnp_popup_url(row))
+ '<img class=icon
src="images/icon_pnp.png"></a>' % (url, pnp_popup_url(row, what))
if 'X' in html.display_options:
# action_url (only, if not a PNP-URL and pnp_graph is working!)