Module: check_mk
Branch: master
Commit: 252b553a503dc81dd7c9cdbb8f6973d7ce83426b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=252b553a503dc8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Mar 3 14:58:24 2012 +0100
BI: better layout of boxes
---
web/htdocs/bi.css | 21 ++++++++++++++-------
web/htdocs/js/bi.js | 6 ++++--
web/plugins/views/bi.py | 34 ++++++++++++++++++++--------------
web/plugins/views/builtin.py | 12 ++++++------
4 files changed, 44 insertions(+), 29 deletions(-)
diff --git a/web/htdocs/bi.css b/web/htdocs/bi.css
index ed10992..7960463 100644
--- a/web/htdocs/bi.css
+++ b/web/htdocs/bi.css
@@ -118,15 +118,22 @@ table.aggrtree td.node {
background-color: #e8e8e8;
}
-
-div.bibox_box {
- border-style: solid;
+td.aggrtree_box {
+ line-height: 22px;
+}
+.bibox_box {
border-width: 1px;
- float: left;
- margin: 1px 4px 1px 0px;
+ margin: 0px 0px 0px 0px;
padding: 1px 3px;
}
-div.bibox {
- float: left;
+.bibox_box.noleaf {
+ border: 1px solid black;
+ box-shadow: 1px 1px 3px #000;
+}
+.bibox_box.leaf {
+ border-style: solid;
+}
+.bibox {
+ padding: 0px;
}
diff --git a/web/htdocs/js/bi.js b/web/htdocs/js/bi.js
index ecfed96..7e552ba 100644
--- a/web/htdocs/js/bi.js
+++ b/web/htdocs/js/bi.js
@@ -46,11 +46,13 @@ function toggle_bi_box(oDiv)
oDiv.style.display = "none";
// find child nodes that belong to this node
- var found = false;
+ var found = 0;
for (var i in oDiv.parentNode.childNodes) {
var onode = oDiv.parentNode.childNodes[i];
if (onode == oDiv)
- found = true;
+ found = 1;
+ else if (found == 1)
+ found ++;
else if (found) {
onode.style.display = "";
return;
diff --git a/web/plugins/views/bi.py b/web/plugins/views/bi.py
index edf5ed5..8190e6f 100644
--- a/web/plugins/views/bi.py
+++ b/web/plugins/views/bi.py
@@ -210,12 +210,12 @@ def aggr_render_leaf(tree, show_host, bare = False):
service_url = html.makeuri([("view_name", "service"),
("site", site), ("host", host), ("service", service)])
if show_host:
- content += '<a href="%s">%s</a><b
class=bullet>♦</b>' % (host_url, host)
+ content += '<a href="%s">%s</a><b
class=bullet>♦</b>' % (host_url, host.replace(" ",
" "))
if not service:
- content += '<a href="%s">%s</a>' % (host_url,
_("Host status"))
+ content += '<a href="%s">%s</a>' % (host_url,
_("Host status"))
else:
- content += '<a href="%s">%s</a>' % (service_url,
service)
+ content += '<a href="%s">%s</a>' % (service_url,
service.replace(" ", " "))
if bare:
return content
@@ -274,7 +274,7 @@ def paint_aggr_tree_boxes(row):
'onmouseout="this.style.cursor=\'auto\';" ' \
'onclick="toggle_bi_box(this);" '
- def render_subtree(tree, open, show_host):
+ def render_subtree(tree, open, show_host, level):
ret = ""
if not open:
state = tree[0]
@@ -282,18 +282,23 @@ def paint_aggr_tree_boxes(row):
mc = ""
else:
mc = mousecode
- ret = '<div %s class="bibox_box state%s">' % (mc,
state["state"])
- if len(tree) == 3: # leaf
- ret += aggr_render_leaf(tree, show_host, bare = True)
+ if len(tree) == 3:
+ leaf = " leaf"
+ else:
+ leaf = " noleaf"
+ ret = '<span %s class="bibox_box%s state%s">' % (mc,
leaf, state["state"])
+ # ret += ">" * (level-1)
+ if len(tree) == 3:
+ ret += aggr_render_leaf(tree, show_host, bare = True) # .replace("
", " ")
else:
- ret += tree[2]["title"]
- ret += '</div>'
+ ret += tree[2]["title"].replace(" ",
" ")
+ ret += '</span> '
if len(tree) >= 4:
- ret += '<div class="bibox" style="%s">' %
(not open and "display: none;" or "")
+ ret += '<span class="bibox" style="%s">' %
(not open and "display: none;" or "")
parts = []
for node in tree[3]:
- ret += render_subtree(node, False, show_host)
- ret += '</div>'
+ ret += render_subtree(node, False, show_host, level+1)
+ ret += '</span>'
return ret
tree = row["aggr_treestate"]
@@ -301,8 +306,9 @@ def paint_aggr_tree_boxes(row):
tree = filter_tree_only_problems(tree)
affected_hosts = row["aggr_hosts"]
- htmlcode = render_subtree(tree, True, len(affected_hosts) > 1)
- return "aggrtree", htmlcode
+ htmlcode = render_subtree(tree, True, len(affected_hosts) > 1, 0)
+ return "aggrtree_box", htmlcode
+
def paint_aggr_tree_foldable(row, boxes=False):
saved_expansion_level = bi.load_ex_level()
diff --git a/web/plugins/views/builtin.py b/web/plugins/views/builtin.py
index a29bb55..e0ef94d 100644
--- a/web/plugins/views/builtin.py
+++ b/web/plugins/views/builtin.py
@@ -2143,10 +2143,10 @@ multisite_builtin_views.update({
'name': 'aggr_singlehosts',
'num_columns': 1,
'owner': 'omdadmin',
- 'painters': [('host', 'aggrhost', ''),
- ('aggr_state', None, ''),
+ 'painters': [('host', 'aggr_host', ''),
+ ('host_icons', None, ''),
('aggr_treestate', None, ''),
- ('host_icons', None, '')],
+ ],
'play_sounds': False,
'public': True,
'show_filters': ['host_scheduled_downtime_depth',
@@ -2390,10 +2390,10 @@ multisite_builtin_views.update({
'name': 'aggr_hostproblems',
'num_columns': 1,
'owner': 'omdadmin',
- 'painters': [('host', 'aggrhost', ''),
- ('aggr_state', None, ''),
+ 'painters': [('host', 'aggr_host', ''),
+ ('host_icons', None, ''),
('aggr_treestate', None, ''),
- ('host_icons', None, '')],
+ ],
'play_sounds': False,
'public': True,
'show_filters': ['host_scheduled_downtime_depth',