Thomas Lamprecht [Sat, 18 Apr 2020 17:10:12 +0000 (19:10 +0200)]
button: don't auto set selection model if explicitly set to false
while one could use `selModel: null` to achieve this it feels really
weird that `selModel: false` could result in a selection model being
auto searched and set
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
in some cases, we provide a config with interval set to 'undefined',
which gets happily applied to the config, but gets interpreted as '0'
when actually starting the task, resulting in constant api requests
In a more schematic way, as it can now be controlled by either our
CBind mixin or ExtJS native data binding.
Use a Field container to add both, they editable and they display,
variants of a form field. As default use "textfield" for the editable
and "displayfield" xtype for the read only one.
Pass all but the editConfig and editable members of our initial
config to the display field, allow further to configure the editable
field with an editConfig object, which overwrites the config
properties inherited from the displayConfig/parent config.
This gives full control while not enforcing to specify anything extra
for most default cases.
Enforce initial state of the fields even if the databinding would
handle it to avoid glitches after first render for simple boolean expression
cases.
Here, cbind could also be a bind or a native boolean expression.
For something else than a texfield one would use the editConfig, e.g.:
> {
> ....
> editConfig: {
> xtype: 'pveUserSelector',
> allowBlank: false,
> },
> },
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
update store: move store parameter into config, use getter/setter
this allows to drop setting the default values and ensures that when
interval is updated it actually effects the used update frequency.
Anything which was saved in "me" before, for example me.autoStart, is
still there and gets also updated on a me.setIsStopped(), so there
should be no effects on code using internals.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Thomas Lamprecht [Tue, 31 Mar 2020 12:50:34 +0000 (14:50 +0200)]
form: add Proxmox.form.field.ExpireDate
Behaves like a 'datefield' but treats the 0/empty value as "never",
and sets all defaults for behaving like one would expect from a date
expire field.
This allows to replaces hacks (e.g. [0]) from our various expire date
fields, mostly in PVE/PMG user accounts, and also for the soon to be
applied API token gui.
Stefan Reiter [Mon, 3 Feb 2020 14:14:42 +0000 (15:14 +0100)]
ComboGrid: fix validation for !allowBlank disabled fields
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>
Thomas Lamprecht [Thu, 30 Jan 2020 16:36:43 +0000 (17:36 +0100)]
net/node: add some "hint" for VLAN add window
The three naming schemes are not ideal, but well here we are for now.
Add some hint to explain what one can do with which version - try to
keep it rather short. It's not ideal but hopefully better than
nothing :)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Stefan Reiter [Wed, 29 Jan 2020 10:27:18 +0000 (11:27 +0100)]
ComboGrid: fix on-load validation for blank values
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>
Thomas Lamprecht [Thu, 23 Jan 2020 12:42:02 +0000 (13:42 +0100)]
mixin cbind: avoid undefined cbindData access
Else we can fail at the first fallback check in getConfigValue while
we still have the possibility to have the cbinded key available in
"me" (initial config).
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Dominik Csapak [Mon, 25 Nov 2019 10:04:57 +0000 (11:04 +0100)]
ComboGrid: correctly set/mark multiSelect fields
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)
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
Tim Marx [Fri, 25 Oct 2019 11:06:08 +0000 (13:06 +0200)]
fix comboBox validation when forceSelection is true
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>
The StdRemoveButton can now pass a delay parameter to the API.
It is set undefined as default so that users of the button
can set the parameter themselves.
Thomas Lamprecht [Thu, 18 Jul 2019 13:55:37 +0000 (15:55 +0200)]
combogrid: add handling for historic set values currently not available
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>
Thomas Lamprecht [Wed, 17 Jul 2019 14:17:55 +0000 (16:17 +0200)]
combogrid: always set the initial value, even if not found
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>
override Ext.Components 'validIdRe' to include '@'
we use itemIds with '@' already in the ceph dashboard, and in
non-debug modeit works (as expected) but throws an error
while using ext-all-debug.js so override it to include the '@'
the regex was in place because in html4 the 'id' tag could only consist
letters ofthe mentioned regex, this was lifted in html5 though[0]
Thomas Lamprecht [Wed, 12 Jun 2019 09:46:20 +0000 (11:46 +0200)]
followup: network selector: reorder columns and adapt widths
and use format_boolean to render the active column
also hide the type column by default, it often is not too important,
and can be derived from the interface name, e.g., vmbrX -> bridge,
bondX -> bond, etc.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
node/apt updates: show full package description conditionally
The full package description is often quite long, and for upgrades
it's not relevant most of the time. But, it can be intresting to
have, if one wonders what a package is even used for.
So add a checkbox in the top bar which allows to switch between
showing and hiding the description, simply done by re-using the
'grid-row-body-hidden' ExtJS CSS class (got the idea from the
RowBody feature source code).
Default it to off, as it's better to not overwhelm users here with a
huge pile of text by default, showing the list of package with the
short one line title is enough most of the times, I'd guess.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Tested-by: Tim Marx <t.marx@proxmox.com>
Dominik Csapak [Wed, 15 May 2019 09:15:12 +0000 (11:15 +0200)]
add panel/JournalView
similar to LogView, but expects the result from the /node/journal api call,
which is an array of strings, with start/endcursor instead of
an array of objects with line numbers
the new api call also does not accept start line numbers and limit,
so it is necessary to handle it differently
move the "return early, because a request is already pending" into
the doLoad function, so that all calls to it underly the request
limiting, but note that such a new request is desired, and if so
schedule it once the current finishes. This ensures that scrolling
will always get honored, but does not produces multiple hanging
workers, at max one.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>