[pve-devel] [PATCH pve-manager 0/2] ui: fix #3760: change units of ram/swap
Fiona Ebner
f.ebner at proxmox.com
Fri Jul 7 14:29:47 CEST 2023
Am 16.06.23 um 11:54 schrieb Noel Ullreich:
> Up until now, ram, balloonsize and swap were set in MiB, meaning if you wanted to
> create or change a VMs/CTs memory, you would first have to do the math to
> convert from GiB to MiB.
> This patch adds a dropdown-menu of units, MiB, GiB, and TiB, (although
> PiB could easily be added in the future) for ram and swap.
> A future patch in line with this could add units in the API, allowing for
> improved usability from the commandline (e.g. `qm create <id> --memory 2GiB`).
>
> having `scalingFactor` list in MemoryEdit and Resource Edits might not
> be the most elegant solution, the other option was sticking them in
> `proxmox-widget-toolkit/src/Utils.js` or using the units from there.
> However, if we want to use the units from there, we need to scale them
> and trim the unneeded units. So I thought the least invasive solution
> was to put the `scalingFactor` right in the Files.
>
Haven't looked at the details, but we already have
Proxmox.form.SizeField (in widget-toolkit's
src/form/BandwidthSelector.js) with a comment
// display unit (TODO: make (optionally) selectable)
unit: 'MiB',
Maybe you can implement the change there and then simply re-use that
component here to avoid some duplication?
More information about the pve-devel
mailing list