when a combobox was editable, a click inside did not open the picker,
but it would if the combobox was not editable.
Since this is
1. Inconsistent
2. Inconvenient (the user has to specifically press the arrow)
we already had this implemented for our ComboGrid, but not for
regular comboboxes
This patch moves the code for this to an override for ComboBox, which
our ComboGrid then inherits (so we do not need it there anymore)
while at it, do some non-significant code-cleanup
* whitespace fixes
* don't shadow 'me' in the focus callback
* fix typo in comment
Originally this was implemented in pve-manager, commit
851c032d69ad5ae23725dd1add9e4084ebc12650
https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=851c032d69ad5ae23725dd1add9e4084ebc12650
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Originally-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Used in "Add USB to VM" dialog for example.
This was broken before 15206214d9 "ComboGrid: fix on-load validation for blank
values" (only the one you enabled first was validated, the other always showed
as valid), and afterwards too, but in a different way (both are now immediately
marked invalid until you select and unselect them) - which is how I noticed.
With this the validation now works correctly.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Commit f32aa3df74 fixed marking multi-select fields with where the store
did not contain a valid value after loading.
However, it introduced a bug for single-select fields where the value
(before the store-load) was explicitly set to be empty (when that should
be invalid because of allowBlank === false).
Fix the logic to correctly detect all scenarios (with def being the
value selected before the store loaded, i.e. undefined or an empty
array):
!allowBlank &&
( def is an array but empty || def is not an array and falsy )
Also use correct error message (localized by ExtJS itself).
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
in fields with 'multiSelect: true', we get an array as value instead
of a string, but a check of !![] results in true (since an array
is an object), so we have to explicitely check for arraylength
in 'setValue' (for correctly showing the trigger) and in the
load handler (to not set an empty field wrongfully to invalid)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
on multiSelect we have to check the values that is in the values
array, but we get the 'displaystring' in the validator so we
have to get the 'real' value (aka the underlying array of values)
before checking if they are in the store
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Prevent the comboBox from displaying a validation error although
forceSelection is true. If you change a valid selection by removing
characters manually and click somewhere else, the comboBox restores
the selection with the previous value. The validation logic then
checked the restored value, but couldn't find it in the store,
because the store is still filtered with the erroneous query.
We now clear the local filter before the actual check to prevent
this.
[Thomas]:
This was fixed in the 6.2 based GPL release of ExtJS, and can be seen
as backport.
Signed-off-by: Tim Marx <t.marx@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
when we have a combogrid that may be empty, we now show a
little 'x' where the user can delete the content
this is not shown when the field is not allowed to be empty
we add a new css for this because triggers need a background image
with a very specific layout:
110x22px which is 5 icons in one image for the various states
(normal, hover, active, focused, focused hover)
the icon is taken from the theme-crisp
form/tag-field-item-close.png but rearranged to fit the size
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
We can often run into situations where a value set in the past is not
valid anymore. An example could be a deleted network bridge, e.g., we
set the vNIC of a VM to 'vmbr1' but then we decide to obsolete that
and delete that one, one would now expect that the field gets marked
as invalid when editing the VM's vNIC, so add that behavior.
As sometimes this can be valid and wanted behavior (e.g., usb
passthrough, which is hot-pluggable), also add a switch do restore
the old behavior.
Note that the empty value is not handled by this change, we let the
existing "allowBlank" config switch handle that one.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
as else one lies to the user and only creates strange behavior,
one should see the values even if not there anymore, if this is a
invalid state is left for a later patch.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
port commit
851c032d69ad5ae23725dd1add9e4084ebc12650
from pve-manager
commit message:
ComboBoxes provided by UI frameworks normally show their selection
possibilities once focused, ExtJS does this too but not on editable
(and thus filterable) input fields. Add a logic which allows this too
and streamlines the behavior of ComboGrid/Box like components.
To avoid a glitch, where clicking the "picker trigger" (the down
arrow which normally toggles the selection picker) would first focus
the element - thus expanding it - and only then causing a toggle
which collapses it again, we overwrite the 'Ext.form.trigger.Trigger'
onMouseDown so that we can skip a expansion on this event.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
port commit
bff876ecb5f3388b7d65c491680b9a40574e4744
from pve-manager
commit message:
This allows child classes to use another default, the initialConfig
didn't allowed that.
This is also the ExtJS like way to set defaults.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>