A previous commit (51083ee) added an override of the internal ExtJS
method `Ext.data.Store.onProxyLoad` in order to fix a race condition.
This override calls `Operation.getProxy`. However, this method is not
available on Sencha Touch. As a consequence, the mobile UI was
broken.
This commit modifies the override such that it has no effect in the
mobile UI.
Fixes: 51083ee54a
Suggested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Languages used to be hardcoded to English, change that to both the
native language plus writing system along with their translation in
the currently selected language.
Signed-off-by: Noel Ullreich <n.ullreich@proxmox.com>
[ T: drop redundant info from subject and reword a bit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
From a usability view, having a checkbox that is not clickable is pretty
misleading, especially if the visual style is exactly the same as in
other places in the UI where the checkbox is functional.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
make the new default theme the "auto" theme that uses media queries to
detect a users preferred theme.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
add a widget that implements a theme selector and sets a cookie to
load the appropriate theme.
Co-authored-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Co-authored-by: Stefan Sterz <s.sterz@proxmox.com>
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Some UI components use `Ext.data.Store.setProxy` to change their
associated API endpoint URL in reaction to user input. One example is
`BackupView`, which calls `setProxy` when the user switches from
listing backups on storage A to listing backups on storage B. However,
if A is slow, the UI may receive the response for A *after* the
response for B. It will then display the contents of A as if they were
the contents of B, resulting in a UI inconsistency.
The reason is that `Ext.data.Store` still processes the slow response
for A, even though it is obsolete. This patch overrides the
responsible callback of `Ext.data.Store` to only process responses
belonging to the currently active proxy object. This should rule out
similar race conditions in all components that use the `setProxy` API.
In the above example, the patch results in the response for A being
ignored.
Ignored responses are logged to the browser console.
Note that this patch only concerns components that use `setProxy` for
changing API endpoints. Other components (e.g. those using
`proxy.setURL` for the same purpose) may be open to similar race
conditions.
Link: https://lists.proxmox.com/pipermail/pve-devel/2023-March/056062.html
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
The "smartness" is mostly "enable it automatically if the caller did
not specify an explicit override and there's neither a failure nor
callback function define", but that should cover most cases.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
while this is something that only the user that made the request will
see, and for most people the possibility of "hacking" themselves is
rather redundant, it is still not nice to have this possible in
general; as even if it's highly unlikely that there ever can be an
error triggered to another user via API2 request handling, hardening
against it is simply to cheap to not do it.
Reported-by: Marcel Fromkorth <marcel.fromkorth@8com.de>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Adds a function for downloading a file from a remote URL in the Utils
class and uses it to revise one similar usage in FileBrowser.js
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Tested-by: Stefan Sterz <s.sterz@proxmox.com>
Reviewed-by: Stefan Sterz <s.sterz@proxmox.com>
helpers to
* generate a color from a string consistently
* generate a html tag for a tag
* related css classes
contrast is calculated according to SAPC draft:
https://github.com/Myndex/SAPC-APCA
which is likely to become a w3c guideline in the future and seems
to be a better algorithm for this
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Regex parses a cpuset via 2 matches. Find number(s) or range(s) folowed
by a comma, then, find a single number or a single range not followed
by a comma. E.g., 0-1,4-5,6,7,10,11,14-15
CpuSet function first checks regex, then ensures left num <= right num
Signed-off-by: Daniel Bowder <daniel@bowdernet.com>
otherwise firefox complains with a deprecation warning that the secure-flag
is not set but SameSite to 'None'. Since we cannot know how firefox will
behave once that behaviour is no longer supported, add the secure flag
now.
Note: ExtJS also clears by setting the cookie with an empty value,
there's no browser supported clear api.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
found with `codespell`, mostly comments but also a fn parameter and
an error in an exception message
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Add years and skip showing minute scale once we got over a year,
that's just not relevant anymore at that scale..
Months are just not an ideal thing to show, as they have different
lengths too (leap years have similar issue, but they differ 0.27%
from a normal year, while shortest to longest month is 10.7%
difference!)
Weeks could be done though, they're fixed at 7 days, but for now I
want to avoid unwieldy day numbers like 2634 d as that's just hard to
frame correctly. Also adding years now does not makes adding weeks in
the future impossible anyway..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
mostly copied from pve, but includes a realm displayeditfield
as well as the comment field
in contrast to the inputpanel in PVE, this is not extended
from a base input panel (where in pve the comment/realm/default/etc.
fields come from)
we do this, since not all products can define a default or tfa
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
like we do for the task_descriptions.
This way we can have a basic config that is true for all products
and override where necessary
Signed-off-by: Dominik Csapak <d.csapak@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>
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>
to avoid having capitalized 'WARNINGS' (especially since 'Error' is not) and
support different languages.
Signed-off-by: Fabian Ebner <f.ebner@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>