Module: check_mk
Branch: master
Commit: b24d42d04382d848e10929df605e7b8b8a8a312a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b24d42d04382d8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 10 09:38:32 2015 +0200
New global setting for adding custom icons/actions
---
web/plugins/config/builtin.py | 3 ++
web/plugins/wato/check_mk_configuration.py | 42 ++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index ff72a15..5d46543 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -245,6 +245,9 @@ password_policy = {}
user_localizations = default_user_localizations
+# Contains user specified icons and actions for hosts and services
+user_icons_and_actions = {}
+
# Write WATO folder permissions to auth.php file
export_folder_permissions = False
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index f368f48..207d6ff 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -466,6 +466,48 @@ register_configvar(group,
domain = "multisite",
)
+register_configvar(group,
+ "user_icons_and_actions",
+ Transform(
+ ListOf(
+ Tuple(
+ elements = [
+ ID(title = _("Ident")),
+ Dictionary(
+ elements = [
+ ('icon', IconSelector(title = _('Icon'))),
+ ('title', TextUnicode(title = _('Title'))),
+ ('url', TextAscii(
+ title = _('Action URL'),
+ help = _('This URL is opened when clicking on the
action / icon. You '
+ 'can use some macros within the URL which
are dynamically '
+ 'replaced for each object. These
are:<br><br>'
+ '<li><ul>$HOSTNAME$: Contains
the name of the host</ul>'
+ '<ul>$SERVICEDESC$: Contains the
service description '
+ '(in case this is a
service)</ul>'
+ '<ul>$HOSTADDRESS$: Contains the
network address of the host</ul>'),
+ )),
+ ('toplevel', FixedValue(True,
+ title = _('Show in column'),
+ totext = _('Directly show the action icon in the
column'),
+ help = _('Makes the icon appear in the column instead
'
+ 'of the dropdown menu.'),
+ ))
+ ],
+ optional_keys = ['title', 'url',
'toplevel'],
+ ),
+ ],
+ ),
+ title = _("Custom icons and actions"),
+ movable = False,
+ totext = _("%d icons and actions"),
+ ),
+ forth = lambda d: sorted(d.items()),
+ back = lambda l: dict(l),
+ ),
+ domain = "multisite",
+)
+
# Helper that retrieves the list of hostgroups via Livestatus
# use alias by default but fallback to name if no alias defined
def list_hostgroups():