ui: traffic-control view: make rendere more flexible
do not choke on non-numbers but use the (partially new) widget toolkit helpers to also be able to parse string based sizes with units and auto-scale them Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
f251367c33
commit
188a37fbed
|
@ -5,15 +5,11 @@ Ext.define('pmx-traffic-control', {
|
||||||
'timeframe', 'comment', 'cur-rate-in', 'cur-rate-out',
|
'timeframe', 'comment', 'cur-rate-in', 'cur-rate-out',
|
||||||
{
|
{
|
||||||
name: 'rateInUsed',
|
name: 'rateInUsed',
|
||||||
calculate: function(data) {
|
calculate: d => Proxmox.Utils.size_unit_ratios(d['cur-rate-in'], d['rate-in']),
|
||||||
return (data['cur-rate-in'] || 0) / (data['rate-in'] || Infinity);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'rateOutUsed',
|
name: 'rateOutUsed',
|
||||||
calculate: function(data) {
|
calculate: d => Proxmox.Utils.size_unit_ratios(d['cur-rate-out'], d['rate-out']),
|
||||||
return (data['cur-rate-out'] || 0) / (data['rate-out'] || Infinity);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
idProperty: 'name',
|
idProperty: 'name',
|
||||||
|
@ -64,7 +60,7 @@ Ext.define('PBS.config.TrafficControlView', {
|
||||||
}).show();
|
}).show();
|
||||||
},
|
},
|
||||||
|
|
||||||
render_bandwidth: (value) => value ? Proxmox.Utils.format_size(value) + '/s' : '',
|
render_bandwidth: v => v ? Proxmox.Utils.autoscale_size_unit(v) + '/s' : '',
|
||||||
|
|
||||||
reload: function() { this.getView().getStore().rstore.load(); },
|
reload: function() { this.getView().getStore().rstore.load(); },
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue