Module: check_mk
Branch: master
Commit: 138fa4ef5e8706e1d4086fcf6478086223cfb08b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=138fa4ef5e8706…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Sat Mar 10 00:03:28 2012 +0100
WATO: bugfix, invisible folder attributes no longer lost on 'Save'
---
web/htdocs/wato.py | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 86629a5..b65adab 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -4043,30 +4043,28 @@ def configure_attributes(hosts, for_what, parent, myself=None,
without_attribute
if attrname in without_attributes:
continue # e.g. needed to skip ipaddress in CSV-Import
- # Skip hidden attributes
+ # Hide invisible attributes
hide_attribute = False
- if not attr.show_in_form():
+ if for_what == "host" and not attr.show_in_form():
+ hide_attribute = True
+ elif (for_what == "folder" or for_what == "bulk") and not
attr.show_in_folder():
hide_attribute = True
- # In folder not all attributes are shown
- if for_what == "folder" and not attr.show_in_folder():
- continue
-
- # Add host tag dependencies, but only in host mode. In other
- # modes we always need to show all attributes.
- if for_what == "host":
+ # Determine visibility information if this attribute is not always hidden
+ if not hide_attribute:
depends_on_tags = attr.depends_on_tags()
depends_on_roles = attr.depends_on_roles()
- if depends_on_tags:
+ # Add host tag dependencies, but only in host mode. In other
+ # modes we always need to show all attributes.
+ if for_what == "host" and depends_on_tags:
dependency_mapping_tags[attrname] = depends_on_tags
+
if depends_on_roles:
dependency_mapping_roles[attrname] = depends_on_roles
if not depends_on_tags and not depends_on_roles:
# One attribute is always shown -> topic is always visible
topic_is_volatile = False
- else:
- topic_is_volatile = False
# "bulk": determine, if this attribute has the same setting for all
hosts.
values = []