This allows selectively enabling IPv4/6 in the child components, without having to re-define the respective fields in every child component. A later commit will introduce the Wireguard fabric, which will have neither a IPv4 nor IPv6 prefix for now, so the option to exclude those fields will be used there as well.
Signed-off-by: Stefan Hanreich <[email protected]> --- www/manager6/sdn/fabrics/NodeEdit.js | 44 ++++++++++++++----- .../sdn/fabrics/openfabric/NodeEdit.js | 14 ------ www/manager6/sdn/fabrics/ospf/NodeEdit.js | 2 + 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/www/manager6/sdn/fabrics/NodeEdit.js b/www/manager6/sdn/fabrics/NodeEdit.js index b3d9751aa..7cbea9608 100644 --- a/www/manager6/sdn/fabrics/NodeEdit.js +++ b/www/manager6/sdn/fabrics/NodeEdit.js @@ -11,6 +11,9 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', { nodeId: undefined, protocol: undefined, + hasIpv4Support: true, + hasIpv6Support: true, + disallowedNodes: [], baseUrl: '/cluster/sdn/fabrics/node', @@ -22,17 +25,6 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', { hidden: true, allowBlank: true, }, - { - xtype: 'proxmoxtextfield', - fieldLabel: gettext('IPv4'), - labelWidth: 120, - name: 'ip', - allowBlank: true, - skipEmptyText: true, - cbind: { - deleteEmpty: '{!isCreate}', - }, - }, ], additionalItems: [], @@ -52,6 +44,34 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', { me.url = `${me.baseUrl}/${me.fabricId}`; } + if (me.hasIpv4Support) { + me.items.push({ + xtype: 'proxmoxtextfield', + fieldLabel: gettext('IPv4'), + labelWidth: 120, + name: 'ip', + allowBlank: true, + skipEmptyText: true, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }); + } + + if (me.hasIpv6Support) { + me.items.push({ + xtype: 'proxmoxtextfield', + fieldLabel: gettext('IPv6'), + labelWidth: 120, + name: 'ip6', + allowBlank: true, + skipEmptyText: true, + cbind: { + deleteEmpty: '{!isCreate}', + }, + }); + } + me.nodeSelector = me.getNodeSelector(); me.interfaceSelector = me.getInterfaceSelector(); @@ -136,7 +156,7 @@ Ext.define('PVE.sdn.Fabric.Node.Edit', { }); }, - getNodeSelectorConfig: function() { + getNodeSelectorConfig: function () { let me = this; return { diff --git a/www/manager6/sdn/fabrics/openfabric/NodeEdit.js b/www/manager6/sdn/fabrics/openfabric/NodeEdit.js index 3a0fafbbd..8296ec13f 100644 --- a/www/manager6/sdn/fabrics/openfabric/NodeEdit.js +++ b/www/manager6/sdn/fabrics/openfabric/NodeEdit.js @@ -5,18 +5,4 @@ Ext.define('PVE.sdn.Fabric.OpenFabric.Node.Edit', { extraRequestParams: { protocol: 'openfabric', }, - - additionalItems: [ - { - xtype: 'proxmoxtextfield', - fieldLabel: gettext('IPv6'), - labelWidth: 120, - name: 'ip6', - allowBlank: true, - skipEmptyText: true, - cbind: { - deleteEmpty: '{!isCreate}', - }, - }, - ], }); diff --git a/www/manager6/sdn/fabrics/ospf/NodeEdit.js b/www/manager6/sdn/fabrics/ospf/NodeEdit.js index 2bec10468..370aee191 100644 --- a/www/manager6/sdn/fabrics/ospf/NodeEdit.js +++ b/www/manager6/sdn/fabrics/ospf/NodeEdit.js @@ -2,6 +2,8 @@ Ext.define('PVE.sdn.Fabric.Ospf.Node.Edit', { extend: 'PVE.sdn.Fabric.Node.Edit', protocol: 'ospf', + hasIpv6Support: false, + extraRequestParams: { protocol: 'ospf', }, -- 2.47.3
