]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: parse VM network: support floats without trailing zero
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 21 Mar 2024 09:40:35 +0000 (10:40 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 21 Mar 2024 09:50:04 +0000 (10:50 +0100)
While on simple cases the frontend will translate a `.5` to `0.5` the
backend really doesn't care and takes either.
And it seems that editing from an exiting `0.5` to `.75` will often
cause this to submitted as is.

Independent of how such a value comes into the config, it broke parsing
the network rate property in the UI, where we assumed that there's
always a digit on the left side of the floating point separator.

Simply extend the regex to allow parsing those floats that directly
start with a separator too.

Link: https://forum.proxmox.com/threads/143525/
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/Parser.js

index bc6a4338038adf1fcf963bf05da4d3bae0b1b4d0..debf9d23efa36c0d39641dab4d8999a2eec57a3b 100644 (file)
@@ -121,7 +121,7 @@ Ext.define('PVE.Parser', {
                }
            } else if ((match_res = p.match(/^bridge=(\S+)$/)) !== null) {
                res.bridge = match_res[1];
-           } else if ((match_res = p.match(/^rate=(\d+(\.\d+)?)$/)) !== null) {
+           } else if ((match_res = p.match(/^rate=(\d+(\.\d+)?|\.\d+)$/)) !== null) {
                res.rate = match_res[1];
            } else if ((match_res = p.match(/^tag=(\d+(\.\d+)?)$/)) !== null) {
                res.tag = match_res[1];