Module: check_mk
Branch: master
Commit: a80a77ae11207f86b46667458acbf2d99e668956
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a80a77ae11207f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri May 18 15:41:55 2012 +0200
Splitup host search in two modes
---
ChangeLog | 1 +
web/htdocs/wato.py | 76 ++++++++++++++++++++++++++++------------------------
2 files changed, 42 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a411f84..b44149d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* Added automation_commands to make automations pluginable
* New layout and new internal implementation of input forms
* New layout for view overview and view editor
+ * Split up host search in two distinct pages
* FIX: fix parent scan on single site installations
* FIX: fix folder visibility permission handling
* FIX: honor folder-permissions when creating, deleting
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2b4b37a..fbdad5b 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2155,54 +2155,59 @@ def show_service_table(host, firsttime):
def mode_search(phase):
if phase == "title":
- return _("Search for hosts in %s and below" %
(g_folder["title"]))
+ return _("Search for hosts")
elif phase == "buttons":
+ global_buttons()
html.context_button(_("Folder"), make_link([("mode",
"folder")]), "back")
+ return
elif phase == "action":
- pass
+ return "search_results"
- else:
- render_folder_path()
+ render_folder_path()
- html.write("<table><tr><td>")
- ## # Show search form
- html.begin_form("search")
- forms.header(_("General Properties"))
- forms.section(_("Hostname"))
- html.text_input("host")
- html.set_focus("host")
+ ## # Show search form
+ html.begin_form("search")
+ forms.header(_("General Properties"))
+ forms.section(_("Hostname"))
+ html.text_input("host")
+ html.set_focus("host")
- # Attributes
- configure_attributes({}, "search", parent = None)
+ # Attributes
+ configure_attributes({}, "search", parent = None)
- # Button
- forms.end()
- html.button("_global", _("Search globally"),
"submit")
- html.button("_local", _("Search in %s") %
g_folder["title"], "submit")
- html.hidden_fields()
- html.end_form()
+ # Button
+ forms.end()
+ html.button("_global", _("Search globally"), "submit")
+ html.button("_local", _("Search in %s") %
g_folder["title"], "submit")
+ html.hidden_fields()
+ html.end_form()
- # Show search results
- if html.transaction_valid():
- html.write("</td><td>")
- crit = {
- ".name" : html.var("host"),
- }
- crit.update(collect_attributes(do_validate = False))
- html.write("<h3>" + _("Search results:") +
"</h3>")
- if html.has_var("_local"):
- folder = g_folder
- else:
- folder = g_root_folder
+def mode_search_results(phase):
+ if phase == "title":
+ return _("Search results")
+
+ elif phase == "buttons":
+ global_buttons()
+ html.context_button(_("New Search"), html.makeuri([("mode",
"search")]), "back")
+ return
+
+ elif phase == "action":
+ return
+
+ crit = { ".name" : html.var("host") }
+ crit.update(collect_attributes(do_validate = False))
+
+ if html.has_var("_local"):
+ folder = g_folder
+ else:
+ folder = g_root_folder
- # html.write("<pre>%s</pre>" % pprint.pformat(crit))
- if not search_hosts_in_folders(folder, crit):
- html.message(_("No matching hosts found."))
+ if not search_hosts_in_folders(folder, crit):
+ html.message(_("No matching hosts found."))
- html.write("</td></tr></table>")
@@ -11148,6 +11153,7 @@ modes = {
"firstinventory" : (["hosts", "services"], lambda
phase: mode_inventory(phase, True)),
"inventory" : (["hosts"], lambda phase:
mode_inventory(phase, False)),
"search" : (["hosts"], mode_search),
+ "search_results" : (["hosts"], mode_search_results),
"bulkinventory" : (["hosts", "services"],
mode_bulk_inventory),
"bulkedit" : (["hosts", "edit_hosts"],
mode_bulk_edit),
"bulkcleanup" : (["hosts", "edit_hosts"],
mode_bulk_cleanup),