Module: check_mk
Branch: master
Commit: bb9d4acf851027b01f229de2bfc09172849d5d32
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bb9d4acf851027…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 10:56:30 2016 +0100
#2967 FIX Hosts/Services: Hiding action menu trigger for empty menus
---
.bugs/2310 | 7 +++++--
.werks/2967 | 9 +++++++++
ChangeLog | 1 +
web/plugins/icons/builtin.py | 4 ++++
web/plugins/views/painters.py | 10 +++++++---
5 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/.bugs/2310 b/.bugs/2310
index 2cc09dc..fa0760f 100644
--- a/.bugs/2310
+++ b/.bugs/2310
@@ -1,11 +1,14 @@
Title: Quicksearch: service list of host not sorted
Component: multisite
-State: open
+Class: nastiness
+State: done
Date: 2015-04-07 10:31:05
Targetversion: future
-Class: nastiness
When you enter h:somehost s:... then you will see a list of the
service of the host. This list is not but should be sorted
alphabetically. Might be the case that only with CMC it's not
sorted...
+
+2016-01-27 10:45:51: changed state open -> done
+solved.
diff --git a/.werks/2967 b/.werks/2967
new file mode 100644
index 0000000..281143e
--- /dev/null
+++ b/.werks/2967
@@ -0,0 +1,9 @@
+Title: Hosts/Services: Hiding action menu trigger for empty menus
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453888557
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index d29ea7f..b45faa3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -267,6 +267,7 @@
* 2956 FIX: Fixed exception on "Availability of Single-Host Aggregations view
* 2965 FIX: Fixed HTML code shown in filter selection of favorite hosts filter
* 2966 FIX: Quicksearch: Fixed sorting of results when not only searching for hosts
+ * 2967 FIX: Hosts/Services: Hiding action menu trigger for empty menus
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/plugins/icons/builtin.py b/web/plugins/icons/builtin.py
index be68384..e39837a 100644
--- a/web/plugins/icons/builtin.py
+++ b/web/plugins/icons/builtin.py
@@ -84,6 +84,10 @@ def paint_action_menu(what, row, tags, host_custom_vars):
if html.has_var('_display_options'):
url_vars.append(('_display_options',
html.var('_display_options')))
+ icons = get_icons(what, row, toplevel=False)
+ if not icons:
+ return # Don't paint the menu trigger when the menu would be empty
+
return html.render_popup_trigger(
html.render_icon('menu', _('Open the action menu'),
cssclass="iconbutton"),
'action_menu', 'action_menu', url_vars=url_vars)
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index 04a5598..22ebc66 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -308,6 +308,10 @@ def paint_icons(what, row):
return "icons", output
+# toplevel may be
+# True to get only columns for top level icons
+# False to get only columns for dropdown menu icons
+# None to get columns for all active icons
def iconpainter_columns(what, toplevel):
cols = set(['site',
'host_name',
@@ -323,7 +327,7 @@ def iconpainter_columns(what, toplevel):
])
for icon_id, icon in get_multisite_icons().items():
- if toplevel == icon['toplevel']:
+ if toplevel == None or toplevel == icon['toplevel']:
if 'columns' in icon:
cols.update([ what + '_' + c for c in icon['columns'] ])
cols.update([ "host_" + c for c in
icon.get("host_columns", [])])
@@ -336,7 +340,7 @@ multisite_painters["service_icons"] = {
"title" : _("Service icons"),
"short" : _("Icons"),
"printable" : False, # does not contain printable text
- "columns" : lambda: iconpainter_columns("service",
toplevel=True),
+ "columns" : lambda: iconpainter_columns("service",
toplevel=None),
"groupby" : lambda row: "", # Do not account for in grouping
"paint" : lambda row: paint_icons("service", row)
}
@@ -345,7 +349,7 @@ multisite_painters["host_icons"] = {
"title" : _("Host icons"),
"short" : _("Icons"),
"printable" : False, # does not contain printable text
- "columns" : lambda: iconpainter_columns("host",
toplevel=True),
+ "columns" : lambda: iconpainter_columns("host",
toplevel=None),
"groupby" : lambda row: "", # Do not account for in grouping
"paint" : lambda row: paint_icons("host", row)
}