Module: check_mk
Branch: master
Commit: 8fca2d1b572a4f7a71b3995b048519da7e52d9d4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fca2d1b572a4f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 22 16:39:36 2018 +0200
6152 Notification conditions can now be displayed in notification rule table
The last column can now expand the number of conditions to the list of match conditions of
the rule.
Change-Id: Ibeca2812a5358435f2296351ed0a0bef29d96a82
---
.werks/6152 | 11 +++++++++++
web/htdocs/check_mk.css | 4 ++++
web/htdocs/pages.css | 10 ++++++----
web/htdocs/wato.py | 28 +++++++++++++++++++++++-----
4 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/.werks/6152 b/.werks/6152
new file mode 100644
index 0000000..3800c55
--- /dev/null
+++ b/.werks/6152
@@ -0,0 +1,11 @@
+Title: Notification conditions can now be displayed in notification rule table
+Level: 1
+Component: wato
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526999940
+
+The last column can now expand the number of conditions to the list of match conditions
of the rule.
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 2acc3b3..6fc8aeb 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -395,6 +395,10 @@ b.treeangle.title {
cursor: pointer;
}
+table.data b.treeangle.title {
+ color: #000000;
+}
+
img.treeangle+.treeangle.title {
display: inline-block;
}
diff --git a/web/htdocs/pages.css b/web/htdocs/pages.css
index 645cebf..291e2f2 100644
--- a/web/htdocs/pages.css
+++ b/web/htdocs/pages.css
@@ -1361,8 +1361,8 @@ table.data.single tr.data td.invtree table td,
table.data.single tr.data td.invtree table th,
table.data tr.ac_test_details table td,
table.data tr.notification_context table td,
-table.data tr.notification_context table th
-{
+table.data tr.notification_context table th,
+td.rule_conditions table td {
border: 1px solid #888;
padding: 1px 5px;
height: 14px;
@@ -1377,12 +1377,14 @@ table.data tr.notification_context table th {
td.invtree table td,
td.agent_config table.rulesets table td,
table.data tr.ac_test_details table td,
-table.data tr.notification_context table td {
+table.data tr.notification_context table td,
+td.rule_conditions table td {
background-color: #fff;
}
td.agent_config table.rulesets table td.title,
-table.data tr.notification_context table th {
+table.data tr.notification_context table th,
+td.rule_conditions table td.title {
background-color: #999;
color: #fff;
}
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d6cb47d..6ff6b96 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8089,9 +8089,7 @@ def vs_notification_rule(userid = None):
title = _("Rule Properties"),
elements = rule_option_elements()
+ section_override
- + generic_rule_match_conditions()
- + event_rule_match_conditions(flavour="notify")
- + notification_rule_match_conditions()
+ + rule_match_conditions()
+ section_contacts
+ [
# Notification
@@ -8461,6 +8459,12 @@ def event_rule_match_conditions(flavour):
]
+def rule_match_conditions():
+ return generic_rule_match_conditions() \
+ + event_rule_match_conditions(flavour="notify") \
+ + notification_rule_match_conditions()
+
+
def notification_rule_match_conditions():
def transform_ec_rule_id_match(val):
if isinstance(val, list):
@@ -8607,6 +8611,11 @@ def render_notification_rules(rules, userid="",
show_title=False, show_buttons=T
analyse=False, start_nr=0, profilemode=False):
if not rules:
html.message(_("You have not created any rules yet."))
+ return
+
+ vs_match_conditions = Dictionary(
+ elements = rule_match_conditions()
+ )
if rules:
if not show_title:
@@ -8715,10 +8724,19 @@ def render_notification_rules(rules, userid="",
show_title=False, show_buttons=T
html.write("• %s" % line)
html.br()
- table.cell(_("Conditions"))
+ table.cell(_("Conditions"), css="rule_conditions")
num_conditions = len([key for key in rule if
key.startswith("match_")])
if num_conditions:
- html.write_text(_("%d conditions") % num_conditions)
+ title = _("%d conditions") % num_conditions
+ html.begin_foldable_container(treename="rule_%d" % nr,
+ id="%s" % nr,
+ isopen=False,
+ title=title,
+ indent=False,
+ tree_img="tree_black",
+ )
+ html.write(vs_match_conditions.value_to_text(rule))
+ html.end_foldable_container()
else:
html.i(_("(no conditions)"))