all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Timo Meschkat <timo.meschkat@datenzelt.de>
To: pve-devel@lists.proxmox.com
Subject: [RFC PATCH manager 4/4] ui: disk resize: allow selecting the size unit
Date: Mon, 26 Oct 2026 23:04:23 +0100	[thread overview]
Message-ID: <20261026220423.127776-8-timo.meschkat@datenzelt.de> (raw)
In-Reply-To: <20261026220423.127776-1-timo.meschkat@datenzelt.de>

Same as when creating disks, the increment could only be entered in
GiB so far. GiB stays the default. The increment is now sent in MiB,
e.g. '+1536M' instead of '+1.5G', which the API handles the same way.

The VM resize window gets wider to fit the unit selector.

Signed-off-by: Timo Meschkat <timo.meschkat@datenzelt.de>
---
 www/manager6/lxc/MPResize.js  | 11 +++++++----
 www/manager6/qemu/HDResize.js | 13 ++++++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/www/manager6/lxc/MPResize.js b/www/manager6/lxc/MPResize.js
index 658123a1..5a9bb9cb 100644
--- a/www/manager6/lxc/MPResize.js
+++ b/www/manager6/lxc/MPResize.js
@@ -5,7 +5,7 @@ Ext.define('PVE.window.MPResize', {
 
     resize_disk: function (disk, size) {
         var me = this;
-        var params = { disk: disk, size: '+' + size + 'G' };
+        var params = { disk: disk, size: `+${size}M` };
 
         Proxmox.Utils.API2Request({
             params: params,
@@ -46,13 +46,16 @@ Ext.define('PVE.window.MPResize', {
             },
         ];
 
-        me.hdsizesel = Ext.createWidget('numberfield', {
+        me.hdsizesel = Ext.createWidget('pmxSizeUnitField', {
             name: 'size',
+            backendUnit: 'MiB',
+            unit: 'GiB',
             minValue: 0,
-            maxValue: 128 * 1024,
+            maxValue: 128 * 1024 * 1024,
             decimalPrecision: 3,
             value: '0',
-            fieldLabel: `${gettext('Size Increment')} (${gettext('GiB')})`,
+            fieldLabel: gettext('Size Increment'),
+            fieldDescription: gettext('Capacity to add to the disk'),
             allowBlank: false,
         });
 
diff --git a/www/manager6/qemu/HDResize.js b/www/manager6/qemu/HDResize.js
index 574bfb5a..41e7c90e 100644
--- a/www/manager6/qemu/HDResize.js
+++ b/www/manager6/qemu/HDResize.js
@@ -5,7 +5,7 @@ Ext.define('PVE.window.HDResize', {
 
     resize_disk: function (disk, size) {
         var me = this;
-        var params = { disk: disk, size: '+' + size + 'G' };
+        var params = { disk: disk, size: `+${size}M` };
 
         Proxmox.Utils.API2Request({
             params: params,
@@ -47,13 +47,16 @@ Ext.define('PVE.window.HDResize', {
             },
         ];
 
-        me.hdsizesel = Ext.createWidget('numberfield', {
+        me.hdsizesel = Ext.createWidget('pmxSizeUnitField', {
             name: 'size',
+            backendUnit: 'MiB',
+            unit: 'GiB',
             minValue: 0,
-            maxValue: 128 * 1024,
+            maxValue: 128 * 1024 * 1024,
             decimalPrecision: 3,
             value: '0',
-            fieldLabel: `${gettext('Size Increment')} (${gettext('GiB')})`,
+            fieldLabel: gettext('Size Increment'),
+            fieldDescription: gettext('Capacity to add to the disk'),
             allowBlank: false,
         });
 
@@ -86,7 +89,7 @@ Ext.define('PVE.window.HDResize', {
 
         Ext.apply(me, {
             modal: true,
-            width: 250,
+            width: 350,
             height: 150,
             border: false,
             layout: 'fit',
-- 
2.47.3




      parent 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 [RFC PATCH widget-toolkit/manager 0/7] ui: allow selecting the unit for memory and disk sizes Timo Meschkat
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 ` Timo Meschkat [this message]

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-8-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal