[pve-devel] r6209 - in pve-manager/pve2: . www/manager www/manager/form www/manager/qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Thu Jun 30 12:05:01 CEST 2011


Author: dietmar
Date: 2011-06-30 12:05:01 +0200 (Thu, 30 Jun 2011)
New Revision: 6209

Added:
   pve-manager/pve2/www/manager/form/KVComboBox.js
   pve-manager/pve2/www/manager/form/VNCKeyboardSelector.js
Modified:
   pve-manager/pve2/ChangeLog
   pve-manager/pve2/www/manager/Makefile.am
   pve-manager/pve2/www/manager/PVEUtils.js
   pve-manager/pve2/www/manager/form/CPUModelSelector.js
   pve-manager/pve2/www/manager/qemu/HardwareView.js
Log:
impl. keyboard editor


Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog	2011-06-30 08:58:50 UTC (rev 6208)
+++ pve-manager/pve2/ChangeLog	2011-06-30 10:05:01 UTC (rev 6209)
@@ -1,5 +1,7 @@
 2011-06-30  Proxmox Support Team  <support at proxmox.com>
 
+	* www/manager/form/KVComboBox.js: split out common code
+
 	* www/manager/window/Edit.js: split out common code into
 	specialized PVE.window.Edit class.
 

Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am	2011-06-30 08:58:50 UTC (rev 6208)
+++ pve-manager/pve2/www/manager/Makefile.am	2011-06-30 10:05:01 UTC (rev 6209)
@@ -16,6 +16,7 @@
 	form/TextField.js				\
 	form/RRDTypeSelector.js				\
 	form/ComboGrid.js				\
+	form/KVComboBox.js				\
 	form/NetworkCardSelector.js			\
 	form/DiskFormatSelector.js			\
 	form/BusTypeSelector.js				\
@@ -26,6 +27,7 @@
 	form/FileSelector.js				\
 	form/StorageSelector.js				\
 	form/CPUModelSelector.js			\
+	form/VNCKeyboardSelector.js			\
 	dc/Tasks.js					\
 	dc/Log.js					\
 	panel/StatusPanel.js				\

Modified: pve-manager/pve2/www/manager/PVEUtils.js
===================================================================
--- pve-manager/pve2/www/manager/PVEUtils.js	2011-06-30 08:58:50 UTC (rev 6208)
+++ pve-manager/pve2/www/manager/PVEUtils.js	2011-06-30 10:05:01 UTC (rev 6209)
@@ -102,6 +102,17 @@
 	}
     },
 
+    kvm_keymap_array: function() {
+	var keymaps = PVE.Utils.statics().kvm_keymaps;
+
+	var data = [['', 'Default']];
+	Ext.Object.each(keymaps, function(key, value) {
+	    data.push([key, value]);
+	});
+
+	return data;
+    },
+
     authOK: function() {
 	return Ext.util.Cookies.get('PVEAuthCookie');
     },

Modified: pve-manager/pve2/www/manager/form/CPUModelSelector.js
===================================================================
--- pve-manager/pve2/www/manager/form/CPUModelSelector.js	2011-06-30 08:58:50 UTC (rev 6208)
+++ pve-manager/pve2/www/manager/form/CPUModelSelector.js	2011-06-30 10:05:01 UTC (rev 6209)
@@ -1,57 +1,27 @@
 Ext.define('PVE.form.CPUModelSelector', {
-    extend: 'Ext.form.field.ComboBox',
+    extend: 'PVE.form.KVComboBox',
     alias: ['widget.CPUModelSelector'],
   
-    deleteEmpty: true,
-    
-    getSubmitData: function() {
-        var me = this,
-            data = null,
-            val;
-        if (!me.disabled && me.submitValue && !me.isFileUpload()) {
-            val = me.getSubmitValue();
-            if (val !== null && val != '') {
-                data = {};
-                data[me.getName()] = val;
-            } else if (me.deleteEmpty) {
-		data = {};
-                data['delete'] = me.getName();
-	    }
-        }
-        return data;
-    },
-
     initComponent: function() {
 	var me = this;
 
-	var store = Ext.create('Ext.data.ArrayStore', {
-	    model: 'KeyValue',
-            data : [ 
-		['', 'Default (qemu64)'],
-		['486', '486'],
-		['athlon', 'athlon'],
-		['core2duo', 'core2duo'],
-		['coreduo', 'coreduo'],
-		['kvm32', 'kvm32'],
-		['kvm64', 'kvm64'],
-		['pentium', 'pentium'],
-		['pentium2', 'pentium2'],
-		['pentium3', 'pentium3'],
-		['phenom', 'phenom'],
-		['qemu32', 'qemu32'],
-		['qemu64', 'qemu64'],
-		['host', 'host']
-	    ]
-        });
+        me.data = [ 
+	    ['', 'Default (qemu64)'],
+	    ['486', '486'],
+	    ['athlon', 'athlon'],
+	    ['core2duo', 'core2duo'],
+	    ['coreduo', 'coreduo'],
+	    ['kvm32', 'kvm32'],
+	    ['kvm64', 'kvm64'],
+	    ['pentium', 'pentium'],
+	    ['pentium2', 'pentium2'],
+	    ['pentium3', 'pentium3'],
+	    ['phenom', 'phenom'],
+	    ['qemu32', 'qemu32'],
+	    ['qemu64', 'qemu64'],
+	    ['host', 'host']
+	];
 
-	Ext.apply(me, {
-	    store: store,
-	    queryMode: 'local',
-	    editable: false,
-	    displayField: 'value',
-	    valueField: 'key'
-	});
-
 	me.callParent();
     }
 });

