Module: check_mk
Branch: master
Commit: 2ad67c3754f9a779e682fc6e3a5f7cd1c041534e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ad67c3754f9a7…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 2 12:01:25 2017 +0100
update for #4452
Change-Id: Ieeef5f9cf4b006470db9314c0a418b33dc7fa5d3
---
.werks/4452 | 7 +++++++
web/htdocs/sidebar.py | 49 +++++++++++++++++++++++++++++++------------------
2 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/.werks/4452 b/.werks/4452
index bb36ca9..96c2171 100644
--- a/.werks/4452
+++ b/.werks/4452
@@ -28,3 +28,10 @@ in the default search
Additionally, you can modify the matching behaviour for a specific filter.
When a match is found you can continue the search, abort the search and show all results
or abort the search and show only the results for the current filter.
+
+
+Search (magnifying glass) behaviour: If there are multiple topics shown in the
+dropdown result, the topmost topic is shown in the resulting page, since not
+all topics can be combined effectiviely.
+Keep in mind that you can configure the topic ordering in the global settings.
+
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 9186a0d..49cc064 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -897,6 +897,28 @@ class LivestatusSearchConductor(object):
} [self._livestatus_table]
+ def get_search_url(self):
+ exact_match = self.num_rows() == 1
+ target_view = self._get_target_view(exact_match = exact_match)
+
+ url_params = []
+ for plugin in self._used_search_plugins:
+ match_info = plugin.get_matches(target_view,
+ exact_match and self._rows[0] or None,
+ self._livestatus_table,
+ self._used_filters,
+ rows = self._rows)
+ if not match_info:
+ continue
+ text, url_filters = match_info
+ url_params.extend(url_filters)
+
+ return html.makeuri([("view_name", target_view),
+ ("filled_in", "filter")] + url_params,
+ delvars = "q",
+ filename = "view.py")
+
+
def create_result_elements(self):
self._elements = []
if not self._rows:
@@ -1015,25 +1037,16 @@ class LivestatusQuicksearch(object):
def generate_search_url(self):
self._query_data()
- exact_match = len(self._rows) == 1
- target_view = self._get_target_view(exact_match = exact_match)
-
- url_params = []
- for plugin in self._used_search_plugins:
- match_info = plugin.get_matches(target_view,
- exact_match and self._rows[0] or None,
- self._livestatus_table,
- self._used_filters,
- rows = self._rows)
- if not match_info:
- continue
- text, url_filters = match_info
- url_params.extend(url_filters)
+ # Generate a search page for the topmost search_object with results
+ search_object = None
+ for search_object in self._search_objects:
+ if search_object.num_rows() > 0:
+ use_search_object = search_object
+ break
+ else:
+ return
- return html.makeuri([("view_name", target_view),
- ("filled_in", "filter")] + url_params,
- delvars = "q",
- filename = "view.py")
+ return search_object.get_search_url()
def _query_data(self):