Module: check_mk
Branch: master
Commit: 566a862ed99219d3ef36033c4133e306aea99077
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=566a862ed99219…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Sep 5 12:55:55 2011 +0200
Bulk action buttons are shown at the top of hostlists too when the lists have more than 10
list items
---
ChangeLog | 4 +++
web/htdocs/wato.py | 56 ++++++++++++++++++++++++++++++++-------------------
2 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b3ab8c9..c121dcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,11 @@
* Added missing sorters for "service nth service perfdata" painters
* Implemented row selection in views to select only a subset of shown data
for actions
+
+ WATO:
* Changed row selection in WATO to new row selection mechanism
+ * Bulk action buttons are shown at the top of hostlists too when the lists
+ have more than 10 list items
1.1.11i3:
Core, Setup, etc.:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 6f10be4..2fef9db 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -634,7 +634,26 @@ def mode_file(phase):
html.write("</tr>\n")
odd = "odd"
+ def bulk_actions(at_least_one_imported):
+ # bulk actions
+ html.write('<tr class="data %s0">' % odd)
+ html.write("<td colspan=%d>" % colspan)
+ html.jsbutton('_markall', 'X',
'javascript:toggle_all_rows();')
+ html.write(' ' + _("On all selected hosts:\n"))
+ html.button("_bulk_delete", _("Delete"))
+ html.button("_bulk_edit", _("Edit"))
+ html.button("_bulk_cleanup", _("Cleanup"))
+ html.button("_bulk_inventory", _("Inventory"))
+ host_move_combo(None)
+ if at_least_one_imported:
+ html.button("_bulk_movetotarget", _("Move to Target
Folders"))
+ html.write("</td></tr>\n")
+
search_text = html.var("search")
+
+ # Remember if that host has a target folder (i.e. was imported with
+ # a folder information but not yet moved to that folder). If at least
+ # one host has a target folder, then we show an additional bulk action.
at_least_one_imported = False
for hostname in hostnames:
if search_text and (search_text.lower() not in hostname.lower()):
@@ -643,6 +662,21 @@ def mode_file(phase):
host = g_hosts[hostname]
effective = effective_attributes(host, g_file)
+ if effective.get("imported_folder"):
+ at_least_one_imported = True
+
+ # Add the bulk action buttons also to the top of the table when this
+ # list shows more than 10 rows
+ if len(hostnames) > 10:
+ bulk_actions(at_least_one_imported)
+
+ for hostname in hostnames:
+ if search_text and (search_text.lower() not in hostname.lower()):
+ continue
+
+ host = g_hosts[hostname]
+ effective = effective_attributes(host, g_file)
+
# Rows with alternating odd/even styles
html.write('<tr class="dr_%s dr data %s0">' %
(hostname, odd))
odd = odd == "odd" and "even" or "odd"
@@ -682,27 +716,7 @@ def mode_file(phase):
html.write("</td>")
html.write("</tr>\n")
- # Remember if that host has a target folder (i.e. was imported with
- # a folder information but not yet moved to that folder). If at least
- # one host has a target folder, then we show an additional bulk action.
- if effective.get("imported_folder"):
- at_least_one_imported = True
-
-
- # bulk actions
- html.write('<tr class="data %s0">' % odd)
- html.write("<td colspan=%d>" % colspan)
- html.jsbutton('_markall', 'X',
'javascript:toggle_all_rows();')
- html.write(_("On all selected hosts:\n"))
- html.button("_bulk_delete", _("Delete"))
- html.button("_bulk_edit", _("Edit"))
- html.button("_bulk_cleanup", _("Cleanup"))
- html.button("_bulk_inventory", _("Inventory"))
- host_move_combo(None)
- if at_least_one_imported:
- html.button("_bulk_movetotarget", _("Move to Target
Folders"))
- html.write("</td></tr>\n")
-
+ bulk_actions(at_least_one_imported)
html.write("</table>\n")
# Important: remove selected hosts from the hidden fields. Otherwise