Module: check_mk
Branch: master
Commit: fb78f3944a9a43f7b52a32e2931bf1e284c8c041
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb78f3944a9a43…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Aug 31 09:56:58 2018 +0200
6519 FIX Fixed unselecting items from dual list choice via double click
It was possible to select items in dual list choices elements (like like network interface
types),
but not possible to unselect them in the same way.
Change-Id: I0f63f5661babf5c05b9d1133ed3582ff2dedae83
---
.werks/6519 | 12 ++++++++++++
cmk/gui/valuespec.py | 37 +++++++++++++++++--------------------
2 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/.werks/6519 b/.werks/6519
new file mode 100644
index 0000000..a571a28
--- /dev/null
+++ b/.werks/6519
@@ -0,0 +1,12 @@
+Title: Fixed unselecting items from dual list choice via double click
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535702157
+
+It was possible to select items in dual list choices elements (like like network
interface types),
+but not possible to unselect them in the same way.
diff --git a/cmk/gui/valuespec.py b/cmk/gui/valuespec.py
index 858c463..349aa32 100644
--- a/cmk/gui/valuespec.py
+++ b/cmk/gui/valuespec.py
@@ -2235,7 +2235,7 @@ class DualListChoice(ListChoice):
unselected.append(e)
select_func = 'vs_duallist_switch(\'unselected\', \'%s\',
%d);' % (varprefix, 1 if self._custom_order else 0)
- unselect_func = 'vs_duallist_switch(\'selected\', \'%s\',
1);' % varprefix
+ unselect_func = 'vs_duallist_switch(\'selected\', \'%s\',
%d);' % (varprefix, 1 if self._custom_order else 0)
html.open_table(class_=["vs_duallist"], style = "width:
%dpx;" % (self._size * 6.4) if self._size else None)
@@ -2253,28 +2253,25 @@ class DualListChoice(ListChoice):
html.close_td()
html.close_tr()
- onchange_unselected = select_func if self._instant_add else ''
- onchange_selected = unselect_func if self._instant_add else ''
- if self._enlarge_active:
- onchange_selected = 'vs_duallist_enlarge(\'selected\',
\'%s\');' % varprefix
- onchange_unselected = 'vs_duallist_enlarge(\'unselected\',
\'%s\');' % varprefix
+ html.open_tr()
+ for suffix, choices, select_func in [
+ ("unselected", unselected, select_func),
+ ("selected", selected, unselect_func), ]:
- attrs = {
- 'multiple' : 'multiple',
- 'style' : 'height:auto' if self._autoheight else
"height: %dpx" % (self._rows * 16),
- 'ondblclick' : select_func if not self._instant_add else '',
- }
+ onchange_func = select_func if self._instant_add else ''
+ if self._enlarge_active:
+ onchange_func = 'vs_duallist_enlarge(\'%s\',
\'%s\');' % (suffix, varprefix)
- html.open_tr()
- html.open_td()
- attrs["onchange"] = onchange_unselected
- html.multi_select(varprefix + '_unselected', unselected,
deflt='', sorted=self._custom_order, **attrs)
- html.close_td()
+ attrs = {
+ 'multiple' : 'multiple',
+ 'style' : 'height:auto' if self._autoheight else
"height: %dpx" % (self._rows * 16),
+ 'ondblclick' : select_func if not self._instant_add else
'',
+ }
- html.open_td()
- attrs["onchange"] = onchange_selected
- html.multi_select(varprefix + '_selected', selected, deflt='',
sorted=self._custom_order, **attrs)
- html.close_td()
+ html.open_td()
+ attrs["onchange"] = onchange_func
+ html.multi_select("%s_%s" % (varprefix, suffix), choices,
deflt='', sorted=self._custom_order, **attrs)
+ html.close_td()
html.close_tr()
html.close_table()