Module: check_mk
Branch: master
Commit: f9168f92fdf4baca5da0cad36548e351d8115f2a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f9168f92fdf4ba…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Feb 1 10:57:12 2016 +0100
New helper function for rendering color icons for graphs
---
web/htdocs/metrics.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 95a43af..844dd1a 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -281,6 +281,8 @@ def mix_colors(a, b):
in zip(a, b)
])
+def render_color_icon(color):
+ return "<div class=color style=\"background-color:
%s\"></div>" % color
#.
# .--Evaluation----------------------------------------------------------.
@@ -1416,7 +1418,7 @@ def render_metrics_table(translated_metrics, host_name,
service_description):
output = "<table class=metricstable>"
for metric_name, metric in sorted(translated_metrics.items(), cmp=lambda a,b:
cmp(a[1]["title"], b[1]["title"])):
output += "<tr>"
- output += "<td class=color><div class=color
style=\"background-color: %s\"></div></td>" %
metric["color"]
+ output += "<td class=color>%s</td>" %
render_color_icon(metric["color"])
output += "<td>%s:</td>" % metric["title"]
output += "<td class=value>%s</td>" %
metric["unit"]["render"](metric["value"])
if cmk_graphs_possible():