Module: check_mk
Branch: master
Commit: c3464d7a324ac47451798742486af9e574ad994a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c3464d7a324ac4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 15:49:14 2018 +0200
5979 FIX Availability: Fixed broken highlighting of timeline entries on hover
Change-Id: I22dea48d5bf1847319b65ee5ec39c04e62c9edcb
---
.werks/5979 | 11 +++++++++++
web/htdocs/js/checkmk.js | 26 ++++++++++++++------------
web/plugins/views/availability.py | 19 +++++++++++++------
3 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/.werks/5979 b/.werks/5979
new file mode 100644
index 0000000..8ffe80d
--- /dev/null
+++ b/.werks/5979
@@ -0,0 +1,11 @@
+Title: Availability: Fixed broken highlighting of timeline entries on hover
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1523886523
+
+
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 8ecb1f0..68c930f 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -2946,11 +2946,12 @@ function host_tag_update_value(prefix, grp) {
//# | |
//# '--------------------------------------------------------------------'
-function timeline_hover(td, row_nr, onoff)
+function timeline_hover(row_nr, onoff)
{
- var timeline_bar_table = td.parentNode.parentNode.parentNode.parentNode;
- var events_table = timeline_bar_table.nextElementSibling;
- var row = events_table.children[0].children[row_nr+1];
+ var row = document.getElementById("timetable_" + row_nr);
+ if (!row)
+ return;
+
if (onoff) {
add_class(row, 'hilite');
} else {
@@ -2959,15 +2960,16 @@ function timeline_hover(td, row_nr, onoff)
}
-function timetable_hover(tr, row_nr, onoff) {
+function timetable_hover(row_nr, onoff)
+{
+ var slice = document.getElementById("timeline_" + row_nr);
+ if (!slice)
+ return;
- var timeline_bar_table = tr.parentNode.parentNode.previousElementSibling;
- var tds = timeline_bar_table.getElementsByTagName("TD");
- var td = tds[row_nr];
- if (td && onoff) {
- add_class(td, 'hilite');
- } else if (td) {
- remove_class(td, 'hilite');
+ if (onoff) {
+ add_class(slice, 'hilite');
+ } else {
+ remove_class(slice, 'hilite');
}
}
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index adba2fd..877f838 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -327,7 +327,11 @@ def render_availability_timeline(what, av_entry, avoptions):
# Table with detailed events
table.begin("av_timeline", "", css="timelineevents",
sortable=False, searchable=False)
for row_nr, row in enumerate(timeline_layout["table"]):
- table.row(onmouseover="timetable_hover(this, %d, 1);" % row_nr,
onmouseout="timetable_hover(this, %d, 0);" % row_nr)
+ table.row(
+ id_="timetable_%d" % row_nr,
+ onmouseover="timetable_hover(%d, 1);" % row_nr,
+ onmouseout="timetable_hover(%d, 0);" % row_nr
+ )
table.cell(_("Links"), css="buttons")
if what == "bi":
url = html.makeuri([("timewarp",
str(int(row["from"])))])
@@ -455,13 +459,16 @@ def render_timeline_bar(timeline_layout, style):
html.open_tr(class_="timeline")
for row_nr, title, width, css in timeline_layout["spans"]:
- td_attrs = {"style": "width: %.3f%%" % width,
- "title": title,
- "class": css,}
+ td_attrs = {
+ "style": "width: %.3f%%" % width,
+ "title": title,
+ "class": css,
+ "id_": "timeline_%d" % row_nr,
+ }
if style == "standalone" and row_nr is not None:
- td_attrs.update({"onmouseover": "timeline_hover(this, %d,
1);" % row_nr,
- "onmouseout" : "timeline_hover(this, %d,
0);" % row_nr, })
+ td_attrs.update({"onmouseover": "timeline_hover(%d, 1);"
% row_nr,
+ "onmouseout" : "timeline_hover(%d, 0);"
% row_nr, })
html.td('', **td_attrs)