Module: check_mk
Branch: master
Commit: 74506e53e5b91d06cfbd6ff866576198eff591c2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=74506e53e5b91d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 3 07:55:05 2016 +0200
3459 FIX Bulk edit: Fixed mixup of attributes during consecutive bulk edits
---
.werks/3459 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 11 +++++++++++
3 files changed, 22 insertions(+)
diff --git a/.werks/3459 b/.werks/3459
new file mode 100644
index 0000000..c6d7aec
--- /dev/null
+++ b/.werks/3459
@@ -0,0 +1,10 @@
+Title: Bulk edit: Fixed mixup of attributes during consecutive bulk edits
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1462254841
+
+
diff --git a/ChangeLog b/ChangeLog
index aaaf86c..0c8bf8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -338,6 +338,7 @@
* 3451 FIX: Fixed exception in host list when no local site configured
* 3457 FIX: Bulk edit: Prevent browser auto completion of stored credentials
* 3458 FIX: Bulk edit: Fixed broken unchecking of attributes after complain
+ * 3459 FIX: Bulk edit: Fixed mixup of attributes during consecutive bulk edits
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 0c15682..3759d12 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3625,6 +3625,16 @@ def mode_bulk_edit(phase):
host_names = get_hostnames_from_checkboxes()
hosts = dict([(host_name, Folder.current().host(host_name)) for host_name in
host_names])
+ current_host_hash = sha256(repr(hosts))
+
+ # When bulk edit has been made with some hosts, then other hosts have been selected
+ # and then another bulk edit has made, the attributes need to be reset before
+ # rendering the form. Otherwise the second edit will have the attributes of the
+ # first set.
+ host_hash = html.var("host_hash")
+ if not host_hash or host_hash != current_host_hash:
+ html.del_all_vars(prefix="attr_")
+ html.del_all_vars(prefix="bulk_change_")
html.write("<p>" + _("You have selected <b>%d</b>
hosts for bulk edit. You can now change "
"host attributes for all selected hosts at once. ") %
len(hosts))
@@ -3634,6 +3644,7 @@ def mode_bulk_edit(phase):
html.begin_form("edit_host", method = "POST")
html.prevent_password_auto_completion()
+ html.hidden_field("host_hash", current_host_hash)
configure_attributes(False, hosts, "bulk", parent = Folder.current())
forms.end()
html.button("_save", _("Save & Finish"))