ui dc/options: refactor render_bwlimits

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>
This commit is contained in:
Thomas Lamprecht 2020-03-06 20:17:34 +01:00
parent 136103b0c9
commit 27af8ed019

View File

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