Module: check_mk
Branch: master
Commit: e6d0770188bd121a9fc9077c1569cb8c95162095
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e6d0770188bd12…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 10 11:35:01 2017 +0200
4954 FIX Host/Folder properties: fixed displaying of inherited checkbox tag group values
The inherited values of tag groups that have only a single tag choice was displayed
wrong. It was showing a text like it was checked while in fact the inherited values
was unchecked.
Change-Id: I73fecb36d3eb1f01b216cdca764c7730647fc0d1
---
.werks/4954 | 13 +++++++++++++
web/htdocs/wato.py | 2 ++
web/htdocs/watolib.py | 11 ++++++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/.werks/4954 b/.werks/4954
new file mode 100644
index 0000000..bdd01f0
--- /dev/null
+++ b/.werks/4954
@@ -0,0 +1,13 @@
+Title: Host/Folder properties: fixed displaying of inherited checkbox tag group values
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1499679200
+
+The inherited values of tag groups that have only a single tag choice was displayed
+wrong. It was showing a text like it was checked while in fact the inherited values
+was unchecked.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a89a56d..ab7037a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -16928,6 +16928,8 @@ def configure_attributes(new, hosts, for_what, parent,
myself=None, without_attr
if len(values) == 1:
defvalue = values[0]
+ elif attr.is_checkbox_tag():
+ defvalue = True
else:
defvalue = attr.default_value()
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 109ac1d..29ddaa3 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -2867,6 +2867,10 @@ class Attribute:
return []
+ def is_checkbox_tag(self):
+ return False
+
+
# A simple text attribute. It is stored in
# a Python unicode string
@@ -2988,11 +2992,16 @@ class HostTagAttribute(Attribute):
tag_id, title, self._taglist = tag_definition
name = "tag_" + tag_id
if len(self._taglist) == 1:
- def_value = True
+ def_value = None
else:
def_value = self._taglist[0][0]
Attribute.__init__(self, name, title, "", def_value)
+
+ def is_checkbox_tag(self):
+ return len(self._taglist) == 1
+
+
def paint(self, value, hostname):
# Localize the titles. To make the strings available in the scanned localization
# files the _() function must also be placed in the configuration files