Module: check_mk
Branch: master
Commit: f04c78af0f0605353678689c1527ef6885ba6ea0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f04c78af0f0605…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 14 15:55:50 2013 +0100
FIX: avoid closing BI subtree while tree is being loaded
---
ChangeLog | 1 +
web/htdocs/bi.py | 4 +++-
web/htdocs/js/bi.js | 6 ++++++
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b383c3b..4fa25d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -97,6 +97,7 @@
BI:
* FIX: fix exception with expansion level being 'None'
* FIX: speedup for single host tables joined by hostname (BI-Boxes)
+ * FIX: avoid closing BI subtree while tree is being loaded
1.2.2b4:
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index a1c9ae2..d8a0809 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1343,6 +1343,7 @@ def ajax_save_treestate():
def ajax_render_tree():
aggr_group = html.var("group")
+ reqhosts = [ tuple(sitehost.split('#')) for sitehost in
html.var("reqhosts").split(',') ]
aggr_title = html.var("title")
omit_root = not not html.var("omit_root")
boxes = not not html.var("boxes")
@@ -1350,7 +1351,7 @@ def ajax_render_tree():
# Make sure that BI aggregates are available
if config.bi_precompile_on_demand:
- compile_forest(config.user_id, only_groups = [ aggr_group ])
+ compile_forest(config.user_id, only_hosts = reqhosts, only_groups = [ aggr_group
])
else:
compile_forest(config.user_id)
@@ -1480,6 +1481,7 @@ def render_tree_foldable(row, boxes, omit_root, expansion_level,
only_problems,
( "omit_root", omit_root and "yes" or ""),
( "boxes", boxes and "yes" or ""),
( "only_problems", only_problems and "yes" or ""),
+ ( "reqhosts", ",".join('%s#%s' % sitehost for
sitehost in affected_hosts) ),
])
htmlcode = '<div id="%s" class=bi_tree_container>' %
htmllib.attrencode(url_id) + \
diff --git a/web/htdocs/js/bi.js b/web/htdocs/js/bi.js
index 5427f69..00f3a16 100644
--- a/web/htdocs/js/bi.js
+++ b/web/htdocs/js/bi.js
@@ -53,6 +53,10 @@ function bi_toggle_subtree(oImg, lazy)
function bi_update_tree(oImg, code)
{
+ // Deactivate clicking - the update can last a couple
+ // of seconds. In that time we must inhibit further clicking.
+ oImg.onclick = null;
+
// First find enclosding <div class=bi_tree_container>
var oDiv = oImg;
while (oDiv.className != "bi_tree_container") {
@@ -73,6 +77,8 @@ function bi_toggle_box(oDiv, lazy)
var do_open;
if (oDiv.className.indexOf("open") >= 0) {
+ if (lazy)
+ return; // do not close in lazy mode
oDiv.className = oDiv.className.replace(/open/, "closed");
url += "&state=closed";
do_open = false;