[pve-devel] [PATCH manager] fix lxc hostname input window

Dominik Csapak d.csapak at proxmox.com
Fri Jun 23 11:36:37 CEST 2017


we used a static emptytext at creation, which is wrong after editing
now copied from qemu/Options.js (the name), but instead of deleting the
hostname on the backend on an empty field, we set it to CT<VMID>
(this is also the default in the wizard)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/DNS.js | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/www/manager6/lxc/DNS.js b/www/manager6/lxc/DNS.js
index cf7d4609..2c087ae7 100644
--- a/www/manager6/lxc/DNS.js
+++ b/www/manager6/lxc/DNS.js
@@ -164,13 +164,23 @@ Ext.define('PVE.lxc.DNS', {
 		    xtype: 'pveWindowEdit',
 		    subject: gettext('Hostname'),
 		    items: {
-			xtype: 'textfield',
-			name: 'hostname',
-			vtype: 'DnsName',
-			value: '',
-			fieldLabel: gettext('Hostname'),
-			allowBlank: true,
-			emptyText: me.pveSelNode.data.name
+			xtype: 'inputpanel',
+			items:{
+			    fieldLabel: gettext('Hostname'),
+			    xtype: 'textfield',
+			    name: 'hostname',
+			    vtype: 'DnsName',
+			    allowBlank: true
+			},
+			onGetValues: function(values) {
+			    var params = values;
+			    if (values.hostname === undefined ||
+				values.hostname === null ||
+				values.hostname === '') {
+				params = { hostname: 'CT'+vmid.toString()};
+			    }
+			    return params;
+			}
 		    }
 		} : undefined
 	    },
@@ -231,6 +241,7 @@ Ext.define('PVE.lxc.DNS', {
 		    url: '/api2/extjs/' + baseurl
 		}, rowdef.editor);
 		win = Ext.createWidget(rowdef.editor.xtype, config);
+		win.load();
 	    }
 	    //win.load();
 	    win.show();
-- 
2.11.0





More information about the pve-devel mailing list