Module: check_mk
Branch: master
Commit: 34af0447eabcaeb3de3a71a3c43950502af9026b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=34af0447eabcae…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 13 11:15:20 2013 +0100
Cleanup form for executing commands on hosts/services
---
ChangeLog | 1 +
web/htdocs/views.py | 17 ++++++++++-------
web/plugins/views/commands.py | 3 +++
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1ff0700..8319deb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
Multisite:
* FIX: Fixed several minor IE7 related layout bugs
+ * Cleanup form for executing commands on hosts/services
1.2.2b1:
Core:
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 9318519..08706ea 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2066,19 +2066,22 @@ def show_command_form(is_open, datasource):
html.hidden_field("actions", "yes")
html.hidden_fields() # set all current variables, exception action vars
# html.write('<table class="form">')
- forms.header(_("Commands"), narrow=True)
- # Commands are defined in plugins/views/commands.py. Iterate
- # over all command definitions and render HTML input fields.
+ # Show command forms, grouped by (optional) command group
+ by_group = {}
for command in multisite_commands:
if what in command["tables"] and
config.may(command["permission"]):
+ group = command.get("group", _("Various Commands"))
+ by_group.setdefault(group, []).append(command)
+
+ groups = by_group.keys()
+ groups.sort()
+ for group in groups:
+ forms.header(group, narrow=True)
+ for command in by_group[group]:
forms.section(command["title"])
- # html.write('<tr><td class=legend>%s</td>\n' %
command["title"])
- # html.write('<td class=content>')
command["render"]()
- # html.write('</td></tr>')
- # html.write("</table>")
forms.end()
html.end_form()
html.write("</div>")
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index 9aa164d..ee2930e 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -261,6 +261,7 @@ multisite_commands.append({
html.write(_("Comment") + ": ") == \
html.text_input("_ack_comment", size=48),
"action" : command_acknowledgement,
+ "group" : _("Acknowledge"),
})
@@ -450,6 +451,7 @@ multisite_commands.append({
"title" : _("Schedule downtimes"),
"render" : lambda: paint_downtime_buttons("host"),
"action" : command_downtime,
+ "group" : _("Downtimes"),
})
multisite_commands.append({
@@ -458,6 +460,7 @@ multisite_commands.append({
"title" : _("Schedule downtimes"),
"render" : lambda: paint_downtime_buttons("service"),
"action" : command_downtime,
+ "group" : _("Downtimes"),
})
# REMOVE DOWNTIMES (table downtimes)