Module: check_mk
Branch: master
Commit: f2fb194911a014a6a7a377716b3d7bb4c4486c27
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2fb194911a014…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Mar 26 17:03:13 2015 +0100
Repaired graph hover menu after merge conflict
---
web/htdocs/check_mk.css | 1 +
web/htdocs/js/checkmk.js | 3 ++-
web/htdocs/js/hover.js | 11 ++++++-----
web/htdocs/metrics.py | 14 +++++++-------
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index aa9a1c4..b5eccb8 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -657,6 +657,7 @@ table.graph td.legend div.color {
table.graph td.legend div.entry {
margin-right: 20px;
margin-left: 5px;
+}
div#hover_menu {
position: absolute;
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index ca879ea..ae4f585 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -638,7 +638,8 @@ function render_pnp_graphs(container, site, host, service, pnpview,
base_url, pn
get_url(url, pnp_response_handler, data, pnp_error_response_handler, false);
}
-function hover_graph(site, host_name, service) {
+function hover_graph(site, host_name, service)
+{
var c = get_url_sync('show_graph.py?site='+encodeURIComponent(site)
+'&host_name='+encodeURIComponent(host_name)
+'&service='+encodeURIComponent(service));
diff --git a/web/htdocs/js/hover.js b/web/htdocs/js/hover.js
index c4077e7..c288474 100644
--- a/web/htdocs/js/hover.js
+++ b/web/htdocs/js/hover.js
@@ -100,19 +100,19 @@ function hoverShow(x, y, code) {
var hoverLeft = parseInt(_hoverMenu.style.left.replace('px', ''));
var screenWidth = pageWidth();
var hoverPosAndSizeOk = true;
- if(!hoverMenuInScreen(_hoverMenu, hoverSpacer))
+ if (!hoverMenuInScreen(_hoverMenu, hoverSpacer))
hoverPosAndSizeOk = false;
- if(!hoverPosAndSizeOk) {
+ if (!hoverPosAndSizeOk) {
_hoverMenu.style.left = (x - hoverSpacer - _hoverMenu.clientWidth) +
'px';
- if(hoverMenuInScreen(_hoverMenu, hoverSpacer))
+ if (hoverMenuInScreen(_hoverMenu, hoverSpacer))
hoverPosAndSizeOk = true;
}
// And if the hover menu is still not on the screen move it to the left edge
// and fill the whole screen width
- if(!hoverMenuInScreen(_hoverMenu, hoverSpacer)) {
+ if (!hoverMenuInScreen(_hoverMenu, hoverSpacer)) {
_hoverMenu.style.left = hoverSpacer + scrollLeft + 'px';
_hoverMenu.style.width = pageWidth() - (2*hoverSpacer) + 'px';
}
@@ -120,7 +120,7 @@ function hoverShow(x, y, code) {
var hoverTop = parseInt(_hoverMenu.style.top.replace('px', ''));
// Only move the menu to the top when the new top will not be
// out of sight
- if(hoverTop +_hoverMenu.clientHeight > pageHeight() && hoverTop
-_hoverMenu.clientHeight >= 0)
+ if (hoverTop +_hoverMenu.clientHeight > pageHeight() && hoverTop
-_hoverMenu.clientHeight >= 0)
_hoverMenu.style.top = hoverTop -_hoverMenu.clientHeight - hoverSpacer +
'px';
hoverTop = null;
@@ -128,6 +128,7 @@ function hoverShow(x, y, code) {
}
function hoverMenuInScreen(hoverMenu, hoverSpacer) {
+
var hoverLeft = parseInt(hoverMenu.style.left.replace('px', ''));
var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft :
document.documentElement.scrollLeft;
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 82e7e00..dc7af7b 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -926,8 +926,6 @@ def mix_colors(a, b):
# | | _ | (_) \ V / __/ | |_____| |_| | | | (_| | |_) | | | | |
# | |_| |_|\___/ \_/ \___|_| \____|_| \__,_| .__/|_| |_| |
# | |_| |
-# +----------------------------------------------------------------------+
-# | |
# '----------------------------------------------------------------------'
def page_show_graph():
@@ -942,15 +940,17 @@ def page_show_graph():
"Filter: host_name = %s\n" \
"Filter: service_description = %s\n" \
"Columns: perf_data check_command\n" % (host_name, service)
+
html.live.set_only_sites([site])
data = html.live.query_row(query)
html.live.set_only_sites(None)
+
row = {
- 'site': site,
- 'host_name': host_name,
- 'service_description': service,
- 'service_perf_data': data[0],
- 'service_check_command': data[1],
+ 'site' : site,
+ 'host_name' : host_name,
+ 'service_description' : service,
+ 'service_perf_data' : data[0],
+ 'service_check_command' : data[1],
}
# now try to render the graph with our graphing. If it is not possible,