Module: check_mk
Branch: master
Commit: 143a9867758fc81e8a312134a8c6a62b068285c4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=143a9867758fc8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Sun Dec 18 15:52:01 2016 +0100
4169 View action defaults: sticky, notification and persistent default configuration can
be set for acknownledge commands in host or service views
Change-Id: Ia72af8f0d86e9c1a3f88bd92b0a3a500c8a8aca3
---
.werks/4169 | 9 +++++++++
ChangeLog | 1 +
web/plugins/config/builtin.py | 6 ++++++
web/plugins/views/commands.py | 13 ++++++++++---
web/plugins/wato/check_mk_configuration.py | 21 +++++++++++++++++++++
5 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/.werks/4169 b/.werks/4169
new file mode 100644
index 0000000..6da270d
--- /dev/null
+++ b/.werks/4169
@@ -0,0 +1,9 @@
+Title: View action: Default values of sticky, notification and persistent options can now
be configured via global settings.
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i3
+Date: 1482072617
+Class: feature
+
+Above default values can be configured via {{View action defaults}} in {{User interface}}
in {{Global settings}}.
diff --git a/ChangeLog b/ChangeLog
index fa553b7..e6fe429 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -95,6 +95,7 @@
* 4083 Web API: Always output full traceback in case of non Check_MK unhandled
exceptions
* 4135 View CSV export: Group cells are added in front of the regular cells for each
row...
* 4136 Availability CSV export: Adding grouping title as first column in case of
grouped views
+ * 4169 View action: sticky, notification and persistent default configuration can be
set for acknownledge commands in host or service views
* 3974 FIX: Sorting comments in hover menu of comments icon by time now
* 4040 FIX: Fix error in view about "No WATO folder ..." in case of host
imported via cmcdump...
* 4046 FIX: Repaired html rendering....
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index bf5ce5d..c9b82ae 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -116,6 +116,12 @@ view_option_columns = [ 1, 2, 3, 4, 5, 6, 8, 10, 12 ]
# MISC
doculink_urlformat = "http://mathias-kettner.de/checkmk_%s.html";
+view_action_defaults = {
+ "ack_sticky" : True,
+ "ack_notify" : True,
+ "ack_persistent" : False,
+}
+
# ____ _ _ _ _
# / ___| _ ___| |_ ___ _ __ ___ | | (_)_ __ | | _____
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index cf0f0f9..d0c2f10 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -404,6 +404,7 @@ def command_acknowledgement(cmdtag, spec, row):
raise MKUserError("_ack_comment", _("You need to supply a
comment."))
if ";" in comment:
raise MKUserError("_ack_comment", _("The comment must not
contain semicolons."))
+
sticky = html.var("_ack_sticky") and 2 or 0
sendnot = html.var("_ack_notify") and 1 or 0
perscomm = html.var("_ack_persistent") and 1 or 0
@@ -449,9 +450,15 @@ multisite_commands.append({
html.button("_acknowledge", _("Acknowledge")) == \
html.button("_remove_ack", _("Remove Acknowledgement")) == \
html.hr() == \
- html.checkbox("_ack_sticky", True, label=_("sticky")) == \
- html.checkbox("_ack_notify", True, label=_("send
notification")) == \
- html.checkbox("_ack_persistent", False, label=_('persistent
comment')) == \
+ html.checkbox("_ack_sticky",
+ config.view_action_defaults["ack_sticky"],
+ label=_("sticky")) == \
+ html.checkbox("_ack_notify",
+ config.view_action_defaults["ack_notify"],
+ label=_("send notification")) == \
+ html.checkbox("_ack_persistent",
+ config.view_action_defaults["ack_persistent"],
+ label=_('persistent comment')) == \
html.hr() == \
Age(display=["days", "hours", "minutes"],
label=_("Expire acknowledgement after")).render_input("_ack_expire",
0) == \
html.help(_("Note: Expiration of acknowledgements only works when using the
Check_MK Micro Core.")) == \
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index e7cb51b..f5c73a8 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -718,6 +718,27 @@ register_configvar(group,
domain = "multisite"
)
+register_configvar(group,
+ "view_action_defaults",
+ Dictionary(
+ title = _("View action defaults"),
+ elements = [
+ ("ack_sticky", Checkbox(
+ title = _("Sticky"), label = _("Enable"),
default_value = True,
+ )),
+ ("ack_notify", Checkbox(
+ title = _("Send notification"), label = _("Enable"),
default_value = True,
+ )),
+ ("ack_persistent", Checkbox(
+ title = _("Persistent comment"), label = _("Enable"),
default_value = False,
+ )),
+ ],
+ optional_keys = [],
+ ),
+ domain = "multisite"
+)
+
+
#.
# .--WATO----------------------------------------------------------------.
# | __ ___ _____ ___ |