Module: check_mk
Branch: master
Commit: d3765fbb2b47d167df64e7f49b656d6c8b48a186
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d3765fbb2b47d1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 29 11:20:19 2017 +0100
5558 FIX Rule list: Fixed visibility of rules in child folders for transitive folders
When viewing the list of rules in a ruleset via WATO, it shows the rules grouped by folder.
When the user views a transitive folder the rules defined in child folders were not listed.
It has now been changed to work like this: The list shows all rules of all parent and
all child folders. Folders of other, not involved, branches in the folder hierarchy
are not displayed.
Change-Id: I16da6d1875dcfe7d0275cae5cfb784e60f8ea1b9
---
.werks/5558 | 16 ++++++++++++++++
web/htdocs/wato.py | 8 +++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.werks/5558 b/.werks/5558
new file mode 100644
index 0000000..6ff8d4d
--- /dev/null
+++ b/.werks/5558
@@ -0,0 +1,16 @@
+Title: Rule list: Fixed visibility of rules in child folders for transitive folders
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i2
+Date: 1511950428
+
+When viewing the list of rules in a ruleset via WATO, it shows the rules grouped by folder.
+When the user views a transitive folder the rules defined in child folders were not listed.
+
+It has now been changed to work like this: The list shows all rules of all parent and
+all child folders. Folders of other, not involved, branches in the folder hierarchy
+are not displayed.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2f1d546..e60a926 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -13043,11 +13043,13 @@ class ModeEditRuleset(WatoMode):
skip_this_folder = False
for folder, rulenr, rule in ruleset.get_rules():
if folder != last_folder:
- if not watolib.Folder.current().is_root() and not folder.is_transitive_parent_of(watolib.Folder.current()):
+ # Only show folders related to the currently viewed folder hierarchy
+ if folder.is_transitive_parent_of(watolib.Folder.current()) \
+ or watolib.Folder.current().is_transitive_parent_of(folder):
+ skip_this_folder = False
+ else:
skip_this_folder = True
continue
- else:
- skip_this_folder = False
if last_folder != None:
table.end()