it seems that something changed in extjs 7 which does not quite
restore the correct scroll position when the identical content is set
on a component. this means that sometimes, we update the text
with the identical one, but the scroll position is now off, only
to scroll back to the bottom
this causes a flickering everytime we do the api call.
instead, only update the component when the content really changed.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This makes check box lists like the following snipped work:
- [X] Done
- [ ] not done
Further allow the start attr, sometimes generated for ordered lists.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Define our own, rather minimal interface so that we change the parser
under the hood if ever needed, I already did so once during
evaluating this, as first I checked out Snarkdown[0], which is really
nice for the few lines of code it needs, but is a bit to limited for
the use case.
Currently marked[1] is used, provided by the libjs-marked Debian
package.
For now statically link the marked parser in on built time to avoid
the need to add new directories to serve in our pve/pmg/pbs proxies.
This is a bit ugly but can be cleaned up afterwards transparently
too.
We sanitize the produced HTML ourselves (most MD JS parser/renderer
don't do that) by creating a real, but not active, DOM tree and
recursively prune bad nodes/attrs from it and let it spit out HTML
again at the end. While a tad inefficient it really won't matter for
our use case, as the notes/comments we render are only a few KiB of
text and it's done on the client side anyway.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
We do not want to trigger an autoSelect if there's a value set, even
if it isn't found in the store, as that hides the fact that an (now)
invalid valid is configured from the user, which can be confusing if
something is not working, as when editing an object it seems like a
valid value is selected.
Further, if a value is set we mark the field as invalid from the
start, at least if it's neither disabled nor allowed to have a
value which is does not exists in the backing store.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
so that we can reuse it across products
source was 'pbs' since that had the most features (http upgrade check)
a few changes to combine pve/pbs/pmg:
* use an optional 'cliusage' function it it exists to determine CLI usage
* check allowtoken for undefined to see if it is allowed or not
* use 'pmxapi' instead of pbs/pmg/pveapi
* rename all occurrences of 'pve' to 'pmx'
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
not all users of Toolkit.js have the charts lib loaded, which means
the class does not exist then.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
which shows a confirm dialog with the most relevant information before actually
issuing the API call.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Without this the check and the, through the 'install' target
triggered, incremental lint target triggered a full eslint run.
Makes it similar to what PBS did from the beginning of eslint
inclusion..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
in extjs 7.0, the marker does not have the 'fx' property anymore,
but the now documented 'animation' property does not work as it seems.
instead set the animation settings directly on the chart. The only
downside is that this is now for *all* animations, not only the
fade in of the highlight. (the default duration is 500ms)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
seems to be fixed, at least i could not reproduce here.
If users report this again, we can still revert it if necessary.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
while some scrolling issues where fixed since 6.0.1, some where introduced,
namely:
* for firefox, the correct event to listen to is 'wheel' not 'mousewheel'
* the spinner scroll direction was incorrect
* the boxOverflow scroll direction was incorrect
* the boxOverflow scroll amount was too high
functions were copied from extjs source, eslintified, and adapted
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
the legend is by default of type 'sprite', rever to 'dom'
but we now have to unset the '.legend', else on destruction
extjs tries to destroy it twice
also change the onAfterAnimation listener to 'redraw', since
the original event does not exist anymore, add a buffer to it
so that it is not that heavy
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
add a new class 'x-treelist-pve-nav' so that we can use
ui: 'pve-nav'
instead of
ui: 'nav'
which has some default styling we do not want
also overwrite the font to FontAwesome
(extjs 7.0 uses 'FontAwesome 5 Free' which we do not ship)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
instead of the upstream default of 'async'
we do this since it creates some problems with our callbacks which can
happen during component destruction. The upstream reasoning does not
really makes sense for us normally, since we do not keep any references
around for most things, and thus the garbage collector can claim it.
note that this is only for components, Ext.Base sets it to 'true' by
default and we do not change this since we normally do not extend
from non-components
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
extjs 7.0 gives the responseType to the XMLHTTPRequest (which
is 'json' for a json reader), but that means that the response is
automatically decoded by the browser, with no means to get the original
return back
in our case, for successful api calls it would work, but some of our
errors are plain text, not json, so the decoded json object is 'null'
and we lose the error information
revert the type to 'undefined' which tells the browser not do do any
decoding
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
So that users of this component do not necesacrrily need to add an
initComponent override and make the `me.add_XYZ_row()` there, but
instead can use something like:
gridRows: [
{
xtype: 'text',
name: 'http-proxy',
text: gettext('HTTP proxy'),
defaultValue: Proxmox.Utils.noneText,
vtype: 'HttpProxy',
deleteEmpty: true,
},
],
I avoid using `rows` as config key as that is internally used for
quite a few things, and potentially some existing users (did not
checked all). We can still switch to that easily if it is deemed to
be better...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
If there is extended information, the variable is overwritten anyways.
Avoid appending an extra space if there is no extended information.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Storage capacity and usage seems to prefer the base ten (SI unit) use
(makes the capacity a bigger number) while memory (RAM) is normally
preferred to use base 2.
So allow both, mostly to allow consistent displaying of metrics.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
60% is just way to low, this probably could be 80% or even 85% too,
in huge setups that normally means that there's still a lot of
resources left, but be conservative for now.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
we may want to replace them someday, at least with an intermediate
widget xtype for unified querying, but it's only going through the
local descendant, which is not that bad size-wise, so don't care..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE has 2 domain lists, PMG only 1 since it requires the
additional type.
In PBS I do not want to have 2 lists either, since it seems
rather inconvenient to have 2 different ways to access the
same list.
Currently we decide this based on whether we have multiple
certificate types, which in PBS we don't, so we need a
separate option for this.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
If an error is received upon expanding a node, chances are the rest of
the tree is still valid (i.e. opening a partition fails because it
doesn't contain a supported filesystem). Only show an error box for the
user, but don't mask the component in that case. Additionally, disable
the download button.
Also support an archive set to 'all' to expand all children, useful for
initializing a file-restore VM on initial load.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Denotes objects like disks ".img.fidx" files, which shouldn't be
downloadable, but should still approximate a directory entry.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Call a function to decide if we want to mask the component. If the
callback returns true, we assume it has already handled the error (i.e.
shown a messagebox or similar) and skip masking.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Looks like more change than it actually is, see
`--word-diff=color --word-diff-regex='\w+'`.
The single semantic change is the added space in the render_cpu,
between the maxcpu value and CPU/s text
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
with 2 minor fixups:
* one lint error
* binding of the 'updateValues' function in the event
(we want to avoid breaking this when used in a context where
a controller exists, in that case using a string will only look in
the controller and not in the component itself anymore, so use
the function directly)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
To be replaced by generic additional items specified by the user of the window
or child class. AFAICS there are no existing users of this widget yet, so this
shouldn't break anything.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
The chart axis get initialized really, so changing the segmenter in
initComponent is not possible anymore, we can only alter the chart
base config in the constructor.
Luckily, the actual segmentation happens later, so we can pass a
flag to the y-axis and hook into the segmenter directly by creating
a new one derived from 'Ext.chart.axis.segmenter.Numeric'.
There we override the preferStep and exactStep methods to decide if
we want to calculate with base 10 or base 2.
So add a constructor to RRDChart and set the axis with the respective
segmenter, depending on the powerOfTwo config, up there initially.
Note: that makes overwriting the axes from a caller impossible, but
we do not use that anywhere, and we can control the more important
parts of the axes, like label or units already otherwise, so seems
not really required, and if, its not to hard to solve (either by
always using our new segmenter by default and handle the different
bases there directly, or by adding an explicit do not touch axes
config flag, or the like).
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
ExtJS email validation regex has a length limit of 6 on the TLD.
This breaks some new gTLDs (e.g. .systems)
Override the validation function and verify against the EMAILRE from
PVE::Tools (used for 'e-mail' in JSONSchema)
Reported in our community forum:
https://forum.proxmox.com/threads/acme-account-register-dialog-does-not-accept-gtlds.87305/
Quickly tested (by using test@test.systems(|test)? on my test-installation)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Sometimes the reset button does not make sense and the isCreate option
does not fit as well because with it, the submit button will be enabled
right away instead of waiting for the form to be valid.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Don't construct any URLs locally, instead have them (and their static
parameters) be passed in. This removes the need to have the datastore.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
to avoid having capitalized 'WARNINGS' (especially since 'Error' is not) and
support different languages.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
A view model forumla cannot depend on itself, as that is a dependency
cycle.
In this specific case we can just drop the `hasUsage` forumla entry
completely, it is bogus as it was just returning its value, and that
is actually taken care of by the `hasUsage` data binding.
The debug build of ExtJS throws an exception on such cycles, the
release build does not cares to much and seems to do the right thing
already here.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
After the UI hang for tens of seconds for a few thousand elements got
deselected I investigated with Firefox developer tools performance
analysis, where the waterfall view showed that most of the time was
spent in array splicing.
Previously, all removed elements got removed on by one from the
`selected` Ext.util.Collection - which is basically an helper class
around arrays and objects, most of it may have become obsolete with
modern browsers. The single remove resulted into further splicing of
the array, and all in all it resulted in a dramatically increased
complexity, ~ O(n^3).
The "remove one by one" logic comes highly probably from the fact
that users can register a `beforedeselection` listener which can
block a removal of a specific record. But, that's not used by us and
not really something one would often need in practice, but still its
a documented feature of ExtJS grids we want to keep; so go for an
alternative.
So, override `doDeselect` and change the old removal logic to one
that first record those entries which got blocked from removal and
remove them in one go from the "to-be-removed" collection.
Before/After this patch on my FF 86.0.1 with my i9-9900K and
deselecting ~10k records went from ~40s to about 33 ms total, so for
that case we went 1000x faster.
The remaining time is now mostly spend in the event fire/handling
logic, but even with 50k records we spent <<500ms in total, so not
too bad and thus kept as is for now.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Same deal, however, here the PVE code is has a little bug
where changing the plugin type of a domain makes it
disappear, so this also contains some fixups.
Additionally, this now also adds the ability to change a
domain's "usage" (smtp, api or both), so similar to the
uploadButtons info in the Certificates panel, we now have a
domainUsages info. If it is set, the edit window will show a
multiselect combobox, and the panel will show a usage
column.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Like with the account panel, the 'acmeUrl' base needs to be
specified, otherwise this is copied from PVE
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Copied from PVE with URLs now being based on the 'acmeUrl'
property which should point to the acme/ root containing
/tos, /directories, etc.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Again, initially copied from PVE but adapted so it can be
used by both. (PVE side still needs to be tested though.)
The 'nodename' property is optional (since on PMG we
currently don't expose them via the UI directly). Instead,
the certificate info URL is required and the 'uploadButtons'
need to be passed, which just contains the certificate
"name", id (filename), url, and whether it is deletable and
whether a GUI reload is required after changing it. If only
1 entry is passed, the button stays a regular button (that
way PVE should still look the same), whereas in PMG we have
a menu to select between API and SMTP certificates.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Mostly copied from PVE, but the user needs to set the URL
property so their stores can load the data, whereas in PVE
this was hardcoded.
API selector:
needs its url to point to the challenge-schema url
Acme Account selector:
needs its url to point to the acme account index
Acme Plugin selector:
needs its url to point to the plugin index
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
We never use that and it serves no purpose. It probably was meant to
be the upstream config 'storeId' which would add the store to the
Ext.StoreManager. This is unpractical though, since then the store
has to be explicitely destroyed, otherwise the StoreManager retains a
reference and the GC cannot remove the store.
Since donwstream users of the store can simply give the 'storeId'
property anyway if they need to be managed by the StoreManager, drop
the requirement here.
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
500 px still fit nicely in our minimum requirements of "HD ready"
(1280 x 720 px) and for any slightly longer running task the extra
pixel are really nice, I frequently find myself resizing the height
immediately after a task window opens so lets up the default a bit...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Using find_next_iface_id we get a valid VLAN name.
This way, inserting a vlan raw device is still required (but everything that is
inserted so far is valid).
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
We usually choose default values that are valid input for the field.
interfaceX.1 is rejected by the API.
Instead, use a tooltip to demonstrate possible valid inputs for the field.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
Users certainly have to insert a vlan raw device when the textfield is enabled.
Currently, they only see `invalid network interface name "` when submitting.
Forbidding the blank field shows the problem earlier.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
The regex are are created as literals (with // and not new RegExp).
Therefore
- The old Vlan_match value with double \\ has matched e.g. vlan\ddd instead
of e.g. vlan123 and
- the old VlanInterface_match value with double \\ has matched e.g.
\www\X\dddd instead of e.g. vmbr0.1234
This fixes automatically disabling the fields vlan-raw-device and vlan-id (VLAN
tag) in the VLAN edit window.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
Assigning the store directly to the treepanel doesn't work, more manual
handling is needed. This is mostly based on what we do for PBS's datastore
content view. The store monitoring also needs to be changed slightly.
The buttons are restricted to work on disks only, based on the parent
attribute, that only partitions have.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
The drawing makes clear in a few seconds:
- what columnT and columnB stand for
- what additional containers and panels are created
- to which of those the elements of column1, column2... go to
When you're in the JS debugger and lost overview of where in this
element hierarchy you are, you can quickly check xtype + layout. Then
consulting this drawing solves the mistery.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
findRecord does not match exactly, but only at the beginning and
case insensitive, by default. Change all calls to be case sensiti
and an exactmatch (we never want the default behaviour afaics).
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
previously we printed this ceph info, but it got lost during
refactoring to widget-toolkit, restore a slightly modified
version of the code
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
there may be cases where the backend serialization plumping code
makes it easier to return null instead of a emtpy object if a
(sub)property or whole config is not configured, as it's closer to
the truth (not configured == null, configured but empty would be {})
For objects this resulted in a exception, as the null value was tried
to be dereferenced, avoid that by defaulting to an empty object in
that case.
For arrays we already coped with that by luck, make that more
explicit to avoid future breakage.
Both result to a empty array being returned as values, which means
empty store and is deemed to be OK in that case.
The rowdef.required still applies and adds empty values though, this
could be argued to not be really fitting - for now lets keep it that
way, we could make this opt-in though if it shows that it is not
always correct.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
The corresponding option in /etc/network/interfaces is exactly "bond-primary".
Translating this might easily make unclear what is meant.
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
mirrors columnB (column bottom) but is placed on the top, i.e.,
columnT.
One can no conveniently set the following layout:
+-------------------------------------+
| |
| columnT |
| |
+------------------+------------------+
| | |
| | |
| column1 | column2 |
| | |
| | |
+------------------+------------------+
| |
| columnB |
| |
+-------------------------------------+
(4 columns should work too, but we do not use that anywhere FWICT)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
allow that any of the three column/docked definitions can be set,
without setting the first one to an empty array to go in that if
branch.
Note, column2 works fine, but I did not greatly test a sole
advancedColumnB definition, so there may be still some improvements
for fixes - but at that point the user could also use advancedItems
to have full control.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
`useFieldContainer` doesn't seem to be used anymore in any of our
products:
* PVE
* PMG
* PBS
it therefore can be considered dead code.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
When scaling the browsers content either via the browser itself or
because the OS has a different scaling / DPI setting, it can happen that
not all columns have enough space next to each other and thus the last
column is moved further below.
This happens especially on chromium bases browsers (e.g. chrome, edge).
Changing the layout to use extjs HBOXes with flex instead of columns
solves works well.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
if there occured an error in the api call of the store, show this error
on the picker when opened, instead of just showing an empty picker
this makes it possible to see that there was an error while accessing the api
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
we have everything updated to ExtJS 6.x since quite a bit, and some
quick checks on various components did not show any error - lets
enable this again.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
we use 'override_task_descriptions' in the specific products to
add the ones that are not used everywhere
took the chance and sorted the remaining alphabetically
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Font Awesome is intended to be used at 14px font-size, we set that
already over product specific CSS for some elements like buttons.
But, for tab panel icons and tree navigation views it was often
overruled by ExtJS to 13px which made look them quite blurry and even
the position was a bit off (to high when compared to the texts
baseline.
Fix that by overwriting the font-size to 14px of the
x-treelist-item-icon and x-tab-icon-el-default class, for the latter
improve the icon to text possition by setting a slight top margin.
Setting the color to black was already done by each product, so move
that over here.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
copied from pve-manager, but handling both '1' and 'true' as propagate
values, and making the authentication ID name/parameter configurable.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
For passing some default params which are passed along automatically
when calling load and doing the submit.
Useful in PBS, as there we often have the snapshot ID in multiple
parameters, not included in the request path, required for various
API call.
The params take low precendence, and are overwritten by values in
form fields with the same name for submit, or explicit params passed
to load calls
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
with a setData function that calls our updateValue, we can now use
viewModel bind to update those widgets
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
when using the mode 'MULTI' for the checkbox selection model,
clicking a row would deselect all others, only clicking exactly on the
checkbox would select multiple rows
this override makes the whole cell of the checkbox behave like the
checkbox. This minimizes misclicks from the user.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>