public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Timo Meschkat <timo.meschkat@datenzelt.de>
To: pve-devel@lists.proxmox.com
Subject: [RFC PATCH widget-toolkit/manager 0/7] ui: allow selecting the unit for memory and disk sizes
Date: Mon, 26 Oct 2026 23:04:16 +0100	[thread overview]
Message-ID: <20261026220423.127776-1-timo.meschkat@datenzelt.de> (raw)

Memory, minimum memory, swap, disk size and disk resize can only be
entered in a fixed unit (MiB or GiB) so far. This series adds a unit
selector (MiB, GiB, TiB) next to these fields, and also accepts a unit
suffix typed right into the field, e.g. '8G' or '512M'.

The defaults stay the same, MiB for memory and GiB for disks, and the
API still gets the same units as before.

This addresses bug #3760 [0]. There was an unfinished series for this
in 2023 [1], which already used a unit selector.

Sent as RFC, as I'd like feedback on the approach first:

- The widget toolkit patches add a new component instead of making the
  unit of Proxmox.form.SizeField selectable, as noted in its TODO. That
  field only converts the first value set from the backend, which does
  not work for fields updated by other fields, like the minimum memory
  following the memory. It is also used by other products. If extending
  it is preferred anyway, I can rework that.

- The unit selector follows a typed suffix while typing, the text is
  normalized on blur. The minimum memory follows both value and unit of
  the memory, as long as the user did not change it.

Behavior changes worth noting:
- disk resize sends the increment in MiB, e.g. '+1536M' instead of
  '+1.5G'
- the minimum size for new disks is 1 MiB instead of 0.001 GiB
- min/max error messages include the unit, e.g. '16.00 MiB'
- the VM disk resize window is wider to fit the unit selector

New translatable strings: 'Unit', 'Also accepts a unit suffix, e.g.
{0}', 'Invalid size, allowed units: {0}', 'Capacity of the disk',
'Capacity to add to the disk' and four memory/swap descriptions.

The manager patches depend on the widget toolkit patches, so they need
a bumped dependency on proxmox-widget-toolkit.

Tested on pve-manager 9.2.24 by scripting the affected panels and
windows in a headless browser: VM and CT memory (with and without
memory hotplug), the disk storage selector and both resize windows.

This is my first patch series for this list, so please excuse me if I
missed any conventions.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=3760
[1] https://lore.proxmox.com/all/20230727103049.38556-1-n.ullreich@proxmox.com/T

proxmox-widget-toolkit:

Timo Meschkat (3):
      form: add size field with selectable unit
      form: size field: accept a unit suffix like 8G
      form: size field: add optional field description


 src/Makefile              |   1 +
 src/form/SizeUnitField.js | 310 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 311 insertions(+)

pve-manager:

Timo Meschkat (4):
      fix #3760: ui: qemu: allow selecting the memory unit
      ui: lxc: allow selecting the unit for memory and swap
      ui: disk storage selector: allow selecting the size unit
      ui: disk resize: allow selecting the size unit


 www/manager6/form/DiskStorageSelector.js | 10 ++++--
 www/manager6/form/MemoryField.js         | 59 +++++++++++++++-----------------
 www/manager6/lxc/MPResize.js             | 11 +++---
 www/manager6/lxc/ResourceEdit.js         | 16 +++++----
 www/manager6/qemu/HDResize.js            | 13 ++++---
 www/manager6/qemu/MemoryEdit.js          | 29 ++++++++++------
 www/manager6/window/GuestImport.js       |  5 ++-
 www/manager6/window/Restore.js           |  4 +++
 8 files changed, 87 insertions(+), 60 deletions(-)

Summary over all repositories:
  10 files changed, 398 insertions(+), 60 deletions(-)

-- 
2.47.3




             reply	other threads:[~2026-10-26 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 22:04 Timo Meschkat [this message]
2026-10-26 22:04 ` [RFC PATCH widget-toolkit 1/3] form: add size field with selectable unit Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH widget-toolkit 2/3] form: size field: accept a unit suffix like 8G Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH widget-toolkit 3/3] form: size field: add optional field description Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 1/4] fix #3760: ui: qemu: allow selecting the memory unit Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 2/4] ui: lxc: allow selecting the unit for memory and swap Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 3/4] ui: disk storage selector: allow selecting the size unit Timo Meschkat
2026-10-26 22:04 ` [RFC PATCH manager 4/4] ui: disk resize: " Timo Meschkat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261026220423.127776-1-timo.meschkat@datenzelt.de \
    --to=timo.meschkat@datenzelt.de \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal