Module: check_mk
Branch: master
Commit: 6cec40a6110c2c620ceab75032a3c0c9330b655d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6cec40a6110c2c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 2 18:22:19 2014 +0100
#1559 FIX Fix link from BI icon to BI views (aggregations affected by this host/service)
---
.werks/1559 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/images/icon_aggr.gif | Bin 3346 -> 0 bytes
web/plugins/icons/builtin.py | 19 ++++++++++++++++---
web/plugins/views/builtin.py | 10 ++++++----
web/plugins/visuals/bi.py | 15 ++++++++-------
6 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/.werks/1559 b/.werks/1559
new file mode 100644
index 0000000..7354873
--- /dev/null
+++ b/.werks/1559
@@ -0,0 +1,9 @@
+Title: Fix link from BI icon to BI views (aggregations affected by this host/service)
+Level: 2
+Component: bi
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417540906
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index ada3d38..eb80e5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -126,6 +126,7 @@
BI:
* 1435 FIX: Saving BI aggregations: No longer reports 'Request-URI Too
Large'...
+ * 1559 FIX: Fix link from BI icon to BI views (aggregations affected by this
host/service)
Event Console:
* 1169 Added host state type filter to "recent event history" view
diff --git a/web/htdocs/images/icon_aggr.gif b/web/htdocs/images/icon_aggr.gif
deleted file mode 100644
index ed1c867..0000000
Binary files a/web/htdocs/images/icon_aggr.gif and /dev/null differ
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index 304598d..dbb013d 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -549,8 +549,21 @@ def paint_aggregations(what, row, tags, custom_vars):
if config.bi_precompile_on_demand \
or bi.is_part_of_aggregation(what, row["site"],
row["host_name"],
row.get("service_description")):
- return link_to_view('<img class=icon src="images/icon_aggr.gif"
title="%s">' %
- _('Aggregations containing this %s') % what, row,
'aggr_' + what)
+ urivars = [
+ ("view_name", "aggr_" + what),
+ ("aggr_%s_site" % what, row["site"]),
+ ("aggr_%s_host" % what, row["host_name"]),
+ ]
+ if what == "service":
+ urivars += [
+ ( "aggr_service_service",
row["service_description"])
+ ]
+ url = html.makeuri_contextless(urivars)
+ icon = '<img class=icon src="images/icon_aggr.png"
title="%s">' \
+ % _("BI Aggregations containing this %s") \
+ % (what == "host" and _("Host") or
_("Service"))
+ return '<a href="%s">%s</a>' % (url, icon)
+
multisite_icons.append({
'paint': paint_aggregations,
@@ -603,7 +616,7 @@ def paint_icon_check_bi_aggr(what, row, tags, custom_vars):
url = "%s/check_mk/view.py?view_name=aggr_single&aggr_name=%s" % \
(base_url, html.urlencode(aggr_name))
- return '<a href="%s"><img class=icon
src="images/icon_aggr.gif" title="%s"></a>' % \
+ return '<a href="%s"><img class=icon
src="images/icon_aggr.png" title="%s"></a>' % \
(html.attrencode(url), _('Open this Aggregation'))
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index 3b65e55..e1ac028 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -2606,7 +2606,7 @@ multisite_builtin_views.update({
('bies-1', 'on'),
],
'hidden': True,
- 'hide_filters': ["aggr_hosts"],
+ 'hide_filters': [],
'hidebutton': False,
'icon' : 'aggr',
'layout': 'table',
@@ -2625,7 +2625,8 @@ multisite_builtin_views.update({
'aggr_state',
'aggr_output',
'aggr_assumed_state',
- 'aggr_effective_state'],
+ 'aggr_effective_state',
+ 'aggr_hosts'],
'sorters': [ ('aggr_name', False) ],
'title': _('Aggregations Affected by Host'),
'topic': _('Business Intelligence')},
@@ -2658,7 +2659,7 @@ multisite_builtin_views.update({
('bies-1', 'on'),
],
'hidden': True,
- 'hide_filters': ["aggr_service"],
+ 'hide_filters': [],
'hidebutton': False,
'icon' : 'aggr',
'layout': 'table',
@@ -2677,7 +2678,8 @@ multisite_builtin_views.update({
'aggr_state',
'aggr_output',
'aggr_assumed_state',
- 'aggr_effective_state'],
+ 'aggr_effective_state',
+ 'aggr_service'],
'sorters': [ ('aggr_name', False) ],
'title': _('Aggregations Affected by Service'),
'topic': _('Business Intelligence')},
diff --git a/web/plugins/visuals/bi.py b/web/plugins/visuals/bi.py
index be8ba1b..51fa55c 100644
--- a/web/plugins/visuals/bi.py
+++ b/web/plugins/visuals/bi.py
@@ -95,7 +95,7 @@ declare_filter(121, BITextFilter("output"))
class BIHostFilter(Filter):
def __init__(self):
self.column = "aggr_hosts"
- Filter.__init__(self, self.column, _("Affected hosts contain"),
"aggr", ["site", "host"], [])
+ Filter.__init__(self, self.column, _("Affected hosts contain"),
"aggr", ["aggr_host_site", "aggr_host_host"], [])
def display(self):
html.text_input(self.htmlvars[1])
@@ -111,7 +111,7 @@ class BIHostFilter(Filter):
# Used for linking
def variable_settings(self, row):
- return [ ("host", row["host_name"]), ("site",
row["site"]) ]
+ return [ ("aggr_host_host", row["host_name"]),
("aggr_host_site", row["site"]) ]
def filter_table(self, rows):
val = html.var(self.htmlvars[1])
@@ -123,22 +123,23 @@ declare_filter(130, BIHostFilter(), _("Filter for all
aggregations that base on
class BIServiceFilter(Filter):
def __init__(self):
- Filter.__init__(self, "aggr_service", _("Affected by
service"), "aggr", ["site", "host",
"service"], [])
+ Filter.__init__(self, "aggr_service", _("Affected by
service"), "aggr", ["aggr_service_site",
"aggr_service_host", "aggr_service_service"], [])
def double_height(self):
return True
def display(self):
html.write(_("Host") + ": ")
- html.text_input("host")
+ html.text_input(self.htmlvars[1])
html.write(_("Service") + ": ")
- html.text_input("service")
+ html.text_input(self.htmlvars[2])
def heading_info(self):
- return html.var_utf8("host") + " / " +
html.var_utf8("service")
+ return html.var_utf8(self.htmlvars[1]) + " / " +
html.var_utf8(self.htmlvars[2])
def service_spec(self):
- return html.var_utf8("site"), html.var_utf8("host"),
html.var_utf8("service")
+ if html.has_var(self.htmlvars[2]):
+ return html.var_utf8(self.htmlvars[0]), html.var_utf8(self.htmlvars[1]),
html.var_utf8(self.htmlvars[2])
# Used for linking
def variable_settings(self, row):