Module: check_mk
Branch: master
Commit: ba7bb222cd7715ed04406b2e26e43194e4720648
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ba7bb222cd7715…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Dec 23 13:17:21 2011 +0100
Adding reschedule icon to all Check_MK based services. Clicks on these
icons will simply trigger a reschedule of the Check_MK service
---
ChangeLog | 2 ++
web/htdocs/js/check_mk.js | 7 ++++++-
web/plugins/icons/builtin.py | 7 ++++---
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9539d76..c4b9d86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
Multisite:
* Several cleanups to prevent css/js warning messages in e.g. Firefox
* Made texts in selectable rows selectable again
+ * Adding reschedule icon to all Check_MK based services. Clicks on these
+ icons will simply trigger a reschedule of the Check_MK service
* FIX: ship missing CSS files for mobile GUI
WATO:
diff --git a/web/htdocs/js/check_mk.js b/web/htdocs/js/check_mk.js
index caa8e14..a72eaec 100644
--- a/web/htdocs/js/check_mk.js
+++ b/web/htdocs/js/check_mk.js
@@ -441,10 +441,15 @@ function actionResponseHandler(oImg, code) {
oImg = null;
}
-function performAction(oLink, action, site, host, service) {
+function performAction(oLink, action, site, host, service, check_command) {
var oImg = oLink.childNodes[0];
oImg.src = 'images/icon_reloading.gif';
+ // Transform reschedules of check_mk triggered services
+ if(check_command.indexOf('check_mk-') === 0) {
+ service = 'Check_MK';
+ }
+
// Chrome and IE are not animating the gif during sync ajax request
// So better use the async request here
get_url('nagios_action.py?action=' + action +
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index 60b4b03..b7998f2 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -416,15 +416,16 @@ multisite_icons.append({
def paint_reschedule(what, row, tags, custom_vars):
# Reschedule button
- if row[what + "_active_checks_enabled"] == 1 \
+ if (row[what + "_active_checks_enabled"] == 1
+ or row[what + '_check_command'].startswith('check_mk-')) \
and config.may('action.reschedule'):
servicedesc = ''
if what == 'service':
servicedesc = row['service_description']
return '<a href=\"javascript:void(0);\" ' \
- 'onclick="performAction(this, \'reschedule\',
\'%s\', \'%s\', \'%s\');">' \
+ 'onclick="performAction(this, \'reschedule\',
\'%s\', \'%s\', \'%s\', \'%s\');">' \
'<img class=icon title="%s"
src="images/icon_reload.gif" /></a>' % \
- (row["site"], row["host_name"], servicedesc,
+ (row["site"], row["host_name"], servicedesc, row[what
+ '_check_command'],
(_('Reschedule an immediate check of this %s') % _(what)))
multisite_icons.append({