Module: check_mk
Branch: master
Commit: 307718aa6517aded89852b4632fb0386d31d9ab3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=307718aa6517ad…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Feb 4 18:23:09 2014 +0100
WATO "Notify Users" feature: Improved confirmation info
The confirmation dialog now shows more clearly which notify
plugin succeeded and those which had problems.
---
.werks/275 | 9 +++++++++
ChangeLog | 3 ++-
web/htdocs/notify.py | 37 +++++++++++++++++++++++++++----------
3 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/.werks/275 b/.werks/275
new file mode 100644
index 0000000..87a4989
--- /dev/null
+++ b/.werks/275
@@ -0,0 +1,9 @@
+Title: WATO "Notify Users" feature: Improved confirmation info
+Level: 1
+Component: wato
+Version: 1.2.5i1
+Date: 1391534286
+Class: feature
+
+The confirmation dialog now shows more clearly which notify
+plugin succeeded and those which had problems.
diff --git a/ChangeLog b/ChangeLog
index c6e0d06..075a71c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -156,8 +156,8 @@
* 0577 FIX: fileinfo.groups: new date pattern is now available for inventory check as
well
* 0688 FIX: winperf_msx_queues: Support output of Exchange 2013...
* 0578 FIX: zypper: check is always registered as soon as mk_zypper plugin detects
zypper tool...
- * 0579 FIX: veeam_client: fix for case when no StopTime section in agent output
* 0689 FIX: postgres_sessions: fix empty agent section in case of 0 sessions...
+ * 0579 FIX: veeam_client: fix for case when no StopTime section in agent output
Multisite:
* 0371 Added log class filter to hostsvcevents view
@@ -215,6 +215,7 @@
* 0677 Make title of tags and tag groups localizable...
* 0685 Distributed WATO now disabled WATO on slave sites per default...
* 0687 New summary pages with all settings of a host or service...
+ * 0275 WATO "Notify Users" feature: Improved confirmation info...
* 0057 FIX: Fix exception in WATO host editor on custom tag without topic...
* 0241 FIX: Improved sorting of WATO folders in dropdown menu...
* 0019 FIX: Fixed wording in WATO rule for MSSQL check
diff --git a/web/htdocs/notify.py b/web/htdocs/notify.py
index ce85ab0..40d088f 100644
--- a/web/htdocs/notify.py
+++ b/web/htdocs/notify.py
@@ -201,26 +201,43 @@ def page_notify():
recipients = msg['dest'][1]
num_recipients = len(recipients)
- num_success = 0
- num_failed = 0
+
+ num_success = {}
+ for method in msg['methods']:
+ num_success[method] = 0
# Now loop all notitification methods to send the notifications
+ errors = {}
for user_id in recipients:
for method in msg['methods']:
try:
handler = notify_methods[method]['handler']
handler(user_id, msg)
- num_success += 1
+ num_success[method] = num_success[method] + 1
except MKInternalError, e:
- num_failed += 1
- html.show_error(_('Failed to send %s notification to %s: %s')
% (method, user_id, e))
+ errors.setdefault(method, []).append( (user_id, e) )
- msg = _('The notification has been sent to %d of %d recipients.') %
(num_success, num_recipients)
- msg += ' <a href="%s">%s</a>' % (html.makeuri([]),
_('Back to previous page'))
-
- msg += '<p>Sent notification to: %s</p>' % ',
'.join(recipients)
+ message = _('The notification has been sent via<br>')
+ message += "<table>"
+ for method in msg['methods']:
+ message += "<tr><td>%s</td><td>to %d of %d
recipients</td></tr>" %\
+ (notify_methods[method]["title"],
num_success[method], num_recipients)
+ message += "</table>"
+
+ message += ' <a href="%s">%s</a>' %
(html.makeuri([]), _('Back to previous page'))
+ message += '<p>Sent notification to: %s</p>' % ',
'.join(recipients)
+ html.message(message)
+
+ if errors:
+ error_message = ""
+ for key, values in errors.items():
+ error_message += _("Failed to sent %s notifications to the following
users") % key
+ error_message += "<table>"
+ for user, error in values:
+ error_message +=
"<tr><td>%s</td><td>%s</td></tr>" % (user,
error )
+ error_message += "</table><br>"
+ html.show_error(error_message)
- html.message(msg)
html.footer()