Module: check_mk
Branch: master
Commit: ae7afa849c60476490139e3b06c1c4611638e33c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ae7afa849c6047…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Oct 10 17:20:41 2012 +0200
BI: corrected representation of assumed state in boxed layout
---
ChangeLog | 1 +
web/plugins/views/bi.py | 33 +++++++++++++++++++++------------
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9d005fe..07c0c6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
* Added new config option bi_compile_log to collect statistics about
aggregation compilations
* Correct representation of (!), (!!) and (?) markers in check output
+ * Corrected representation of assumed state in box layout
WATO:
* Added progress indicator in single site WATO "Activate Changes"
diff --git a/web/plugins/views/bi.py b/web/plugins/views/bi.py
index 7d2128b..5fd7b0f 100644
--- a/web/plugins/views/bi.py
+++ b/web/plugins/views/bi.py
@@ -231,10 +231,15 @@ def aggr_render_leaf(tree, show_host, bare = False):
if show_host:
content += '<a href="%s">%s</a><b
class=bullet>♦</b>' % (host_url, host.replace(" ",
" "))
+ if tree[1] and tree[0] != tree[1]:
+ addclass = ' class="state assumed"'
+ else:
+ addclass = ""
+
if not service:
- content += '<a href="%s">%s</a>' % (host_url,
_("Host status"))
+ content += '<a href="%s"%s>%s</a>' % (host_url,
addclass, _("Host status"))
else:
- content += '<a href="%s">%s</a>' % (service_url,
service.replace(" ", " "))
+ content += '<a href="%s"%s>%s</a>' % (service_url,
addclass, service.replace(" ", " "))
if bare:
return content
@@ -242,17 +247,13 @@ def aggr_render_leaf(tree, show_host, bare = False):
return aggr_render_node(tree, content, None, show_host)
def aggr_render_node(tree, title, mousecode, show_host):
- state = tree[0]
- assumed_state = tree[1]
- if assumed_state != None:
- effective_state = assumed_state
- else:
- effective_state = state
-
- if (effective_state != state):
+ # Check if we have an assumed state: comparing assumed state (tree[1]) with state
(tree[0])
+ if tree[1] and tree[0] != tree[1]:
addclass = " " + _("assumed")
+ effective_state = tree[1]
else:
addclass = ""
+ effective_state = tree[0]
h = '<span class="content state state%d%s">%s</span>\n'
\
% (effective_state["state"], addclass,
render_bi_state(effective_state["state"]))
@@ -314,6 +315,14 @@ def paint_aggr_tree_foldable(row, boxes, omit_root=True):
# Variant: BI-Boxes
if boxes:
+ # Check if we have an assumed state: comparing assumed state (tree[1]) with
state (tree[0])
+ if tree[1] and tree[0] != tree[1]:
+ addclass = " " + _("assumed")
+ effective_state = tree[1]
+ else:
+ addclass = ""
+ effective_state = tree[0]
+
if is_leaf:
leaf = "leaf"
mc = ""
@@ -323,8 +332,8 @@ def paint_aggr_tree_foldable(row, boxes, omit_root=True):
omit = omit_root and len(path) == 1
if not omit:
- h += '<span id="%d:%s" %s class="bibox_box %s %s
state%s">' % (
- expansion_level, path_id, mc, leaf, is_open and "open"
or "closed", state["state"])
+ h += '<span id="%d:%s" %s class="bibox_box %s %s
state state%s%s">' % (
+ expansion_level, path_id, mc, leaf, is_open and "open"
or "closed", effective_state["state"], addclass)
if is_leaf:
h += aggr_render_leaf(tree, show_host, bare = True) # .replace("
", " ")
else: