Module: check_mk
Branch: master
Commit: ca7d997cce05865c734266e466f79eb695363679
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ca7d997cce0586…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 6 12:14:11 2012 +0200
fix search field in host table if more than 10 hosts are shown
---
ChangeLog | 1 +
web/htdocs/htmllib.py | 2 ++
web/htdocs/wato.py | 15 +++++++++------
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3059f67..2195f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.0:
WATO:
* FIX: add missing icon on cluster hosts to WATO in Multisite views
+ * FIX: fix search field in host table if more than 10 hosts are shown
Checks & Agents:
* fileinfo: added this check to Linux agent. Simply put your
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index f9c679f..b1bfe2d 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -986,6 +986,8 @@ class html:
def del_var(self, varname):
if varname in self.req.vars:
del self.req.vars[varname]
+ if varname in self.req.listvars:
+ del self.req.listvars[varname]
def javascript(self, code):
self.write("<script language=\"javascript\">\n%s\n</script>\n" % code)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a071416..6cef8c9 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1179,15 +1179,17 @@ def show_hosts(folder):
# Helper function for showing bulk actions. This is needed at the bottom
# of the table of hosts and - if there are more than just a few - also
# at the top of the table.
- def bulk_actions(at_least_one_imported, top, colspan, odd):
+ search_shown = False
+ def bulk_actions(at_least_one_imported, top, withsearch, colspan, odd):
# bulk actions
html.write('<tr class="data %s0">' % odd)
html.write('<td>')
html.jsbutton('_markall', _('X'), 'javascript:toggle_all_rows();')
html.write("</td><td class=bulksearch colspan=2>")
- html.text_input("search")
- html.button("_search", _("Search"))
- html.set_focus("search")
+ if withsearch:
+ html.text_input(top and "search" or "search")
+ html.button("_search", _("Search"))
+ html.set_focus("search")
html.write('</td>')
html.write("<td class=bulkactions colspan=%d>" % (colspan-3))
html.write(' ' + _("Selected hosts:\n"))
@@ -1240,7 +1242,8 @@ def show_hosts(folder):
# list shows more than 10 rows
if more_than_ten_items and \
(config.may("wato.edit_hosts") or config.may("wato.manage_hosts")):
- bulk_actions(at_least_one_imported, True, colspan, "even")
+ bulk_actions(at_least_one_imported, True, True, colspan, "even")
+ search_shown = True
# Header line
html.write("<tr><th class=left></th><th>"+_("Actions")+"</th><th>"
@@ -1361,7 +1364,7 @@ def show_hosts(folder):
html.write("</tr>\n")
if config.may("wato.edit_hosts") or config.may("wato.manage_hosts"):
- bulk_actions(at_least_one_imported, False, colspan, odd)
+ bulk_actions(at_least_one_imported, False, not search_shown, colspan, odd)
html.write("</table>\n")
html.hidden_fields()