From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id D49B91FF09B for ; Mon, 26 Oct 2026 23:05:52 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id BCA6F216ED; Mon, 26 Oct 2026 23:04:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datenzelt.de; s=MBO0001; t=1793052276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Bz9raQ4776FTOQF9WwMF20yRSulsYY5WamoQMWbrs7k=; b=iiYGXvRF+FivbRU/W/EOy8T8wGiARxrZtzcGAwn4PjK1tGZR7N1AAsf8jqzP5oqARr0spq Q7J67tPUEX6UbBRvHFGEkghTkKoRS4eqTdt5rVaK/5enFxvEN0O6FuWEaWiACIKuzomrX3 JtdSAW84y12eJd1i4cVRO0lVQYod+DRoMUWFwhfDceWQ+WGYbkurYtKvzka0aG9Oy3f2Tj P244o7GT70DIa1T+OcYIrMPMhh+VYqjSqoGZn5rd0grDVSRxpfDy+9zTiikqlKxCqJYAOl yiPegaulm4XXI9NO8c/KpwDwGXbZZzeej7oV0HcU6ndth4DkGc0GYXcwYr984A== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of timo.meschkat@datenzelt.de designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=timo.meschkat@datenzelt.de From: Timo Meschkat 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 Message-ID: <20261026220423.127776-1-timo.meschkat@datenzelt.de> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4jD72X5SYnzKnBX X-SPAM-LEVEL: Spam detection results: 0 AWL -0.219 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: EXERGPUROJ56RIPQPILLJPT4KRUMRHOL X-Message-ID-Hash: EXERGPUROJ56RIPQPILLJPT4KRUMRHOL X-MailFrom: timo.meschkat@datenzelt.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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