Module: check_mk
Branch: master
Commit: 9e2a1019333653deb306fdbaef53db2c6080fca1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9e2a1019333653…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Aug 10 15:14:50 2016 +0200
3561 FIX Removing a comment now also removes any linked acknowledgements
Deleting a comment which is linked to an acknowledgment now
also removes the corresponding acknowledgement.
Previously there could be acknowledgements without any comments.
---
.werks/3561 | 12 ++++++++++++
ChangeLog | 1 +
web/plugins/views/commands.py | 17 +++++++++++++++--
web/plugins/views/datasources.py | 2 +-
4 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/.werks/3561 b/.werks/3561
new file mode 100644
index 0000000..2900c3d
--- /dev/null
+++ b/.werks/3561
@@ -0,0 +1,12 @@
+Title: Removing a comment now also removes any linked acknowledgements
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i1
+Date: 1470834520
+Class: fix
+
+Deleting a comment which is linked to an acknowledgment now
+also removes the corresponding acknowledgement.
+
+Previously there could be acknowledgements without any comments.
diff --git a/ChangeLog b/ChangeLog
index 9a65d47..e376a15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -426,6 +426,7 @@
* 3730 FIX: Improved GUI performance in case of different languages used by users...
* 3753 FIX: Fixed graph hover popup of services having special characters in their
names
* 3758 FIX: Fixed wrong sorting of events in main dashboard in distributed
environments
+ * 3561 FIX: Removing a comment now also removes any linked acknowledgements...
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index 5a26683..434dc0f 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -781,13 +781,26 @@ multisite_commands.append({
})
# REMOVE COMMENTS (table comments)
+
+def remove_comments(cmdtag, spec, row):
+ if html.has_var("_remove_comments"):
+ commands = [("DEL_%s_COMMENT;%d" % (cmdtag, spec))]
+ if row.get("comment_entry_type") == 4:
+ if row.get("service_description"):
+ commands.append(("REMOVE_%s_ACKNOWLEDGEMENT;%s;%s" %\
+ (cmdtag, row["host_name"],
row["service_description"])))
+ else:
+ commands.append(("REMOVE_%s_ACKNOWLEDGEMENT;%s" %\
+ (cmdtag, row["host_name"])))
+
+ return commands, _("remove")
+
multisite_commands.append({
"tables" : [ "comment" ],
"permission" : "action.addcomment",
"title" : _("Remove comments"),
"render" : lambda: html.button("_remove_comments",
_("Remove")),
- "action" : lambda cmdtag, spec, row:
html.has_var("_remove_comments") and \
- ( "DEL_%s_COMMENT;%d" % (cmdtag, spec),
_("remove"))
+ "action" : remove_comments
})
#.
diff --git a/web/plugins/views/datasources.py b/web/plugins/views/datasources.py
index 465b9b6..eb03361 100644
--- a/web/plugins/views/datasources.py
+++ b/web/plugins/views/datasources.py
@@ -188,7 +188,7 @@ multisite_datasources["comments"] = {
"title" : _("Host- and Servicecomments"),
"table" : "comments",
"infos" : [ "comment", "host", "service"
],
- "keys" : [ "comment_id", "comment_type" ],
+ "keys" : [ "comment_id", "comment_type",
"host_name", "service_description" ],
"idkeys" : [ "comment_id" ],
}