mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 01:29:03 +00:00
extjs: add parseBoolean for drive backup and iothreads
The backup and iothread options are now boolean types internally instead of strings and need to be treated as such. Added a parseBoolean() function to deal with this with an optional default value to use for undefined values. The default for an undefined backup value is true.
This commit is contained in:
parent
7a4c3133bc
commit
8aebff91f5
@ -5,6 +5,16 @@ Ext.define('PVE.Parser', { statics: {
|
||||
|
||||
// this class only contains static functions
|
||||
|
||||
parseBoolean: function(value, default_value) {
|
||||
if (!Ext.isDefined(value))
|
||||
return default_value;
|
||||
value = value.toLowerCase();
|
||||
return value === 1 || value === '1' ||
|
||||
value === 'on' ||
|
||||
value === 'yes' ||
|
||||
value === 'true';
|
||||
},
|
||||
|
||||
parseQemuNetwork: function(key, value) {
|
||||
if (!(key && value)) {
|
||||
return;
|
||||
|
@ -90,11 +90,11 @@ Ext.define('PVE.qemu.HDInputPanel', {
|
||||
}
|
||||
|
||||
values.hdimage = drive.file;
|
||||
values.nobackup = (drive.backup === 'no');
|
||||
values.nobackup = !PVE.Parser.parseBoolean(drive.backup, 1);
|
||||
values.diskformat = drive.format || 'raw';
|
||||
values.cache = drive.cache || '';
|
||||
values.discard = (drive.discard === 'on');
|
||||
values.iothread = (drive.iothread === 'on');
|
||||
values.iothread = PVE.Parser.parseBoolean(drive.iothread);
|
||||
|
||||
me.setValues(values);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user