all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 1/1] ui: lxc: network: sdn display improvements
Date: Mon, 10 May 2021 17:37:09 +0200	[thread overview]
Message-ID: <20210510153709.2271214-4-aderumier@odiso.com> (raw)
In-Reply-To: <20210510153709.2271214-1-aderumier@odiso.com>

- 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@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




      parent reply	other threads:[~2021-05-10 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 15:37 [pve-devel] [PATCH container/manager/network] RFC: lxc: add ipam support Alexandre Derumier
2021-05-10 15:37 ` [pve-devel] [PATCH pve-container 1/1] " Alexandre Derumier
2021-05-12 12:27   ` Wolfgang Bumiller
2021-05-18 11:43     ` aderumier
2021-05-10 15:37 ` [pve-devel] [PATCH pve-network 1/1] sdn: get_local_vnets : add ipam && vlanaware values Alexandre Derumier
2021-05-10 15:37 ` Alexandre Derumier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210510153709.2271214-4-aderumier@odiso.com \
    --to=aderumier@odiso.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal