Module: check_mk
Branch: master
Commit: 3de99ffa285e5f1a271d7322f626f9937fceabb2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3de99ffa285e5f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 16 11:19:09 2018 +0200
6095 Improved hover menu information of downtime icons
In case a host / service is in downtime, an icon (moon) is shown in the icons column
to visualize the downtime state. When hovering over the icon it now shows detailed
information related to the active downtimes (author, timing, comment).
Change-Id: I4cbc2069627c41730a27c2287349b12ee8ac2427
---
.werks/6095 | 12 ++++++++++++
web/plugins/icons/builtin.py | 35 +++++++++++++++++++++++++++++++----
2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/.werks/6095 b/.werks/6095
new file mode 100644
index 0000000..1d252b9
--- /dev/null
+++ b/.werks/6095
@@ -0,0 +1,12 @@
+Title: Improved hover menu information of downtime icons
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1526462266
+Class: feature
+
+In case a host / service is in downtime, an icon (moon) is shown in the icons column
+to visualize the downtime state. When hovering over the icon it now shows detailed
+information related to the active downtimes (author, timing, comment).
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index b68883c..866fc4d 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -58,6 +58,7 @@
#})
import cmk.utils
+import cmk.render
# .--Action Menu---------------------------------------------------------.
# | _ _ _ __ __ |
@@ -502,6 +503,24 @@ multisite_icons_and_actions['notes'] = {
# '----------------------------------------------------------------------'
def paint_downtimes(what, row, tags, host_custom_vars):
+ def detail_txt(downtimes_with_extra_info):
+ if not downtimes_with_extra_info:
+ return ""
+
+ lines = []
+ for downtime_entry in downtimes_with_extra_info:
+ downtime_id, author, comment, origin, entry_time, start_time, end_time,
fixed, duration, recurring, is_pending = downtime_entry[:11]
+
+ if fixed:
+ time_info = "Start: %s, End: %s" %
(cmk.render.date_and_time(start_time), cmk.render.date_and_time(end_time))
+ else:
+ time_info = "May start from %s till %s with duration of %s" %
\
+ (cmk.render.date_and_time(start_time),
cmk.render.date_and_time(end_time), cmk.render.Age(duration))
+
+ lines.append("%s (%s) - %s" % (author, time_info, comment))
+
+ return "\n%s" % "\n".join(lines)
+
# Currently we are in a downtime + link to list of downtimes
# for this host / service
if row[what + "_scheduled_downtime_depth"] > 0:
@@ -509,13 +528,21 @@ def paint_downtimes(what, row, tags, host_custom_vars):
icon = "derived_downtime"
else:
icon = "downtime"
- return icon, _("Currently in downtime"), url_to_view(row,
'downtimes_of_' + what)
+
+ title = _("Currently in downtime")
+ title += detail_txt(row[what + "_downtimes_with_extra_info"])
+
+ return icon, title, url_to_view(row, 'downtimes_of_' + what)
+
elif what == "service" and row["host_scheduled_downtime_depth"]
> 0:
- return 'derived_downtime', _("The host is currently in
downtime"), url_to_view(row, 'downtimes_of_host')
+ title = _("The host is currently in downtime")
+ title += detail_txt(row["host_downtimes_with_extra_info"])
+
+ return 'derived_downtime', title, url_to_view(row,
'downtimes_of_host')
multisite_icons_and_actions['status_downtimes'] = {
- 'host_columns': [ 'scheduled_downtime_depth' ],
- 'columns': [ 'scheduled_downtime_depth' ],
+ 'host_columns': [ 'scheduled_downtime_depth',
'downtimes_with_extra_info' ],
+ 'columns': [ 'scheduled_downtime_depth',
'downtimes_with_extra_info' ],
'paint': paint_downtimes,
'toplevel': True,
}