Module: check_mk
Branch: master
Commit: 3229b54af6ae5ba61fcede3545f7bc7f4d7d0a0c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3229b54af6ae5b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 11 11:24:24 2017 +0200
4960 Virtual host trees: Add option to exclude empty tag choices from the trees
Change-Id: Id20b1846c2efc4af1ab29a9d518fc4b09f16f017
---
.werks/4960 | 10 ++++++++++
web/plugins/sidebar/shipped.py | 5 +++++
web/plugins/wato/check_mk_configuration.py | 4 ++++
3 files changed, 19 insertions(+)
diff --git a/.werks/4960 b/.werks/4960
new file mode 100644
index 0000000..ea6aa8d
--- /dev/null
+++ b/.werks/4960
@@ -0,0 +1,10 @@
+Title: Virtual host trees: Add option to exclude empty tag choices from the trees
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1499765053
+Class: feature
+
+
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index fed9e12..93fd8d9 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -2174,6 +2174,11 @@ function virtual_host_tree_enter(path)
continue # silently skip not existant tag groups
tag_value, tag_title =
self._get_tag_group_value(tag_groups[level_spec], tags)
+
+ if
self._trees[self._current_tree_id].get("exclude_empty_tag_choices", False) \
+ and tag_value is None:
+ continue
+
this_level_branches.append(tree_entry.setdefault("_children",
{}).setdefault((tag_title, tag_value), {}))
parent_level_branches = this_level_branches
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 79a8e73..9827f69 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -429,6 +429,10 @@ register_configvar(group,
title = _("Title of the tree"),
allow_empty = False,
)),
+ ("exclude_empty_tag_choices", Checkbox(
+ title = _("Exclude empty tag choices"),
+ default_value = False,
+ )),
("tree_spec", ListOf(
DropdownChoice(
choices = virtual_host_tree_choices,