},
parseQemuSmbios1: function(value) {
- var res = {};
-
- Ext.Array.each(value.split(','), function(p) {
- var kva = p.split('=', 2);
- res[kva[0]] = kva[1];
- });
+ var res = value.split(',').reduce(function (accumulator, currentValue) {
+ var splitted = currentValue.split(new RegExp("=(.+)"));
+ accumulator[splitted[0]] = splitted[1];
+ return accumulator;
+ }, {});
+
+ if (PVE.Parser.parseBoolean(res.base64, false)) {
+ Ext.Object.each(res, function(key, value) {
+ if (key === 'uuid') { return; }
+ res[key] = Ext.util.Base64.decode(value);
+ });
+ }
return res;
},
printQemuSmbios1: function(data) {
var datastr = '';
-
+ var base64 = false;
Ext.Object.each(data, function(key, value) {
if (value === '') { return; }
- datastr += (datastr !== '' ? ',' : '') + key + '=' + value;
+ if (key === 'uuid') {
+ datastr += (datastr !== '' ? ',' : '') + key + '=' + value;
+ } else {
+ // values should be base64 encoded from now on, mark config strings correspondingly
+ if (!base64) {
+ base64 = true;
+ datastr += (datastr !== '' ? ',' : '') + 'base64=1';
+ }
+ datastr += (datastr !== '' ? ',' : '') + key + '=' + Ext.util.Base64.encode(value);
+ }
});
return datastr;
name: 'uuid'
},
{
- xtype: 'textfield',
+ xtype: 'textareafield',
fieldLabel: gettext('Manufacturer'),
- regex: /^\S+$/,
+ fieldStyle: {
+ height: '2em',
+ minHeight: '2em'
+ },
name: 'manufacturer'
},
{
- xtype: 'textfield',
+ xtype: 'textareafield',
fieldLabel: gettext('Product'),
- regex: /^\S+$/,
+ fieldStyle: {
+ height: '2em',
+ minHeight: '2em'
+ },
name: 'product'
},
{
- xtype: 'textfield',
+ xtype: 'textareafield',
fieldLabel: gettext('Version'),
- regex: /^\S+$/,
+ fieldStyle: {
+ height: '2em',
+ minHeight: '2em'
+ },
name: 'version'
},
{
- xtype: 'textfield',
+ xtype: 'textareafield',
fieldLabel: gettext('Serial'),
- regex: /^\S+$/,
+ fieldStyle: {
+ height: '2em',
+ minHeight: '2em'
+ },
name: 'serial'
},
{
- xtype: 'textfield',
+ xtype: 'textareafield',
fieldLabel: 'SKU',
- regex: /^\S+$/,
+ fieldStyle: {
+ height: '2em',
+ minHeight: '2em'
+ },
name: 'sku'
},
{
- xtype: 'textfield',
+ xtype: 'textareafield',
fieldLabel: gettext('Family'),
- regex: /^\S+$/,
+ fieldStyle: {
+ height: '2em',
+ minHeight: '2em'
+ },
name: 'family'
}
];