Module: check_mk
Branch: master
Commit: 68dda8ed301c4ffe3e48a881125596c7c0fbc11e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=68dda8ed301c4f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Feb 15 12:35:16 2016 +0100
#3175 FIX Fix timeranges of graphs that are embedded in a dashboard
That was hard coded to 8 hours and ignored the settings in the dashlet.
This has been fixed.
---
.werks/3175 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/metrics.py | 14 ++++++++++++--
web/plugins/dashboard/dashlets.py | 3 ++-
4 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/.werks/3175 b/.werks/3175
new file mode 100644
index 0000000..856d640
--- /dev/null
+++ b/.werks/3175
@@ -0,0 +1,11 @@
+Title: Fix timeranges of graphs that are embedded in a dashboard
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455536077
+
+That was hard coded to 8 hours and ignored the settings in the dashlet.
+This has been fixed.
diff --git a/ChangeLog b/ChangeLog
index 2d024e4..567caee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
Multisite:
* 3059 FIX: Fixed highlighting of availability timeline time slices
+ * 3175 FIX: Fix timeranges of graphs that are embedded in a dashboard...
WATO:
* 3060 FIX: Folder properties: Fixed exception when a user has no alias set...
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index d493782..62c9df8 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -1407,9 +1407,19 @@ def host_service_graph_dashlet_cmk(graph_specification):
"resizable" : False,
}
- # FIXME: html.var("timerange") ???
+
+ # The timerange is specified in PNP like manner.
+ range_secs = {
+ "0" : 4 * 3600,
+ "1" : 25 * 3600,
+ "2" : 7 * 86400,
+ "3" : 31 * 86400,
+ "4" : 366 * 86400,
+ }
+
+ secs = range_secs.get(html.var("timerange"), 4 * 3600)
end_time = time.time()
- start_time = end_time - 8 * 3600
+ start_time = end_time - secs
graph_data_range = {
"time_range" : (start_time, end_time),
}
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index 9bfac70..d57f95b 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -390,6 +390,7 @@ dashlet_types["pnpgraph"] = {
"infos" : ["service", "host"],
"single_infos" : ["service", "host"],
"parameters" : [
+ # Cleanup: switch to generic Timerange() valuespec!
("timerange", DropdownChoice(
title = _('Timerange'),
default_value = '1',
@@ -407,7 +408,7 @@ dashlet_types["pnpgraph"] = {
],
"styles": """
.dashlet.pnpgraph .dashlet_inner {
- background-color: #fff;
+ background-color: #f8f4f0;
color: #000;
text-align: center;
}