Module: check_mk
Branch: master
Commit: d20872d8e3566a99a141a8d0a290de14d12e58d8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d20872d8e3566a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 5 15:53:23 2018 +0100
5888 FIX Fixed non working quick search redirect when "Buffered HTTP stream" is
off
Change-Id: Ia0681ab8e1c3db20ddc008aea2195af01b753d2c
---
.werks/5888 | 10 ++++++++++
web/htdocs/sidebar.py | 24 +++++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/.werks/5888 b/.werks/5888
new file mode 100644
index 0000000..0226b10
--- /dev/null
+++ b/.werks/5888
@@ -0,0 +1,10 @@
+Title: Fixed non working quick search redirect when "Buffered HTTP stream" is
off
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1520261523
+Class: fix
+
+
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 86d5b63..b1028fb 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -695,7 +695,8 @@ def search_open():
url = generate_search_results(q)
html.http_redirect(url)
-
+class TooManyRowsError(MKException):
+ pass
class LivestatusSearchBase(object):
def _build_url(self, url_params, restore_regex = False):
@@ -987,13 +988,20 @@ class LivestatusQuicksearch(LivestatusSearchBase):
def generate_dropdown_results(self):
- self._query_data()
+ try:
+ self._query_data()
+ except TooManyRowsError, e:
+ html.show_warning(e)
+
self._evaluate_results()
self._render_dropdown_elements()
def generate_search_url(self):
- self._query_data()
+ try:
+ self._query_data()
+ except TooManyRowsError:
+ pass
# Generate a search page for the topmost search_object with results
url_params = []
@@ -1047,7 +1055,6 @@ class LivestatusQuicksearch(LivestatusSearchBase):
# Collect the raw data from livestatus
def _conduct_search(self):
- too_much_rows = False
total_rows = 0
for idx, search_object in enumerate(self._search_objects):
search_object.do_query()
@@ -1055,12 +1062,10 @@ class LivestatusQuicksearch(LivestatusSearchBase):
if total_rows > config.quicksearch_dropdown_limit:
search_object.remove_rows_from_end(total_rows -
config.quicksearch_dropdown_limit)
- too_much_rows = True
- break
+ raise TooManyRowsError(_("More than %d results") %
config.quicksearch_dropdown_limit)
if search_object.row_limit_exceeded():
- too_much_rows = True
- break
+ raise TooManyRowsError(_("More than %d results") %
config.quicksearch_dropdown_limit)
if search_object.num_rows() > 0 and search_object.get_filter_behaviour()
!= "continue":
if search_object.get_filter_behaviour() ==
"finished_distinct":
@@ -1069,9 +1074,6 @@ class LivestatusQuicksearch(LivestatusSearchBase):
self._search_objects[i].remove_rows_from_end(config.quicksearch_dropdown_limit)
break
- if too_much_rows:
- html.show_warning(_("More than %d results") %
config.quicksearch_dropdown_limit)
-
# Generates elements out of the raw data
def _evaluate_results(self):