Module: check_mk
Branch: master
Commit: 739c9bfccbf5f9b7750c78eb5b1370c64f4aa2e5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=739c9bfccbf5f9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 14 20:11:46 2016 +0100
3916 FIX History view: Only showing removed/added entries tables when there are entries
---
.werks/3916 | 9 +++++++++
ChangeLog | 1 +
web/plugins/views/inventory.py | 40 +++++++++++++++++++++++-----------------
3 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/.werks/3916 b/.werks/3916
new file mode 100644
index 0000000..08e514e
--- /dev/null
+++ b/.werks/3916
@@ -0,0 +1,9 @@
+Title: History view: Only showing removed/added entries tables when there are entries
+Level: 1
+Component: inv
+Compatible: compat
+Version: 1.4.0i3
+Date: 1479072597
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 2e585ef..b51bf51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
* 3651 FIX: Fixed potential segfault with Nagios core when accessing log/commands
table via Livestatus....
HW/SW-Inventory:
+ * 3916 FIX: History view: Only showing removed/added entries tables when there are
entries
* 4066 FIX: Fixed broken titles of nodes in inventory views
* 4067 FIX: Fixed broken inventory history view in current master...
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 53da4bd..a354bfa 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -134,11 +134,13 @@ def render_inv_subtree_foldable(hostname, tree_id, invpath, node):
def render_inv_subtree_container(hostname, tree_id, invpath, node):
hint = inv_display_hint(invpath)
+
if "render" in hint:
try:
hint["render"](hostname, invpath, node)
except:
hint["render"](hostname, tree_id, invpath, node)
+
elif type(node) == dict:
render_inv_subtree_dict(hostname, tree_id, invpath, node)
else:
@@ -194,15 +196,17 @@ def render_inv_subtree_list(hostname, tree_id, invpath, node):
return
elif type(node) == tuple:
- html.write(_("Removed entries") + ":<br>")
- html.open_span(class_="invold")
- render_inv_subtree_list(hostname, tree_id, invpath, node[0])
- html.close_span()
+ if node[0]:
+ html.write(_("Removed entries") + ":<br>")
+ html.open_span(class_="invold")
+ render_inv_subtree_list(hostname, tree_id, invpath, node[0])
+ html.close_span()
- html.write(_("New entries") + ":<br>")
- html.open_span(class_="invnew")
- render_inv_subtree_list(hostname, tree_id, invpath, node[1])
- html.close_span()
+ if node[1]:
+ html.write(_("New entries") + ":<br>")
+ html.open_span(class_="invnew")
+ render_inv_subtree_list(hostname, tree_id, invpath, node[1])
+ html.close_span()
else:
for nr, value in enumerate(node):
@@ -261,15 +265,17 @@ def render_inv_subtree_leaf_value(hostname, tree_id, invpath,
node):
def render_inv_dicttable(hostname, tree_id, invpath, node):
# In delta mode node is a pair of (old_items, new_items)
if type(node) == tuple:
- html.write_text(_("Removed entries") + ":")
- html.open_span(class_="invold")
- render_inv_dicttable(hostname, tree_id, invpath, node[0])
- html.close_span()
-
- html.write(_("New entries") + ":")
- html.open_span(class_="invnew")
- render_inv_dicttable(hostname, tree_id, invpath, node[1])
- html.close_span()
+ if node[0]:
+ html.write_text(_("Removed entries") + ":")
+ html.open_span(class_="invold")
+ render_inv_dicttable(hostname, tree_id, invpath, node[0])
+ html.close_span()
+
+ if node[1]:
+ html.write(_("New entries") + ":")
+ html.open_span(class_="invnew")
+ render_inv_dicttable(hostname, tree_id, invpath, node[1])
+ html.close_span()
return
hint = inv_display_hint(invpath)