Thomas Lamprecht [Tue, 28 Mar 2023 15:47:34 +0000 (17:47 +0200)]
window: ldap auth edit: set view-model form data explicitly on edit
Fix a race that shows up in chrome/chromium by setting the data in
the view-model that is binded to form fields explicitly on edit, this
avoids a race where the default declared in the viewModel data got
applied after the form data was set, thus having the state out of
sync and so marking the field potentially as dirty even if it wasn't.
Reported-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Thomas Lamprecht [Tue, 28 Mar 2023 15:42:49 +0000 (17:42 +0200)]
window: ldap auth edit: avoid relying on the default bind property
When using a string as bind config ExtJS maps this to the property
defined by the components defaultBindProperty, which is a bit to
subtle for my taste.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Friedrich Weber [Fri, 24 Mar 2023 09:02:30 +0000 (10:02 +0100)]
fix #4612: mobile: avoid crash due to missing getProxy method
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.
Thomas Lamprecht [Fri, 24 Mar 2023 10:51:35 +0000 (11:51 +0100)]
language selector: increase only picker list view
As that's what matters for the selection, having parts of the already
selected language cut off is not really a big deal as either one
knows the language and the initial native part is enough or the
picker needs to be opened for changing selection anyway.
But, we can give the field itself a bit more space by reducing the
label width to 75, which is enough for all languages as grepping our
PO files for "Language" and their translation, it seems that the
widest one comes from Euskara (Basque) with its "Hizkuntza" having 9
characters.
This way we avoid having to many different
Fixes: 454ff6e ("language selector: increase field width") Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Noel Ullreich [Thu, 23 Mar 2023 14:44:25 +0000 (15:44 +0100)]
language selector: increase field width
With the new translations and layout, the width of the dropdown menu
needs to be increased so that the languages are all on the same line.
This width might need to increased in the future if translations were
to create a line break.
Signed-off-by: Noel Ullreich <n.ullreich@proxmox.com>
[ T: reflow message and reword subject a bit ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Noel Ullreich [Thu, 23 Mar 2023 14:44:24 +0000 (15:44 +0100)]
language selector: translate entries to both native and localized
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>
Stefan Sterz [Thu, 23 Mar 2023 15:26:56 +0000 (16:26 +0100)]
fix #4610: add a small white padding to the totp qr code
some qr code readers need a white "quiet zone" around the main qr
code. otherwise, they won't be able to scan it at all which made it
impossible to scan the totp qr code on certain devices.
Stefan Sterz [Thu, 23 Mar 2023 15:26:55 +0000 (16:26 +0100)]
dark-mode: improve contrast ratios on the mask message
this removes the transparent background of the masks message box. this
should help improve the contrast between the background and text.
also sets an appropriate border color to make it stand out more.
Stefan Sterz [Thu, 23 Mar 2023 15:26:53 +0000 (16:26 +0100)]
dark-mode: color the custom grid and tree icons
this wasn't noticed before because usually vms would either be running
or stopped/offline/unknown etc. and there the colors are set
separately. however, in e.g., the backup view's missing backups
window these weren't colored properly. so this commit sets a default
color.
Thomas Lamprecht [Tue, 21 Mar 2023 15:08:57 +0000 (16:08 +0100)]
rename "Theme" selector to "Color Scheme"
Having "Color" added makes it easier to translate (i.e. Farbschema,
配色) and at least as understandable as Theme, so change it,
Suggested-by: Markus Frank <m.frank@proxmox.com>
[ T: while Markus suggested Color Scheme, the hive-mind opted for
this ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Stefan Sterz [Tue, 21 Mar 2023 14:15:41 +0000 (15:15 +0100)]
dark-mode: set the background mask to `background-darker` again
this removes an issue where the mask would look awkward and
inconsistent (e.g., in the quarantine view, the retention tab of a
zfs storage etc). also makes the shadow a big bigger to be closer to
crisp and also to improve contrast ratios
Stefan Sterz [Mon, 20 Mar 2023 09:02:09 +0000 (10:02 +0100)]
dark-theme: let the background "shine through" mask more
this makes the background mask a bit brighter and more see-through to
make it possible to read values from behind the mask, if needed. it
also adds a more visible shadow to windows so that the stand out more
at the same time.
Lukas Wagner [Fri, 17 Mar 2023 08:47:22 +0000 (09:47 +0100)]
auth ui: fix `value not defined in enumeration` error
...when editing LDAP realm sync settings and only a single property is
empty and thus to be deleted (e.g. values.delete = "filter").
If `delete` is a simple string and not an array,
`Proxmox.Utils.delete_if_default` simply creates a comma-separated list,
(e.g. value.delete = "filter,sync-attributes").
When the properties from the other panel are evaluated and added to the
the `delete` property, comma-separated list format is not considered,
leading to a final value for `delete` that could look like this:
value.delete = {
"server2",
"comment",
"filter,sync-attributes"
}
This commit fixes this by splitting `delete` in case it is a string.
Reported-by: Friedrich Weber <f.weber@proxmox.com> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Lukas Wagner [Fri, 17 Mar 2023 08:47:19 +0000 (09:47 +0100)]
auth ui: add LDAP sync UI
Taken and adapted from PVE.
Changes:
- Removed fields that are irrelevant for PBS for now (PBS has no
groups yet). If PVE is adapted to use the implementation from the
widget toolkit, the fields can simply be readded and somehow
feature-gated so that the fields are only visible/editable on PVE
Lukas Wagner [Fri, 17 Mar 2023 08:47:18 +0000 (09:47 +0100)]
auth ui: add LDAP realm edit panel
The panel was mostly taken from from PVE, but altered slightly:
- bind-dn and bind-password are displayed under "General"
and not under "Sync". For some servers, we need to be bound
to lookup a user's domain from a given user id attribute.
In PVE, the bind-dn and bind-password fields are under
"Sync", which is a bit confusing if a user is not interested
in automatic user syncing.
- There is a 'anonymous search' checkbox. The value is not persisted
in the configuration, it merely enables/disables the
bind-dn and bind-password fiels to make their intent a bit more
clear.
- Instead of a 'secure' checkbox, a combobox for TLS mode is shown.
This way users can select between LDAP, STARTLS and LDAPS.
In PVE, the 'secure' config parameter is deprecated anyway, so
I took the opportunity to replace it with the 'mode' parameter
as described.
- Parameters now consistently use kebab-case for naming. If
PVE is modified to use the same panel, some sort of adapter
will be needed.
Lukas Wagner [Thu, 26 Jan 2023 10:47:10 +0000 (11:47 +0100)]
repo view: replace non-clickable checkbox with icons
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.
Stefan Sterz [Fri, 10 Mar 2023 13:08:36 +0000 (14:08 +0100)]
dark-theme: visually remove the border around the pve resource tree
by setting the color of the border of the resource tree to the panel
background color, it doesn't appear visually anymore while keeping
alignments in place.
Stefan Sterz [Fri, 10 Mar 2023 13:08:35 +0000 (14:08 +0100)]
dark-theme: remove thicker borders around content
previously the dark theme used thicker borders in certain places to
space out the content a bit more. this removes them again to make the
appearance more consistent with "crisp".
Stefan Sterz [Fri, 10 Mar 2023 13:08:34 +0000 (14:08 +0100)]
dark-theme: re-work buttons colors to appear dimmer
this dims buttons further by removing pure white text color and
adjusting backgrounds and border accordingly. it also keeps the help
buttons brighter than other buttons to draw (possibly confused) users
to them.
Stefan Sterz [Fri, 10 Mar 2023 13:08:32 +0000 (14:08 +0100)]
dark-theme: fix summary row background
previously an "!important" was missing from the `background-color`
property. this meant that the background color wasn't properly
overridden. the "!important" is necessary as it is also used in the
light theme.
Dominik Csapak [Fri, 10 Mar 2023 14:08:07 +0000 (15:08 +0100)]
input panel: improve validity change check for advanced fields
instead of only checking the validity of the advanced items when the
form validity changed as a whole, add a validity change listener to
each field in the advanced section.
This improves the behaviour such that every time an advanced field
gets invalid the items are show, not only when the form was valid
before.
Stefan Sterz [Wed, 8 Mar 2023 16:37:44 +0000 (17:37 +0100)]
dark-theme: add support for the pmg quarantine theme toggle
allows using the theme toggle in the pmg quarantine properly. adds a
filter over the iframes in the quarantine to make them appear properly
in a dark environment.
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>
Stefan Sterz [Wed, 8 Mar 2023 16:36:57 +0000 (17:36 +0100)]
gauge widget: add support for a dark theme and dynamic theme switching
the gauges in the data center overview should use a dark style if the
relevant css variables are set. this also makes it possible to switch
the colors dynamically by adding an event listener
Stefan Sterz [Wed, 8 Mar 2023 16:36:56 +0000 (17:36 +0100)]
subscription/summary/backup: stop setting the background color
setting the background color in js code adds that property as a style
attribute to the element. that makes it hard to alter later via css
and makes it hard to dynamically change the color e.g., if we want to
add different themes. the background color for these elements are
white already anyway, so just remove them here.
dark-theme: add initial version of the proxmox-dark theme
adds an initial version of a dark theme for all proxmox products. the
theme works by simply loading an additional css file that adjust the
colors of the original theme "crisp" to be more suitable for a dark
theme.
the theme itself is written in scss, so we need to add sassc as a
build dependency. while sassc is deprecated, it is still maintained in
the debian repositories and, thus, needs no additional packaging on
our end.
this version adds the following on-top of Daniel Tschlatscher's
original draft:
* removes checked-in build artifacts and other stuff that shouldn't be
tracked
* code clean-up and removal of redundant code
* refactors:
* icon styling
* color handling for charts (moved to css variables)
* color variables, consolidates them and makes the "functional"
* color values, improves contrast and makes the theme appear more
consistent
* using the "theme-" prefix
* adds:
* markdown note styles
* combo-box trigger styles
* even more icon styles (e.g., template icons, check boxes etc.)
* loading spinners styles
* number field up and down arrow styles
* an additional auto theme that switches between light and dark
theme dynamically
* widget toolkit hints
* ceph install mask
* grid group headers
* color to toggled buttons
* date picker styles
* drag and drop proxy styles
* fixes:
* contrast on control elements for "scrollable" sidebars
* make the general appearance closer to the light theme ("crisp")
* buttons (when hovered, toggled etc)
* background masking (e.g., when showing the log-in form)
* grid header separator (adds an outline)
* separator lines in some menus
* makes the custom unknown icon more discernible
* makes headers more readable
* color adjustments to several components for consistency
* reduces brightness of dividers in toolbars
* border color on chart legend elements
* removes a black border from docked toolbars (e.g., tag edit)
* dims the "invalid" color to appear less aggressive
* add hover effects in grids and make them consistent with "crisp"
* summary rows
* selected and hovered elements in boundlists
* row numberers in grids
* contrast of links in hints
* ceph overview border colors (e.g., OSD in/out/up/down grid)
* bottom splitter contrast in certain situations
* tag visibility
* pbs compatibility (help buttons stylings, icons, tabs)
* pmg compatibility:
* remove border around the spanning element in the header
* style spam score grid
* style tracking center rows
* add appropriate colors to buttons in the quarantine
* style mail-info element in the quarantine
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>
Friedrich Weber [Mon, 6 Mar 2023 14:03:14 +0000 (15:03 +0100)]
fix #4421: ui: guard setProxy against races of slow vs fast requests
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.
Thomas Lamprecht [Tue, 31 Jan 2023 16:21:05 +0000 (17:21 +0100)]
form: display-edit: add safe default renderer for display field
Due to the value binding on can get interesting effects when the
displayEdit field is in write (input) mode, as then the values still
get relayed to the display field, which itself is wanted as the field
supports live-switching, but even though the display field is
disabled and hidden, the value will be still rendered and a user can
XSS themselves inserting things like:
<img src="a" onerror="alert('cookie:'+document.cookie);"></token
And even though it's harmless (your browser knows your own cookie
already), it is rather odd and simply to cheap to harden against (per
default) to not do so.
Reported-by: Marcel Fromkorth <marcel.fromkorth@8com.de> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Thomas Lamprecht [Tue, 31 Jan 2023 14:56:25 +0000 (15:56 +0100)]
api request: add wide spread alert-error logic as smart-on option
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>
Thomas Lamprecht [Tue, 31 Jan 2023 14:41:39 +0000 (15:41 +0100)]
utils: always html-encode response message
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>
Dominik Csapak [Wed, 18 Jan 2023 13:12:57 +0000 (14:12 +0100)]
ComboGrid: make height for the error configurable
by introducing a errorHeight config property. This is necessary when
the ComboGrid has e.g. a toolbar and we show the error in the grid body
only, 100 pixels is not enough then. To solve that without hardcoding
different heights, let the subclass/caller configure that
also set this when the store load fails completely (was not done until now)
Dominik Csapak [Wed, 18 Jan 2023 13:12:56 +0000 (14:12 +0100)]
ComboGrid: use the grids view for the error message
for most of the combogrids, this does not make a difference, but we
want to have a node selection in some of their toolbars. There
having the error over the whole grid makes it impossible to select a
different node (which might be necessary to get rid of the error), so
we show the error on the view (which is the grids content body only).
privilege role selector: fix renderer for Proxmox VE
In PBS we get an array here, so the renderer is fine, but in pve it's
just a long string, so add a space after commas to achieve the same
effect.
Without this, the second column is not visible in pve because of an
error in the renderer (no 'join' function on a string)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
[ T: squash in code-reduction to make it a one-liner again ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Adds a download button in the TaskViewer. Uses the newly created
downloadAsFile() method in the Utils class.
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>
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>
fix #4271: api-viewer: display nested formats instead of [object Object]
I tried to keep the format as close to the HTML docs as possible, but
there are a few discrepancies between HTML docs and how this patch
displays parameters, instead of:
- <enum>,the enum variants are displayed. [1]
- <0|1>, <boolean> is displayed.
[1] The HTML docs explain parameters after the initial format string,
which the GUI doesn't (and there's no space for that). Showing the
variants inline is the easiest way to not loose information here.
Thomas Lamprecht [Tue, 15 Nov 2022 14:16:39 +0000 (15:16 +0100)]
input panel: add onSetValues hook
As counter-part to `onGetValue`, which is for form assembly, add the
`onSetValues` helper that allows to hook into setting the values on
the fields, for example if one needs to transform a `disabled` to
`enable`.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Daniel Bowder [Fri, 1 Jul 2022 00:09:47 +0000 (17:09 -0700)]
fix #3593: add CpuSet type to js
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>
The text needs to be defined in the wait() call as otherwise the
Ext.Progressbar will show a percentage that is not correct anyway but
just reflects where the animated progress bar itself is.