Module: check_mk
Branch: master
Commit: 183e54efda683946228dcfeee8c5a7313af2520c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=183e54efda6839…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 13 13:38:35 2014 +0100
werk 561: made quicksearch function with multiple filters more stable
---
web/htdocs/sidebar.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 116c170..7915376 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -714,15 +714,16 @@ def plugin_matches_filters(plugin, used_filters):
def search_url_tmpl(used_filters, row, exact = True):
if not row:
- # try to find the first plugin matching the used_filters
- for entry in search_plugins:
- if plugin_matches_filters(entry, used_filters):
- plugin = entry
- row_options = {}
- row_data = {}
- break
- else:
- return "" # Shouldn't happen...
+ def find_plugin(filters):
+ for entry in search_plugins:
+ if plugin_matches_filters(entry, filters):
+ return entry, {}, {}
+ return None, None, None
+ plugin, row_options, row_data = find_plugin(used_filters)
+ if not plugin: # find a plugin for the first used filter
+ plugin, row_options, row_data = find_plugin([used_filters[0]])
+ if not plugin:
+ return "" # shouldn't happen..
else:
plugin, row_options, row_data = row