Module: check_mk
Branch: master
Commit: 67f0f78431a20cb446cde4b985d9f38ecf4d700d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=67f0f78431a20c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 17:04:23 2018 +0200
5982 FIX BI: Only show bulk move action when targets are available
Change-Id: Ie333e84920d6ac0ecee878e4150e6075c7adc57d
---
.werks/5982 | 11 +++++++++++
web/plugins/wato/bi.py | 38 ++++++++++++++++++++++----------------
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/.werks/5982 b/.werks/5982
new file mode 100644
index 0000000..e7f5e12
--- /dev/null
+++ b/.werks/5982
@@ -0,0 +1,11 @@
+Title: BI: Only show bulk move action when targets are available
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1523891040
+
+
diff --git a/web/plugins/wato/bi.py b/web/plugins/wato/bi.py
index 88bbd64..5ba2cbf 100644
--- a/web/plugins/wato/bi.py
+++ b/web/plugins/wato/bi.py
@@ -1218,16 +1218,19 @@ class ModeBIAggregations(ModeBI):
if self._pack["aggregations"]:
fieldstyle = "margin-top:10px"
html.button("_bulk_delete_bi_aggregations", _("Bulk
delete"), "submit", style=fieldstyle)
- html.button("_bulk_move_bi_aggregations", _("Bulk
move"), "submit", style=fieldstyle)
- if html.has_var('bulk_moveto'):
- html.javascript('update_bulk_moveto("%s")' %
html.var('bulk_moveto', ''))
-
- choices = [ (pack_id, attrs["title"]) for pack_id, attrs in
self._packs.items()
+ move_choices = [ (pack_id, attrs["title"]) for pack_id, attrs in
self._packs.items()
if pack_id is not self._pack["id"] and
self.is_contact_for_pack(attrs) ]
- html.select("bulk_moveto", choices, "@",
- onchange = "update_bulk_moveto(this.value)",
- attrs = {'class': 'bulk_moveto',
'style': fieldstyle})
+
+ if move_choices:
+ html.button("_bulk_move_bi_aggregations", _("Bulk
move"), "submit", style=fieldstyle)
+
+ if html.has_var('bulk_moveto'):
+ html.javascript('update_bulk_moveto("%s")' %
html.var('bulk_moveto', ''))
+
+ html.select("bulk_moveto", move_choices, "@",
+ onchange = "update_bulk_moveto(this.value)",
+ attrs = {'class': 'bulk_moveto',
'style': fieldstyle})
html.end_form()
@@ -1432,16 +1435,19 @@ class ModeBIRules(ModeBI):
if self._pack["rules"]:
fieldstyle = "margin-top:10px"
html.button("_bulk_delete_bi_rules", _("Bulk delete"),
"submit", style=fieldstyle)
- html.button("_bulk_move_bi_rules", _("Bulk move"),
"submit", style=fieldstyle)
- if html.has_var('bulk_moveto'):
- html.javascript('update_bulk_moveto("%s")' %
html.var('bulk_moveto', ''))
-
- choices = [ (pack_id, attrs["title"]) for pack_id, attrs in
self._packs.items()
+ move_choices = [ (pack_id, attrs["title"]) for pack_id, attrs in
self._packs.items()
if pack_id is not self._pack["id"] and
self.is_contact_for_pack(attrs) ]
- html.select("bulk_moveto", choices, "@",
- onchange = "update_bulk_moveto(this.value)",
- attrs = {'class': 'bulk_moveto',
'style': fieldstyle})
+
+ if move_choices:
+ html.button("_bulk_move_bi_rules", _("Bulk move"),
"submit", style=fieldstyle)
+
+ if html.has_var('bulk_moveto'):
+ html.javascript('update_bulk_moveto("%s")' %
html.var('bulk_moveto', ''))
+
+ html.select("bulk_moveto", move_choices, "@",
+ onchange = "update_bulk_moveto(this.value)",
+ attrs = {'class': 'bulk_moveto',
'style': fieldstyle})
html.end_form()