Added: pve-manager/pve2/www/manager/form/KVComboBox.js
===================================================================
--- pve-manager/pve2/www/manager/form/KVComboBox.js	                        (rev 0)
+++ pve-manager/pve2/www/manager/form/KVComboBox.js	2011-06-30 10:05:01 UTC (rev 6209)
@@ -0,0 +1,40 @@
+Ext.define('PVE.form.KVComboBox', {
+    extend: 'Ext.form.field.ComboBox',
+  
+    deleteEmpty: true,
+    
+    getSubmitData: function() {
+        var me = this,
+            data = null,
+            val;
+        if (!me.disabled && me.submitValue && !me.isFileUpload()) {
+            val = me.getSubmitValue();
+            if (val !== null && val != '') {
+                data = {};
+                data[me.getName()] = val;
+            } else if (me.deleteEmpty) {
+		data = {};
+                data['delete'] = me.getName();
+	    }
+        }
+        return data;
+    },
+
+    initComponent: function() {
+	var me = this;
+
+	me.store = Ext.create('Ext.data.ArrayStore', {
+	    model: 'KeyValue',
+	    data : me.data
+	});
+
+	Ext.apply(me, {
+	    displayField: 'value',
+	    valueField: 'key',
+	    queryMode: 'local',
+	    editable: false
+	});
+
+	me.callParent();
+    }
+});

Added: pve-manager/pve2/www/manager/form/VNCKeyboardSelector.js
===================================================================
--- pve-manager/pve2/www/manager/form/VNCKeyboardSelector.js	                        (rev 0)
+++ pve-manager/pve2/www/manager/form/VNCKeyboardSelector.js	2011-06-30 10:05:01 UTC (rev 6209)
@@ -0,0 +1,10 @@
+Ext.define('PVE.form.VNCKeyboardSelector', {
+    extend: 'PVE.form.KVComboBox',
+    alias: ['widget.VNCKeyboardSelector'],
+  
+    initComponent: function() {
+	var me = this;
+	me.data = PVE.Utils.kvm_keymap_array();
+	me.callParent();
+    }
+});

Modified: pve-manager/pve2/www/manager/qemu/HardwareView.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/HardwareView.js	2011-06-30 08:58:50 UTC (rev 6208)
+++ pve-manager/pve2/www/manager/qemu/HardwareView.js	2011-06-30 10:05:01 UTC (rev 6209)
@@ -1,3 +1,25 @@
+Ext.define('PVE.qemu.KeyboardEdit', {
+    extend: 'PVE.window.Edit',
+
+    initComponent : function() {
+	var me = this;
+
+	Ext.applyIf(me, {
+	    title: "Edit keyboard settings",
+	    items: {
+		xtype: 'VNCKeyboardSelector',
+		name: 'keyboard',
+		value: '',
+		fieldLabel: 'Keyboard Layout',
+	    }
+	});
+
+	me.callParent();
+
+	me.load();
+    }
+});
+
 Ext.define('PVE.qemu.ProcessorEdit', {
     extend: 'PVE.window.Edit',
 
@@ -129,6 +151,7 @@
 	    keyboard: {
 		header: 'Keyboard',
 		never_delete: true,
+		editor: 'PVE.qemu.KeyboardEdit',
 		tdCls: 'pve-itype-icon-keyboard',
 		defaultValue: 'default',
 		renderer: PVE.Utils.render_kvm_language
@@ -238,7 +261,7 @@
 
 	Ext.applyIf(me, {
 	    url: '/api2/json/' + baseurl,
-	    cwidth1: 150,
+	    cwidth1: 170,
 	    tbar: [ 
 		{
 		    text: 'Add',




More information about the pve-devel mailing list