Module: check_mk
Branch: master
Commit: fbb73a4d855106febce2c5ddcb6e495247cf7d9f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fbb73a4d855106…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Apr 6 09:50:53 2016 +0200
3320 FIX Fix bogus interfering snapins Tree of folders and Folders
If you have both snapins enabled than folding the tree in one
would affect the tree of the other. This has been fixed.
---
.werks/3320 | 11 +++++++++++
ChangeLog | 1 +
web/plugins/sidebar/wato.py | 27 ++++++++++++++++-----------
3 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/.werks/3320 b/.werks/3320
new file mode 100644
index 0000000..7e46150
--- /dev/null
+++ b/.werks/3320
@@ -0,0 +1,11 @@
+Title: Fix bogus interfering snapins Tree of folders and Folders
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459928994
+
+If you have both snapins enabled than folding the tree in one
+would affect the tree of the other. This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index 79b691b..256412a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -165,6 +165,7 @@
* 3355 FIX: Fixed possible broken HW-/SW-Inventory history view
* 3021 FIX: interface metrics: fixed broken interface metrics when using nagios
core...
* 3360 FIX: Fixed different exceptions in predictive monitoring GUI
+ * 3320 FIX: Fix bogus interfering snapins Tree of folders and Folders...
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/plugins/sidebar/wato.py b/web/plugins/sidebar/wato.py
index b8b008d..74b2cf8 100644
--- a/web/plugins/sidebar/wato.py
+++ b/web/plugins/sidebar/wato.py
@@ -184,25 +184,28 @@ def compute_foldertree():
return user_folders
-def render_tree_folder(f, js_func):
- subfolders = f.get(".folders", {}).values()
+# Note: the dictionary that represents the folder here is *not*
+# the datastructure from WATO but a result of compute_foldertree(). The reason:
+# We fetch the information via livestatus - not from WATO.
+def render_tree_folder(tree_id, folder, js_func):
+ subfolders = folder.get(".folders", {}).values()
subfolders.sort(cmp = lambda f1, f2: cmp(f1["title"].lower(),
f2["title"].lower()))
is_leaf = len(subfolders) == 0
# Suppress indentation for non-emtpy root folder
- if f['.path'] == '' and is_leaf:
+ if folder['.path'] == '' and is_leaf:
html.write("<ul>") # empty root folder
- elif f and f['.path'] != '':
+ elif folder and folder['.path'] != '':
html.write("<ul style='padding-left: 0px;'>")
title = '<a class="link" href="#" onclick="%s(this,
\'%s\');">%s (%d)</a>' % (
- js_func, f[".path"], html.attrencode(f["title"]),
f[".num_hosts"])
+ js_func, folder[".path"],
html.attrencode(folder["title"]), folder[".num_hosts"])
if not is_leaf:
- html.begin_foldable_container('wato-hosts', "/" +
f[".path"], False, HTML(title))
+ html.begin_foldable_container(tree_id, "/" + folder[".path"],
False, HTML(title))
for subfolder in subfolders:
- render_tree_folder(subfolder, js_func)
+ render_tree_folder(tree_id, subfolder, js_func)
html.end_foldable_container()
else:
html.write("<li>" + title + "</li>")
@@ -263,12 +266,14 @@ def render_wato_foldertree():
# Now render the whole tree
if user_folders:
- render_tree_folder(user_folders.values()[0], 'wato_tree_click')
+ render_tree_folder("wato-hosts", user_folders.values()[0],
'wato_tree_click')
sidebar_snapins['wato_foldertree'] = {
- 'title' : _('Tree of Folders'),
- 'description' : _('This snapin shows the folders defined in WATO. It can
be used to open views filtered by the WATO folder. It works standalone, without
interaction with any other snapin.'),
+ 'title' : _('Tree of folders'),
+ 'description' : _('This snapin shows the folders defined in WATO. It can
be used to '
+ 'open views filtered by the WATO folder. It works standalone,
without '
+ 'interaction with any other snapin.'),
'render' : render_wato_foldertree,
'allowed' : [ 'admin', 'user', 'guest' ],
'styles' : """
@@ -299,7 +304,7 @@ def render_wato_folders():
user_folders = compute_foldertree()
if user_folders:
- render_tree_folder(user_folders.values()[0], 'wato_folders_clicked')
+ render_tree_folder("wato-folders", user_folders.values()[0],
'wato_folders_clicked')
sidebar_snapins['wato_folders'] = {
'title' : _('Folders'),