Module: check_mk
Branch: master
Commit: 20bf839f1cfb23e843f2af54ffc8a5448050b469
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=20bf839f1cfb23…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Nov 25 14:55:53 2011 +0100
WATO: handle visibility of topics (part1)
---
web/htdocs/wato.py | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 00fe13f..c0de3d1 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3678,7 +3678,9 @@ def configure_attributes(hosts, for_what, parent, myself=None,
without_attribute
dependency_mapping = {}
inherited_tags = {}
+ volatile_topics = []
for topic in topics:
+ topic_is_volatile = True # assume topic is sometimes hidden due to dependencies
if len(topics) > 1:
if topic == None:
title = _("Basic settings")
@@ -3716,6 +3718,10 @@ def configure_attributes(hosts, for_what, parent, myself=None,
without_attribute
depends_on_tags = attr.depends_on_tags()
if depends_on_tags:
dependency_mapping[attrname] = depends_on_tags
+ else:
+ # One attribute is always shown -> topic can never
+ # be made invisible
+ topic_is_volatile = False
# "bulk": determine, if this attribute has the same setting for all
hosts.
values = []
@@ -3866,7 +3872,9 @@ def configure_attributes(hosts, for_what, parent, myself=None,
without_attribute
if len(topics) > 1:
html.write("</table>")
- html.end_foldable_container()
+ html.end_foldable_container() # end of topic
+ if topic_is_volatile:
+ volatile_topics.append(topic.encode('utf-8'))
if topic == topics[-1]:
html.write('<table class="form nomargin">')
@@ -3874,7 +3882,11 @@ def configure_attributes(hosts, for_what, parent, myself=None,
without_attribute
# of all attributes.
html.javascript("var inherited_tags = %r;\n"\
"var wato_depends_on = %r;\n"\
- "wato_fix_visibility();\n" % (inherited_tags,
dependency_mapping))
+ "var volatile_topics = %r;\n"\
+ "wato_fix_visibility();\n" % (
+ inherited_tags,
+ dependency_mapping,
+ volatile_topics))
# Check if at least one host in a folder (or its subfolders)