[pve-devel] r6295 - in pve-manager/pve2: . www/manager www/manager/form www/manager/qemu www/manager/window
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed Jul 13 14:07:57 CEST 2011
Author: dietmar
Date: 2011-07-13 14:07:56 +0200 (Wed, 13 Jul 2011)
New Revision: 6295
Added:
pve-manager/pve2/www/manager/form/Boolean.js
Modified:
pve-manager/pve2/ChangeLog
pve-manager/pve2/www/manager/Makefile.am
pve-manager/pve2/www/manager/Utils.js
pve-manager/pve2/www/manager/form/Checkbox.js
pve-manager/pve2/www/manager/form/KVComboBox.js
pve-manager/pve2/www/manager/qemu/DisplayEdit.js
pve-manager/pve2/www/manager/qemu/OSTypeEdit.js
pve-manager/pve2/www/manager/qemu/Options.js
pve-manager/pve2/www/manager/window/Edit.js
Log:
* www/manager/form/Checkbox.js: new deleteDefaultValue option to
delete property from file.
* www/manager/form/Boolean.js: boolean type including 'Default'
to delete property from file.
* www/manager/form/KVComboBox.js: use !== instead of !=
* www/manager/qemu/Options.js: use render_kvm_ostype()
impl. editors for most options.
* www/manager/Utils.js: impl.
* www/manager/qemu/OSTypeEdit.js: use render_kvm_ostype()
* www/manager/window/Edit.js: do not automatically instanziate an
'inputpanel' (you need to do that yourself now). removed getParams
method (you can use an inputpanel with onGetValues() instead).
Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/ChangeLog 2011-07-13 12:07:56 UTC (rev 6295)
@@ -1,5 +1,20 @@
2011-07-13 Proxmox Support Team <support at proxmox.com>
+ * www/manager/form/Checkbox.js: new deleteDefaultValue option to
+ delete property from file.
+
+ * www/manager/form/Boolean.js: boolean type including 'Default'
+ to delete property from file.
+
+ * www/manager/form/KVComboBox.js: use !== instead of !=
+
+ * www/manager/qemu/Options.js: use render_kvm_ostype()
+ impl. editors for most options.
+
+ * www/manager/Utils.js: impl.
+
+ * www/manager/qemu/OSTypeEdit.js: use render_kvm_ostype()
+
* www/manager/window/Edit.js: do not automatically instanziate an
'inputpanel' (you need to do that yourself now). removed getParams
method (you can use an inputpanel with onGetValues() instead).
Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/Makefile.am 2011-07-13 12:07:56 UTC (rev 6295)
@@ -18,6 +18,7 @@
form/RRDTypeSelector.js \
form/ComboGrid.js \
form/KVComboBox.js \
+ form/Boolean.js \
form/NetworkCardSelector.js \
form/DiskFormatSelector.js \
form/BusTypeSelector.js \
Modified: pve-manager/pve2/www/manager/Utils.js
===================================================================
--- pve-manager/pve2/www/manager/Utils.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/Utils.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -70,40 +70,63 @@
7: "debug"
},
+ kvm_ostypes: {
+ other: 'Other',
+ wxp: 'Microsoft Windows XP/2003',
+ w2k: 'Microsoft Windows 2000',
+ w2k8: 'Microsoft Windows Vista/2008',
+ win7: 'Microsoft Windows 7/2008r2',
+ l24: 'Linux 2.4 Kernel',
+ l26: 'Linux 2.6 Kernel'
+ },
+
+ render_kvm_ostype: function (value) {
+ if (!value) {
+ return 'Other';
+ }
+ var text = PVE.Utils.kvm_ostypes[value];
+ if (text) {
+ return text + ' (' + value + ')';
+ }
+ return value;
+ },
+
+ // fixme: auto-generate this
+ // for now, please keep in sync with PVE::Tools::kvmkeymaps
kvm_keymaps: {
- ar: 'Arabic',
- da: 'Danish',
+ //ar: 'Arabic',
+ dk: 'Danish',
de: 'German',
'de-ch': 'German (Swiss)',
'en-gb': 'English (UK)',
'en-us': 'English (USA',
es: 'Spanish',
- et: 'Estonia',
+ //et: 'Estonia',
fi: 'Finnish',
- fo: 'Faroe Islands',
+ //fo: 'Faroe Islands',
fr: 'French',
'fr-be': 'French (Belgium)',
'fr-ca': 'French (Canada)',
'fr-ch': 'French (Swiss)',
- hr: 'Croatia',
+ //hr: 'Croatia',
hu: 'Hungarian',
is: 'Icelandic',
it: 'Italian',
ja: 'Japanese',
lt: 'Lithuanian',
- lv: 'Latvian',
+ //lv: 'Latvian',
mk: 'Macedonian',
nl: 'Dutch',
- 'nl-be': 'Dutch (Belgium)',
+ //'nl-be': 'Dutch (Belgium)',
no: 'Norwegian',
pl: 'Polish',
pt: 'Portuguese',
'pt-br': 'Portuguese (Brazil)',
- ru: 'Russian',
- sl: 'Slovenian',
- sv: 'Swedish',
- th: 'Thai',
- tr: 'Turkish'
+ //ru: 'Russian',
+ si: 'Slovenian'
+ //sv: 'Swedish',
+ //th: 'Thai',
+ //tr: 'Turkish'
},
kvm_vga_drivers: {
@@ -134,7 +157,7 @@
render_kvm_vga_driver: function (value) {
if (!value) {
- return 'Default (cirrus)';
+ return 'Default';
}
var text = PVE.Utils.kvm_vga_drivers[value];
if (text) {
@@ -417,6 +440,13 @@
}
},
+ format_boolean_with_default: function(value) {
+ if (Ext.isDefined(value) && value !== '') {
+ return value ? 'Yes' : 'No';
+ }
+ return 'Default';
+ },
+
format_boolean: function(value) {
return value ? 'Yes' : 'No';
},
Added: pve-manager/pve2/www/manager/form/Boolean.js
===================================================================
--- pve-manager/pve2/www/manager/form/Boolean.js (rev 0)
+++ pve-manager/pve2/www/manager/form/Boolean.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -0,0 +1,17 @@
+// boolean type including 'Default' (delete property from file)
+Ext.define('PVE.form.Boolean', {
+ extend: 'PVE.form.KVComboBox',
+ alias: ['widget.booleanfield'],
+
+ initComponent: function() {
+ var me = this;
+
+ me.data = [
+ ['', 'Default'],
+ [1, 'Yes'],
+ [0, 'No']
+ ];
+
+ me.callParent();
+ }
+});
Modified: pve-manager/pve2/www/manager/form/Checkbox.js
===================================================================
--- pve-manager/pve2/www/manager/form/Checkbox.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/form/Checkbox.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -2,8 +2,34 @@
extend: 'Ext.form.field.Checkbox',
alias: ['widget.pvecheckbox'],
+ defaultValue: undefined,
+
+ deleteDefaultValue: false,
+ deleteEmpty: false,
+
inputValue: '1',
+ getSubmitData: function() {
+ var me = this,
+ data = null,
+ val;
+ if (!me.disabled && me.submitValue) {
+ val = me.getSubmitValue();
+ if (val !== null) {
+ data = {};
+ if ((val == me.defaultValue) && me.deleteDefaultValue) {
+ data['delete'] = me.getName();
+ } else {
+ data[me.getName()] = val;
+ }
+ } else if (me.deleteEmpty) {
+ data = {};
+ data['delete'] = me.getName();
+ }
+ }
+ return data;
+ },
+
// also accept integer 1 as true
setRawValue: function(value) {
var me = this;
@@ -14,4 +40,5 @@
me.callParent([value]);
}
}
+
});
\ No newline at end of file
Modified: pve-manager/pve2/www/manager/form/KVComboBox.js
===================================================================
--- pve-manager/pve2/www/manager/form/KVComboBox.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/form/KVComboBox.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -7,9 +7,9 @@
var me = this,
data = null,
val;
- if (!me.disabled && me.submitValue && !me.isFileUpload()) {
+ if (!me.disabled && me.submitValue) {
val = me.getSubmitValue();
- if (val !== null && val != '') {
+ if (val !== null && val !== '') {
data = {};
data[me.getName()] = val;
} else if (me.deleteEmpty) {
Modified: pve-manager/pve2/www/manager/qemu/DisplayEdit.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/DisplayEdit.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/qemu/DisplayEdit.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -4,7 +4,7 @@
initComponent : function() {
var me = this;
- Ext.applyIf(me, {
+ Ext.apply(me, {
title: "Edit display settings",
width: 350,
items: {
Modified: pve-manager/pve2/www/manager/qemu/OSTypeEdit.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/OSTypeEdit.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/qemu/OSTypeEdit.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -14,26 +14,22 @@
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'win7',
- boxLabel: 'Microsoft Windows 7/2008r2'
+ inputValue: 'win7'
},
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'w2k8',
- boxLabel: 'Microsoft Windows Vista/2008'
+ inputValue: 'w2k8'
},
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'wxp',
- boxLabel: 'Microsoft Windows XP/2003'
+ inputValue: 'wxp'
},
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'w2k',
- boxLabel: 'Microsoft Windows 2000'
+ inputValue: 'w2k'
}
];
@@ -46,23 +42,31 @@
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'l26',
- boxLabel: 'Linux 2.6 Kernel'
+ inputValue: 'l26'
},
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'l24',
- boxLabel: 'Linux 2.4 Kernel'
+ inputValue: 'l24'
},
{
xtype: 'radiofield',
name: 'ostype',
- inputValue: 'other',
- boxLabel: 'Other'
+ inputValue: 'other'
}
];
+ Ext.Array.each(me.column1, function(def) {
+ if (def.inputValue) {
+ def.boxLabel = PVE.Utils.render_kvm_ostype(def.inputValue);
+ }
+ });
+ Ext.Array.each(me.column2, function(def) {
+ if (def.inputValue) {
+ def.boxLabel = PVE.Utils.render_kvm_ostype(def.inputValue);
+ }
+ });
+
Ext.apply(me, {
useFieldContainer: {
xtype: 'radiogroup',
Modified: pve-manager/pve2/www/manager/qemu/Options.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/Options.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/qemu/Options.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -21,16 +21,38 @@
name: {
required: true,
defaultValue: me.pveSelNode.data.name,
- header: 'Name'
+ header: 'Name',
+ editor: {
+ xtype: 'PVE.window.Edit',
+ title: 'VM name',
+ items: {
+ xtype: 'textfield',
+ name: 'name',
+ value: '',
+ fieldLabel: 'VM name',
+ allowBlank: true
+ }
+ }
},
onboot: {
header: 'Start at boot',
- defaultValue: false,
- renderer: PVE.Utils.format_boolean
+ defaultValue: '',
+ renderer: PVE.Utils.format_boolean_with_default,
+ editor: {
+ xtype: 'PVE.window.Edit',
+ title: 'Start at boot',
+ items: {
+ xtype: 'booleanfield',
+ name: 'onboot',
+ value: '',
+ fieldLabel: 'Start at boot'
+ }
+ }
},
ostype: {
header: 'OS Type',
editor: 'PVE.qemu.OSTypeEdit',
+ renderer: PVE.Utils.render_kvm_ostype,
defaultValue: 'other'
},
boot: {
@@ -40,21 +62,75 @@
acpi: {
header: 'ACPI support',
defaultValue: true,
- renderer: PVE.Utils.format_boolean
+ renderer: PVE.Utils.format_boolean,
+ editor: {
+ xtype: 'PVE.window.Edit',
+ title: 'ACPI support',
+ items: {
+ xtype: 'pvecheckbox',
+ name: 'acpi',
+ checked: true,
+ uncheckedValue: 0,
+ defaultValue: 1,
+ deleteDefaultValue: true,
+ fieldLabel: 'Enable'
+ }
+ }
},
kvm: {
header: 'KVM hardware virtualization',
defaultValue: true,
- renderer: PVE.Utils.format_boolean
+ renderer: PVE.Utils.format_boolean,
+ editor: {
+ xtype: 'PVE.window.Edit',
+ title: 'KVM hardware virtualization',
+ items: {
+ xtype: 'pvecheckbox',
+ name: 'kvm',
+ checked: true,
+ uncheckedValue: 0,
+ defaultValue: 1,
+ deleteDefaultValue: true,
+ fieldLabel: 'Enable'
+ }
+ }
},
freeze: {
header: 'Freeze CPU at startup',
defaultValue: false,
- renderer: PVE.Utils.format_boolean
+ renderer: PVE.Utils.format_boolean,
+ editor: {
+ xtype: 'PVE.window.Edit',
+ title: 'Freeze CPU at startup',
+ items: {
+ xtype: 'pvecheckbox',
+ name: 'freeze',
+ uncheckedValue: 0,
+ defaultValue: 0,
+ deleteDefaultValue: true,
+ labelWidth: 140,
+ fieldLabel: 'Freeze CPU at startup'
+ }
+ }
},
localtime: {
header: 'Use local time for RTC',
- defaultValue: 'default'
+ defaultValue: false,
+ renderer: PVE.Utils.format_boolean,
+ editor: {
+ xtype: 'PVE.window.Edit',
+ title: 'Use local time for RTC',
+ items: {
+ xtype: 'pvecheckbox',
+ name: 'localtime',
+ uncheckedValue: 0,
+ defaultValue: 0,
+ deleteDefaultValue: true,
+ labelWidth: 140,
+ fieldLabel: 'Use local time for RTC'
+ }
+ }
+
},
startdate: {
header: 'RTC start date',
@@ -84,11 +160,22 @@
return;
}
- var win = Ext.create(rowdef.editor, {
- pveSelNode: me.pveSelNode,
- confid: rec.data.key,
- url: '/api2/extjs/' + baseurl
- });
+ var win;
+ if (Ext.isString(rowdef.editor)) {
+ win = Ext.create(rowdef.editor, {
+ pveSelNode: me.pveSelNode,
+ confid: rec.data.key,
+ url: '/api2/extjs/' + baseurl
+ });
+ } else {
+ Ext.apply(rowdef.editor, {
+ pveSelNode: me.pveSelNode,
+ confid: rec.data.key,
+ url: '/api2/extjs/' + baseurl
+ });
+ win = Ext.createWidget(rowdef.editor.xtype, rowdef.editor);
+ win.load();
+ }
win.show();
win.on('destroy', reload);
Modified: pve-manager/pve2/www/manager/window/Edit.js
===================================================================
--- pve-manager/pve2/www/manager/window/Edit.js 2011-07-13 06:52:22 UTC (rev 6294)
+++ pve-manager/pve2/www/manager/window/Edit.js 2011-07-13 12:07:56 UTC (rev 6295)
@@ -3,6 +3,7 @@
Ext.define('PVE.window.Edit', {
extend: 'Ext.window.Window',
+ alias: 'widget.PVE.window.Edit',
resizable: false,
More information about the pve-devel
mailing list