Module: check_mk
Branch: master
Commit: 52d9b114a3fe0f8e0ded4023da28b9703cc6ba7a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=52d9b114a3fe0f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jul 22 14:47:33 2014 +0200
Fix chaos display in inline timeline
---
web/plugins/views/availability.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 96183f7..58b48c5 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -885,6 +885,9 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
if row["log_output"]:
title += " - " + row["log_output"]
width = rest_percentage * row["duration"] /
considered_duration
+
+ # If the width is very small then we group several phases into
+ # one single "chaos period".
if style == "inline" and width < 0.05:
if not chaos_begin:
chaos_begin = row["from"]
@@ -892,12 +895,16 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
chaos_count += 1
chaos_end = row["until"]
continue
- elif chaos_begin and chaos_count > 1:
- output_chaos_period(chaos_begin, chaos_end, chaos_count,
chaos_width)
+
+ # Chaos period has ended? One not-small phase:
+ elif chaos_begin:
+ # Only output chaos phases with a certain length
+ if chaos_count >= 4:
+ output_chaos_period(chaos_begin, chaos_end, chaos_count,
chaos_width)
+
chaos_begin = None
chaos_count = 0
chaos_width = 0
- continue
width += min_percentage
html.write('<td onmouseover="timeline_hover(%d, 1);"
onmouseout="timeline_hover(%d, 0);" '