]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: bandwidth field: make unit postfix configurable
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 11:00:51 +0000 (13:00 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 11:01:54 +0000 (13:01 +0200)
preparation for making this widget more general, for sizes (not over
time) too

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

index 07e25715dd6d7f82457512d89e0a07fb8dd5e3f3..533a2bb8498bdea2e9e2e3fb34124bbde097fd0e 100644 (file)
@@ -7,9 +7,10 @@ Ext.define('PVE.form.BandwidthField', {
     viewModel: {
        data: {
            unit: 'MiB',
+           unitPostfix: '/s',
        },
        formulas: {
-           unitlabel: (get) => get('unit') + '/s',
+           unitlabel: (get) => get('unit') + get('unitPostfix'),
        },
     },
 
@@ -31,6 +32,7 @@ Ext.define('PVE.form.BandwidthField', {
 
     // display unit (TODO: make (optionally) selectable)
     unit: 'MiB',
+    unitPostfix: '/s',
 
     // use this if the backend saves values in another unit tha bytes, e.g.,
     // for KiB set it to 'KiB'
@@ -131,10 +133,10 @@ Ext.define('PVE.form.BandwidthField', {
            me.backendFactor = me.units[me.backendUnit];
        }
 
-
        me.callParent(arguments);
 
        me.getViewModel().set('unit', me.unit);
+       me.getViewModel().set('unitPostfix', me.unitPostfix);
     },
 });