Module: check_mk
Branch: master
Commit: cd187d9e2c43c13bdc6b4a548481474ec2f41e7e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd187d9e2c43c1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 7 17:06:52 2017 +0100
Use standard graph render options also for reports
font_size is now available as standard render option
Change-Id: I0b81a2a816c4e09b164e2ff677c36680083374f3
---
web/htdocs/metrics.py | 19 +++++++++++--------
web/htdocs/valuespec.py | 11 +++++++++++
web/plugins/dashboard/dashlets.py | 4 +---
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 9a2acd6..038d199 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -1541,6 +1541,15 @@ def host_service_graph_popup_pnp(site, host_name,
service_description):
# | This page handler is called by graphs embedded in a dashboard. |
# '----------------------------------------------------------------------'
+default_dashlet_graph_render_options = {
+ "font_size" : 8,
+ "show_legend" : False,
+ "show_service" : True,
+ "show_controls" : False,
+ "resizable" : False,
+ "show_time_range_previews" : False,
+}
+
def page_graph_dashlet():
spec = html.var("spec")
if not spec:
@@ -1564,14 +1573,8 @@ def host_service_graph_dashlet_cmk(graph_identification,
custom_graph_render_opt
size = (int(((float(html.var("width")) - 25)/html_size_per_ex)),
int((float(html.var("height")) - 18)/html_size_per_ex))
- graph_render_options = {
- "size" : size,
- "font_size" : 8,
- "show_legend" : False,
- "show_controls" : False,
- "resizable" : False,
- "show_time_range_previews" : False,
- }
+ graph_render_options = default_dashlet_graph_render_options.copy()
+ graph_render_options["size"] = size
graph_render_options.update(custom_graph_render_options)
# The timerange is specified in PNP like manner.
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 6f55971..0f3cea0 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -4350,6 +4350,17 @@ class TimeofdayRanges(Transform):
)
+
+class Fontsize(Float):
+ def __init__(self, **kwargs):
+ kwargs.setdefault("title", _("Font size"))
+ kwargs.setdefault("default_value", 10)
+ kwargs["size"] = 5
+ kwargs["unit"] = _("pt")
+ super(Fontsize, self).__init__(**kwargs)
+
+
+
class Color(ValueSpec):
def __init__(self, **kwargs):
kwargs["regex"] = "#[0-9]{3,6}"
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index ae45110..4db7889 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -433,9 +433,7 @@ def pnpgraph_parameters():
if metrics.cmk_graphs_possible():
elements += [
("graph_render_options", metrics.vs_graph_render_options(
- default_values={
- "show_service": True,
- },
+ default_values=metrics.default_dashlet_graph_render_options,
exclude=[
"show_time_range_previews",
],