[pve-devel] [PATCH pve-manager 1/1] ui: lxc: network: sdn display improvements

Alexandre Derumier aderumier at odiso.com
Mon May 10 17:37:09 CEST 2021


- Display "auto ipam" for empty text when ipam is enabled on vnet
- clear ip/gw value on vnet change
- disable/enable vlan tag for non/vlanaware vnets

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager6/form/BridgeSelector.js |  2 +-
 www/manager6/lxc/Network.js         | 34 +++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/BridgeSelector.js b/www/manager6/form/BridgeSelector.js
index 350588cd..227976af 100644
--- a/www/manager6/form/BridgeSelector.js
+++ b/www/manager6/form/BridgeSelector.js
@@ -5,7 +5,7 @@ Ext.define('PVE.form.BridgeSelector', {
     bridgeType: 'any_bridge', // bridge, OVSBridge or any_bridge
 
     store: {
-	fields: ['iface', 'active', 'type'],
+	fields: ['iface', 'active', 'ipam', 'type', 'vlanaware'],
 	filterOnLoad: true,
 	sorters: [
 	    {
diff --git a/www/manager6/lxc/Network.js b/www/manager6/lxc/Network.js
index 9fe479f8..a0274201 100644
--- a/www/manager6/lxc/Network.js
+++ b/www/manager6/lxc/Network.js
@@ -131,6 +131,40 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
 		fieldLabel: gettext('Bridge'),
 		value: cdata.bridge,
 		allowBlank: false,
+		listeners: {
+		    change: function(combo, newValue) {
+			var store = combo.getStore();
+			var rec = store.findRecord('iface', newValue, 0, false, true, true);
+			if (!rec) {
+			    return;
+			}
+
+			if (rec.data.type === 'vnet' && !rec.data.vlanaware) {
+			    me.down('field[name=tag]').setDisabled(true);
+			} else {
+			    me.down('field[name=tag]').setDisabled(false);
+			}
+
+			if (rec.data.type === 'vnet') {
+			    me.down('field[name=ip]').setValue('');
+			    me.down('field[name=gw]').setValue('');
+			    me.down('field[name=ip6]').setValue('');
+			    me.down('field[name=gw6]').setValue('');
+			}
+
+			if (!rec.data.ipam) {
+			    me.down('field[name=ip]').setEmptyText(Proxmox.Utils.NoneText);
+			    me.down('field[name=gw]').setEmptyText(Proxmox.Utils.NoneText);
+			    me.down('field[name=ip6]').setEmptyText(Proxmox.Utils.NoneText);
+			    me.down('field[name=gw6]').setEmptyText(Proxmox.Utils.NoneText);
+			} else {
+			    me.down('field[name=ip]').setEmptyText('auto (ipam)');
+			    me.down('field[name=gw]').setEmptyText('auto (ipam)');
+			    me.down('field[name=ip6]').setEmptyText('auto (ipam)');
+			    me.down('field[name=gw6]').setEmptyText('auto (ipam)');
+			}
+                    },
+                },
 	    },
 	    {
 		xtype: 'pveVlanField',
-- 
2.20.1





More information about the pve-devel mailing list