mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 16:12:18 +00:00
ui: transform bandwidth-field to generic size-field & derive bandwidth from that
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
d43aec909b
commit
635163b051
@ -1,13 +1,13 @@
|
|||||||
Ext.define('PVE.form.BandwidthField', {
|
Ext.define('PVE.form.SizeField', {
|
||||||
extend: 'Ext.form.FieldContainer',
|
extend: 'Ext.form.FieldContainer',
|
||||||
alias: 'widget.pveBandwidthField',
|
alias: 'widget.pveSizeField',
|
||||||
|
|
||||||
mixins: ['Proxmox.Mixin.CBind'],
|
mixins: ['Proxmox.Mixin.CBind'],
|
||||||
|
|
||||||
viewModel: {
|
viewModel: {
|
||||||
data: {
|
data: {
|
||||||
unit: 'MiB',
|
unit: 'MiB',
|
||||||
unitPostfix: '/s',
|
unitPostfix: '',
|
||||||
},
|
},
|
||||||
formulas: {
|
formulas: {
|
||||||
unitlabel: (get) => get('unit') + get('unitPostfix'),
|
unitlabel: (get) => get('unit') + get('unitPostfix'),
|
||||||
@ -32,7 +32,7 @@ Ext.define('PVE.form.BandwidthField', {
|
|||||||
|
|
||||||
// display unit (TODO: make (optionally) selectable)
|
// display unit (TODO: make (optionally) selectable)
|
||||||
unit: 'MiB',
|
unit: 'MiB',
|
||||||
unitPostfix: '/s',
|
unitPostfix: '',
|
||||||
|
|
||||||
// use this if the backend saves values in another unit tha bytes, e.g.,
|
// use this if the backend saves values in another unit tha bytes, e.g.,
|
||||||
// for KiB set it to 'KiB'
|
// for KiB set it to 'KiB'
|
||||||
@ -57,7 +57,7 @@ Ext.define('PVE.form.BandwidthField', {
|
|||||||
enableKeyEvents: true,
|
enableKeyEvents: true,
|
||||||
setValue: function(v) {
|
setValue: function(v) {
|
||||||
if (!this._transformed) {
|
if (!this._transformed) {
|
||||||
let fieldContainer = this.up('pveBandwidthField');
|
let fieldContainer = this.up('fieldcontainer');
|
||||||
let vm = fieldContainer.getViewModel();
|
let vm = fieldContainer.getViewModel();
|
||||||
let unit = vm.get('unit');
|
let unit = vm.get('unit');
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ Ext.define('PVE.form.BandwidthField', {
|
|||||||
return this.allowZero ? 0 : null;
|
return this.allowZero ? 0 : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let fieldContainer = this.up('pveBandwidthField');
|
let fieldContainer = this.up('fieldcontainer');
|
||||||
let vm = fieldContainer.getViewModel();
|
let vm = fieldContainer.getViewModel();
|
||||||
let unit = vm.get('unit');
|
let unit = vm.get('unit');
|
||||||
|
|
||||||
@ -140,3 +140,9 @@ Ext.define('PVE.form.BandwidthField', {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Ext.define('PVE.form.BandwidthField', {
|
||||||
|
extend: 'PVE.form.SizeField',
|
||||||
|
alias: 'widget.pveBandwidthField',
|
||||||
|
|
||||||
|
unitPostfix: '/s',
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user