Module: check_mk
Branch: master
Commit: 3aa88f0c6ee336757338215d0d9d904e592281e0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3aa88f0c6ee336…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Aug 19 09:05:20 2013 +0200
Help texts of rules can now also be listed in rule lists (set wato_hide_help_in_lists to
False)
---
web/htdocs/js/checkmk.js | 10 ++++++++++
web/htdocs/wato.css | 10 ++++++++++
web/htdocs/wato.py | 6 +++++-
web/plugins/config/wato.py | 29 ++++++++++++++--------------
web/plugins/wato/check_mk_configuration.py | 8 ++++++++
5 files changed, 48 insertions(+), 15 deletions(-)
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index c65cabd..2fcd72a 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -1761,6 +1761,16 @@ function help_switch(how) {
helpdivs[i].style.display = how ? "block" : "none";
}
+ // small hack for wato ruleset lists, toggle the "nofloat" class
+ // on those objects to make the layout possible
+ var rulesetdivs = document.getElementsByClassName('ruleset');
+ for (var i = 0; i < rulesetdivs.length; i++) {
+ if (how)
+ add_class(rulesetdivs[i], 'nofloat');
+ else
+ remove_class(rulesetdivs[i], 'nofloat');
+ }
+
get_url("ajax_switch_help.py?enabled=" + (how ? "yes" :
""));
}
diff --git a/web/htdocs/wato.css b/web/htdocs/wato.css
index 134a24a..90d82bc 100644
--- a/web/htdocs/wato.css
+++ b/web/htdocs/wato.css
@@ -781,6 +781,16 @@ div.rulesets table.nform tr.bottom td {
/* color: #444; */
}
+.wato .rulesets div.ruleset.nofloat {
+ float: none;
+ clear: left;
+}
+
+.wato .rulesets div.ruleset div.help {
+ height: auto;
+ clear: left;
+}
+
/* Page edit_ruleset */
div.varname {
color: white;
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e4d489e..2a714c4 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -10301,16 +10301,20 @@ def mode_rulesets(phase):
something_shown = True
+ float_cls = (not config.wato_hide_help_in_lists and html.help_visible) and
' nofloat' or ''
url_vars = [("mode", "edit_ruleset"),
("varname", varname)]
if only_host:
url_vars.append(("host", only_host))
view_url = make_link(url_vars)
- html.write('<div class=ruleset title="%s"><div
class=text>' % html.strip_tags(rulespec["help"]))
+ html.write('<div class="ruleset%s"
title="%s"><div class=text>' %
+ (float_cls, html.strip_tags(rulespec["help"] or
'')))
html.write('<a class="%s"
href="%s">%s</a>' %
(num_rules and "nonzero" or "zero", view_url,
rulespec["title"]))
html.write('<span class=dots>%s</span></div>' %
("." * 100))
html.write('<div class="rulecount %s">%d</div>'
%
(num_rules and "nonzero" or "zero",
num_rules))
+ if not config.wato_hide_help_in_lists and rulespec["help"]:
+ html.help(rulespec["help"])
html.write('</div>')
if something_shown:
diff --git a/web/plugins/config/wato.py b/web/plugins/config/wato.py
index 8251a77..744dde1 100644
--- a/web/plugins/config/wato.py
+++ b/web/plugins/config/wato.py
@@ -24,20 +24,21 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-wato_enabled = True
-wato_host_tags = []
-wato_aux_tags = []
-wato_hide_filenames = True
-wato_hide_hosttags = False
-wato_hide_varnames = True
-wato_max_snapshots = 50
-wato_num_hostspecs = 12
-wato_num_itemspecs = 15
-wato_activation_method = 'restart'
-wato_write_nagvis_auth = False
-wato_use_git = False
-wato_hidden_users = []
-wato_user_attrs = []
+wato_enabled = True
+wato_host_tags = []
+wato_aux_tags = []
+wato_hide_filenames = True
+wato_hide_hosttags = False
+wato_hide_varnames = True
+wato_hide_help_in_lists = True
+wato_max_snapshots = 50
+wato_num_hostspecs = 12
+wato_num_itemspecs = 15
+wato_activation_method = 'restart'
+wato_write_nagvis_auth = False
+wato_use_git = False
+wato_hidden_users = []
+wato_user_attrs = []
def tag_alias(tag):
for entry in wato_host_tags:
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index e6dbab2..85d5344 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -399,6 +399,14 @@ register_configvar(group,
register_configvar(group,
+ "wato_hide_help_in_lists",
+ Checkbox(title = _("Hide help text of rules in list views"),
+ label = _("hide help text"),
+ help = _("When disabled, WATO shows the help texts of the rules also in
the list views."),
+ default_value = True),
+ domain = "multisite")
+
+register_configvar(group,
"wato_use_git",
Checkbox(title = _("Use GIT version control for WATO"),
label = _("enable GIT version control"),