fixed exception during bulk delete
Message-ID: <5c0e7185.7QdN+raKzT59NkQ1%ab(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 53c5d0c38c6fae968186f43363e4e72003632d50
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=53c5d0c38c6faeā¦
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Dec 10 14:50:20 2018 +0100
added WK6696: BI configuration: Fixed invalid 'Used by' link, fixed exception
during bulk delete
Change-Id: I1d83695fd3d63bfdd0255108b4682ff04d23867b
---
.werks/6696 | 11 +++++++++++
cmk/gui/plugins/wato/bi.py | 11 ++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.werks/6696 b/.werks/6696
new file mode 100644
index 0000000..2aa5fb3
--- /dev/null
+++ b/.werks/6696
@@ -0,0 +1,11 @@
+Title: BI configuration: Fixed invalid "Used by" link, fixed exception during
bulk delete
+Level: 1
+Component: bi
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1544169193
+
+
diff --git a/cmk/gui/plugins/wato/bi.py b/cmk/gui/plugins/wato/bi.py
index dfdb545..9fa5449 100644
--- a/cmk/gui/plugins/wato/bi.py
+++ b/cmk/gui/plugins/wato/bi.py
@@ -412,13 +412,14 @@ class BIManagement(object):
def find_aggregation_rule_usages(self):
aggregations_that_use_rule = {}
- for pack in self._packs.itervalues():
+ for pack_id, pack in self._packs.iteritems():
for aggr_id, aggregation in enumerate(pack["aggregations"]):
rule_id, _description =
self.rule_called_by_node(aggregation["node"])
- aggregations_that_use_rule.setdefault(rule_id, []).append((aggr_id,
aggregation))
+ aggregations_that_use_rule.setdefault(rule_id, []).append((pack_id,
aggr_id,
+ aggregation))
sub_rule_ids = self._aggregation_recursive_sub_rule_ids(rule_id)
for sub_rule_id in sub_rule_ids:
- aggregations_that_use_rule.setdefault(sub_rule_id,
[]).append((aggr_id,
+ aggregations_that_use_rule.setdefault(sub_rule_id,
[]).append((pack_id, aggr_id,
aggregation))
return aggregations_that_use_rule
@@ -1200,7 +1201,7 @@ class ModeBIAggregations(ModeBI):
return ""
def _bulk_delete_after_confirm(self):
- selection = map(int, self._get_selection("aggregation"))
+ selection = sorted(map(int, self._get_selection("aggregation")))
if selection:
c = wato_confirm(_("Confirm deletion of %d aggregations") % \
len(selection),
@@ -1575,7 +1576,7 @@ class ModeBIRules(ModeBI):
table.text_cell(_("Nodes"), len(rule["nodes"]),
css="number")
table.cell(_("Used by"))
have_this = set([])
- for (aggr_id, aggregation) in aggregations_that_use_rule.get(rule_id,
[]):
+ for (pack_id, aggr_id, aggregation) in
aggregations_that_use_rule.get(rule_id, []):
if aggr_id not in have_this:
pack = self.pack_containing_rule(rule_id)
aggr_url = html.makeuri_contextless([("mode",
"bi_edit_aggregation"),