Module: check_mk
Branch: master
Commit: dfef29c6d5d00e8133c2816f6923dbf456fc2c03
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dfef29c6d5d00e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 3 11:00:02 2013 +0100
FIX: Speedometer: Terminating data updates when snapin is removed from sidebar
---
ChangeLog | 1 +
web/plugins/sidebar/shipped.py | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9e3df7e..d9a93de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,7 @@
* Option dials (refresh, number of columns) now turnable by mouse wheel
* FIX: Sidebar not raising exceptions on configured but not available snapins
* FIX: Quicksearch: Fixed Up/Down arrow handling in chrome
+ * FIX: Speedometer: Terminating data updates when snapin is removed from sidebar
WATO:
* FIX: Fixed generated manual check definitions for checks without items
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index 339aab2..b869586 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -656,7 +656,11 @@ def render_speedometer():
html.javascript("""
function show_speed(percentage) {
- var context =
document.getElementById('speedometer').getContext('2d');
+ var canvas = document.getElementById('speedometer');
+ if (!canvas)
+ return;
+
+ var context = canvas.getContext('2d');
if (!context)
return;
@@ -701,6 +705,12 @@ function speedometer_show_speed(last_perc, program_start,
scheduled_rate)
title = code[4];
oDiv = document.getElementById('speedometer');
+
+ // Terminate reschedule when the speedometer div does not exist anymore
+ // (e.g. the snapin has been removed)
+ if (!oDiv)
+ return;
+
oDiv.title = title
oDiv = document.getElementById('speedometerbg');
oDiv.title = title