Module: check_mk
Branch: master
Commit: 7aa633cbd191d7e7b7b6008869825d1ec9763348
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7aa633cbd191d7…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Oct 8 15:23:50 2012 +0200
New feature of hiding certain actions from the commands in the status GUI
---
ChangeLog | 1 +
mkeventd/web/htdocs/mkeventd.py | 5 +++--
mkeventd/web/plugins/views/mkeventd.py | 4 ++--
mkeventd/web/plugins/wato/mkeventd.py | 9 +++++++++
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 765d398..f6ab0b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
* Moved source of Event Console into Check_MK project
* New button for resetting all rule hits counters
* When saving a rule then its hits counter is always reset
+ * New feature of hiding certain actions from the commands in the status GUI
Multisite:
* Enable automation login with _username= and _secret=, while
diff --git a/mkeventd/web/htdocs/mkeventd.py b/mkeventd/web/htdocs/mkeventd.py
index 7868eb9..6994caa 100644
--- a/mkeventd/web/htdocs/mkeventd.py
+++ b/mkeventd/web/htdocs/mkeventd.py
@@ -66,13 +66,14 @@ def service_levels():
except:
return [(0, "(no service level)")]
-def action_choices():
+def action_choices(omit_hidden = False):
# The possible actions are configured in mkeventd.mk,
# not in multisite.mk (like the service levels). That
# way we have not direct access to them but need
# to load them from the configuration.
return [ (a["id"], a["title"])
- for a in eventd_configuration().get("actions", []) ]
+ for a in eventd_configuration().get("actions", [])
+ if not omit_hidden or not a.get("hidden") ]
cached_config = None
def eventd_configuration():
diff --git a/mkeventd/web/plugins/views/mkeventd.py
b/mkeventd/web/plugins/views/mkeventd.py
index de458c6..c8c0873 100644
--- a/mkeventd/web/plugins/views/mkeventd.py
+++ b/mkeventd/web/plugins/views/mkeventd.py
@@ -639,12 +639,12 @@ if mkeventd_enabled:
[ "user", "admin" ])
def render_mkeventd_actions():
- for action_id, title in mkeventd.action_choices():
+ for action_id, title in mkeventd.action_choices(omit_hidden = True):
html.button("_action_" + action_id, title)
html.write("<br>")
def command_mkeventd_action(cmdtag, spec, row):
- for action_id, title in mkeventd.action_choices():
+ for action_id, title in mkeventd.action_choices(omit_hidden = True):
if html.var("_action_" + action_id):
return "ACTION;%s;%s;%s" % (row["event_id"],
config.user_id, action_id), \
(_("execute that action "%s"") % title)
diff --git a/mkeventd/web/plugins/wato/mkeventd.py
b/mkeventd/web/plugins/wato/mkeventd.py
index 84a5fc2..0ba0fa1 100644
--- a/mkeventd/web/plugins/wato/mkeventd.py
+++ b/mkeventd/web/plugins/wato/mkeventd.py
@@ -103,6 +103,15 @@ vs_mkeventd_actions = \
label = _("Current disable execution of this action"),
)
),
+ ( "hidden",
+ Checkbox(
+ title = _("Hide from Status GUI"),
+ label = _("Do not offer this action as a command on open
events"),
+ help = _("If you enabled this option, then this action will
not "
+ "be available as an interactive user command. It is
usable "
+ "as an ad-hoc action when a rule fires,
nevertheless."),
+ ),
+ ),
( "action",
CascadingDropdown(
title = _("Type of Action"),