Module: check_mk
Branch: master
Commit: a26176762457c825eee8f3e23f2503b959d50479
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a26176762457c8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 6 17:46:12 2011 +0200
Show only selected rows during action
---
web/htdocs/views.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index e75f778..27c3205 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1359,6 +1359,9 @@ def show_view(view, show_heading = False, show_buttons = True, show_footer = Tru
# Create URI with all actions variables removed
backurl = html.makeuri([])
has_done_actions = do_actions(view, datasource["infos"][0], rows, backurl)
+ if type(has_done_actions) == list:
+ rows = has_done_actions
+ has_done_actions = False
if 'C' in display_options:
html.write("</td></tr>")
except MKUserError, e:
@@ -2170,6 +2173,11 @@ def nagios_host_service_action_command(what, dataset):
nagios_command = ("[%d] " % int(time.time())) + command + "\n"
return title, [nagios_command]
+
+# Returns:
+# True -> Actions have been done
+# False -> No actions done because now rows selected
+# [...] new rows -> Rows actions (shall/have) be performed on
def do_actions(view, what, rows, backurl):
if not config.may("act"):
html.show_error(_("You are not allowed to perform actions. If you think this is an error, "
@@ -2194,7 +2202,7 @@ def do_actions(view, what, rows, backurl):
title = nagios_action_command(what, action_rows[0])[0] # just get the title
if not html.confirm(_("Do you really want to %s the following %d %ss?") %
(title, len(action_rows), what)):
- return False # no actions done
+ return action_rows # no actions done, but show only selected rows
count = 0
for row in action_rows:
Module: check_mk
Branch: master
Commit: 96d2defbe8ddf3526701b1683c6162a22f20c979
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=96d2defbe8ddf3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 6 17:38:02 2011 +0200
Do not display any tabs during command confirmation
---
web/htdocs/views.py | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 8d64461..b3cc56d 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1260,7 +1260,8 @@ def show_view(view, show_heading = False, show_buttons = True, show_footer = Tru
if show_buttons and 'B' in display_options:
show_context_links(view, hide_filters)
- need_navi = show_buttons and (
+ need_navi = show_buttons and \
+ not html.do_actions() and (
'D' in display_options or
'F' in display_options or
'C' in display_options or
@@ -1270,13 +1271,13 @@ def show_view(view, show_heading = False, show_buttons = True, show_footer = Tru
html.write("<table class=navi><tr>\n")
# Filter-button
- if 'F' in display_options and len(show_filters) > 0 and not html.do_actions():
+ if 'F' in display_options and len(show_filters) > 0:
filter_isopen = html.var("search", "") == "" and view["mustsearch"]
toggle_button("table_filter", filter_isopen, _("Filter"), ["filter"])
html.write("<td class=minigap></td>\n")
# Command-button
- if 'C' in display_options and len(rows) > 0 and config.may("act") and not html.do_actions():
+ if 'C' in display_options and len(rows) > 0 and config.may("act"):
toggle_button("table_actions", False, _("Commands"))
html.write("<td class=minigap></td>\n")
@@ -1288,7 +1289,7 @@ def show_view(view, show_heading = False, show_buttons = True, show_footer = Tru
# Buttons for view options
if 'O' in display_options:
# Link for selecting/deselecting all rows
- if 'C' in display_options and config.may("act") and not html.do_actions() and layout["checkboxes"]:
+ if 'C' in display_options and config.may("act") and layout["checkboxes"]:
if show_checkboxes:
addclass = " selected"
title = _("Hide check boxes")
@@ -1346,7 +1347,7 @@ def show_view(view, show_heading = False, show_buttons = True, show_footer = Tru
html.write("</table><table class=navi><tr>\n")
# Filter form
- if 'F' in display_options and len(show_filters) > 0 and not html.do_actions():
+ if 'F' in display_options and len(show_filters) > 0:
show_filter_form(filter_isopen, show_filters)
# Actions
@@ -2176,7 +2177,7 @@ def do_actions(view, what, rows, backurl):
return False # no actions done
# Handle optional row filter based on row selections
- if html.var('selected_rows', '') != '':
+ if html.has_var('selected_rows'):
selected_rows = html.var('selected_rows')
action_rows = []
for row in rows: