Module: check_mk
Branch: master
Commit: 29fbe26b10473d279abc94a4a75caeca637e6443
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29fbe26b10473d…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Nov 28 19:55:37 2011 +0100
WATO: hide topics with no visible attributes
---
web/htdocs/htmllib.py | 2 +-
web/htdocs/js/wato.js | 22 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index a8c9164..bbb770d 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -866,7 +866,7 @@ class html:
onclick += ' onmouseout="this.style.cursor=\'auto\';"
'
if indent == "form":
- self.write('<table class="form nomargin"><tr><td
class=title>')
+ self.write('<table id="topic_%s" style="display:
''" class="form nomargin"><tr ><td
class=title>' % id.encode("utf-8"))
self.write('<img align=absbottom class="treeangle"
id="treeimg.%s.%s" '
'src="images/tree_%s.png" %s>' %
(treename, id, img_num, onclick))
diff --git a/web/htdocs/js/wato.js b/web/htdocs/js/wato.js
index b17fec9..8d90c80 100644
--- a/web/htdocs/js/wato.js
+++ b/web/htdocs/js/wato.js
@@ -97,6 +97,8 @@ function wato_fix_visibility() {
}
}
+ var hide_topics = volatile_topics.slice(0);
+
/* Now loop over all attributes that have conditions. Those are
stored in the global variable wato_depends_on, which is filled
during the creation of the web page. */
@@ -114,8 +116,26 @@ function wato_fix_visibility() {
break;
}
}
- oTr = document.getElementById("attr_" + attrname);
+
+ var oTr = document.getElementById("attr_" + attrname);
oTr.style.display = display;
+
+ // There is at least one item in this topic -> show it
+ var topic = oTr.parentNode.parentNode.parentNode.id.substr(21);
+ if( display == "" ){
+ var index = hide_topics.indexOf(topic);
+ if( index != -1 )
+ delete hide_topics[index];
+ }
+ }
+
+ for each (var item in volatile_topics){
+ var oTr = document.getElementById("topic_" + item);
+ if( hide_topics.indexOf(item) > -1 ){
+ oTr.style.display = "none";
+ }
+ else
+ oTr.style.display = "";
}
}