]> git.proxmox.com Git - pve-manager.git/commitdiff
ui dc/options: refactor render_bwlimits
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 6 Mar 2020 19:17:34 +0000 (20:17 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 6 Mar 2020 19:19:12 +0000 (20:19 +0100)
while this /could/ (not benched marked in any way) be slower it
operates on so small data sets that this isn't worth it having double
the code lines.

A map + join is still quite readable and not yet "code golfy"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/dc/OptionView.js

index 53a37184ad22ce1a8487ef9184802dda3f51c5ac..6497648c48a083a004eb38fa124fe2e8932810ec 100644 (file)
@@ -60,20 +60,10 @@ Ext.define('PVE.dc.OptionView', {
            return gettext("None");
        }
 
-       let retval = "";
-       let first = true;
        let parsed = PVE.Parser.parsePropertyString(value);
-
-       Ext.Object.each(parsed, (k, v) => {
-           if (!first) {
-               retval += ", ";
-           }
-           // v is in KiB/s
-           retval += k + ": " + Proxmox.Utils.format_size(v * 1024) + "/s";
-           first = false;
-       });
-
-       return retval;
+       return Object.entries(parsed)
+           .map(([k, v]) => k + ": " + Proxmox.Utils.format_size(v * 1024) + "/s")
+           .join(',');
     },
 
     initComponent : function() {