Module: check_mk
Branch: master
Commit: 3b4f78aa68907e7426dd52c910e61719295ceda5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b4f78aa68907e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 11:45:45 2017 +0100
Refactoring: rename "graph specification" into "graph identification"
Change-Id: I3282b87c86f9d2f2b4d6177b8cfef140791efd44
---
.bugs/2839 | 2 +-
web/htdocs/dashboard.py | 12 ++++++------
web/htdocs/metrics.py | 22 +++++++++++-----------
web/plugins/dashboard/dashlets.py | 8 ++++----
web/plugins/views/painters.py | 4 ++--
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/.bugs/2839 b/.bugs/2839
index 89cd083..c068800 100644
--- a/.bugs/2839
+++ b/.bugs/2839
@@ -61,7 +61,7 @@ details:
show_timeranges)
File "/omd/sites/heute/share/check_mk/web/plugins/metrics/graphs.py", line
1760, in render_graphs_from_specification_html
- graph_recipes = create_graph_recipes_from_specification(graph_specification)
+ graph_recipes = create_graph_recipes_from_specification(graph_identification)
File "/omd/sites/heute/share/check_mk/web/plugins/metrics/graphs.py", line
145, in create_graph_recipes_from_specification
return func(spec_info)
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index a6340cd..fc94229 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -1298,21 +1298,21 @@ def popup_add_dashlet(dashboard_name, dashlet_type, context,
params):
return
if dashlet_type == "pnpgraph":
- # Context will always be None here, but the graph_specification (in params)
+ # Context will always be None here, but the graph_identification (in params)
# will contain it. Transform the data to the format needed by the dashlets.
# Example:
# params = [ 'template', {'service_description': 'CPU
load', 'site': 'mysite',
# 'graph_index': 0, 'host_name':
'server123'}])
- graph_specification = params[1]
+ graph_identification = params[1]
if params[0] == "template":
context = {
- "host" : graph_specification["host_name"]
+ "host" : graph_identification["host_name"]
}
- if graph_specification.get("service_description") !=
"_HOST_":
- context["service"] =
graph_specification["service_description"]
+ if graph_identification.get("service_description") !=
"_HOST_":
+ context["service"] =
graph_identification["service_description"]
params = {
- "source" : graph_specification["graph_index"] + 1
+ "source" : graph_identification["graph_index"] + 1
}
elif params[0] == "custom":
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 2238cc1..c0f9fec 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -1427,7 +1427,7 @@ def page_graph_dashlet():
spec = html.var("spec")
if not spec:
raise MKUserError("spec", _("Missing spec parameter"))
- graph_specification = json.loads(html.var("spec"))
+ graph_identification = json.loads(html.var("spec"))
render = html.var("render")
if not render:
@@ -1435,14 +1435,14 @@ def page_graph_dashlet():
custom_graph_render_options = json.loads(html.var("render"))
if cmk_graphs_possible():
- host_service_graph_dashlet_cmk(graph_specification, custom_graph_render_options)
- elif graph_specification[0] == "template":
- host_service_graph_dashlet_pnp(graph_specification)
+ host_service_graph_dashlet_cmk(graph_identification,
custom_graph_render_options)
+ elif graph_identification[0] == "template":
+ host_service_graph_dashlet_pnp(graph_identification)
else:
html.write(_("This graph can not be rendered."))
-def host_service_graph_dashlet_cmk(graph_specification, custom_graph_render_options):
+def host_service_graph_dashlet_cmk(graph_identification, custom_graph_render_options):
size = (int(((float(html.var("width")) - 49 - 5)/html_size_per_ex)),
int((float(html.var("height")) - 23)/html_size_per_ex))
@@ -1475,7 +1475,7 @@ def host_service_graph_dashlet_cmk(graph_specification,
custom_graph_render_opti
graph_render_options)
try:
- graph_recipes = create_graph_recipes_from_specification(graph_specification)
+ graph_recipes = create_graph_recipes_from_specification(graph_identification)
if graph_recipes:
graph_recipe = graph_recipes[0]
else:
@@ -1495,12 +1495,12 @@ def host_service_graph_dashlet_cmk(graph_specification,
custom_graph_render_opti
html.write(html_code)
-def host_service_graph_dashlet_pnp(graph_specification):
- site = graph_specification[1]["site"]
- source = int(graph_specification[1]["graph_index"])
+def host_service_graph_dashlet_pnp(graph_identification):
+ site = graph_identification[1]["site"]
+ source = int(graph_identification[1]["graph_index"])
- pnp_host = pnp_cleanup(graph_specification[1]["host_name"])
- pnp_svc = pnp_cleanup(graph_specification[1]["service_description"])
+ pnp_host = pnp_cleanup(graph_identification[1]["host_name"])
+ pnp_svc = pnp_cleanup(graph_identification[1]["service_description"])
url_prefix = config.site(site)["url_prefix"]
html.write(url_prefix +
"pnp4nagios/index.php/image?host=%s&srv=%s&source=%d&view=%s&theme=multisite"
% \
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index b7ccf58..7596004 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -389,7 +389,7 @@ def dashlet_graph_reload_js(nr, dashlet):
# configured. So we assume the default timerange here by default.
timerange = dashlet.get('timerange', '1')
- graph_specification = ("template", {
+ graph_identification = ("template", {
"site" : site,
"host_name" : host,
"service_description" : service,
@@ -401,7 +401,7 @@ def dashlet_graph_reload_js(nr, dashlet):
}
return "dashboard_render_graph(%d, %s, %s, '%s')" % \
- (nr, json.dumps(graph_specification), json.dumps(graph_render_options),
timerange)
+ (nr, json.dumps(graph_identification), json.dumps(graph_render_options),
timerange)
dashlet_types["pnpgraph"] = {
@@ -466,14 +466,14 @@ dashlet_types["pnpgraph"] = {
"on_refresh" : dashlet_graph_reload_js,
"script": """
var dashlet_offsets = {};
-function dashboard_render_graph(nr, graph_specification, graph_render_options,
timerange)
+function dashboard_render_graph(nr, graph_identification, graph_render_options,
timerange)
{
// Get the target size for the graph from the inner dashlet container
var inner = document.getElementById('dashlet_inner_' + nr);
var c_w = inner.clientWidth;
var c_h = inner.clientHeight;
- var post_data = "spec=" +
encodeURIComponent(JSON.stringify(graph_specification))
+ var post_data = "spec=" +
encodeURIComponent(JSON.stringify(graph_identification))
+ "&render=" +
encodeURIComponent(JSON.stringify(graph_render_options))
+ "&timerange=" + encodeURIComponent(timerange)
+ "&width=" + c_w
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 2fb1f19..9da2f14 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -987,7 +987,7 @@ def time_graph_params():
def paint_time_graph_cmk(row, cell, show_timeranges=False):
- graph_specification = (
+ graph_identification = (
"template", {
"site" : row["site"],
"host_name" : row["host_name"],
@@ -1023,7 +1023,7 @@ def paint_time_graph_cmk(row, cell, show_timeranges=False):
"Maybe performance data processing is disabled.")
return "", metrics.render_graphs_from_specification_html(
- graph_specification,
+ graph_identification,
graph_data_range,
graph_render_options,
show_timeranges)