From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 30BA81FF13B for ; Wed, 20 May 2026 17:46:15 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2823AEC6B; Wed, 20 May 2026 17:46:14 +0200 (CEST) Message-ID: Date: Wed, 20 May 2026 17:45:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH manager] sdn: fabrics: require at least one prefix To: Gabriel Goller , pve-devel@lists.proxmox.com References: <20260520151236.395956-1-g.goller@proxmox.com> <20260520151236.395956-3-g.goller@proxmox.com> From: Hannes Laimer Content-Language: en-US In-Reply-To: <20260520151236.395956-3-g.goller@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779291924483 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.083 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 37LROAD23XJRQYGPC55WVB33OND3EJP7 X-Message-ID-Hash: 37LROAD23XJRQYGPC55WVB33OND3EJP7 X-MailFrom: h.laimer@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Tested-by: Hannes Laimer On 2026-05-20 17:13, Gabriel Goller wrote: > Prevent removing the last remaining fabric prefix by requiring either an > IPv4 prefix or an IPv6 prefix. Again this is enforced by the API, but > improve the UX by validating in the frontend. > > Signed-off-by: Gabriel Goller > --- > www/manager6/sdn/fabrics/FabricEdit.js | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/www/manager6/sdn/fabrics/FabricEdit.js b/www/manager6/sdn/fabrics/FabricEdit.js > index ddecbdc83df3..e9e0d1fa6286 100644 > --- a/www/manager6/sdn/fabrics/FabricEdit.js > +++ b/www/manager6/sdn/fabrics/FabricEdit.js > @@ -67,6 +67,18 @@ Ext.define('PVE.sdn.Fabric.Fabric.Edit', { > vtype: 'IPCIDRAddress', > skipEmptyText: true, > deleteEmpty: !me.isCreate, > + validator: function (value) { > + let ip6Prefix = this.up('window').down('[name=ip6_prefix]')?.getValue(); > + if (!me.hasIpv6Support || value || ip6Prefix) { > + return true; > + } > + return gettext('Either IPv4 Prefix or IPv6 Prefix is required'); > + }, > + listeners: { > + change: function (field) { > + field.up('window').down('[name=ip6_prefix]')?.validate(); > + }, > + }, > }); > } > > @@ -90,10 +102,19 @@ Ext.define('PVE.sdn.Fabric.Fabric.Edit', { > vtype: 'IP6CIDRAddress', > skipEmptyText: true, > deleteEmpty: !me.isCreate, > + validator: function (value) { > + let ipPrefix = this.up('window').down('[name=ip_prefix]')?.getValue(); > + if (value || ipPrefix) { > + return true; > + } > + return gettext('Either IPv4 Prefix or IPv6 Prefix is required'); > + }, > listeners: { > change: function (textbox, value) { > - let vm = textbox.up('window').getViewModel(); > + let win = textbox.up('window'); > + let vm = win.getViewModel(); > vm.set('showIpv6ForwardingHint', !!value); > + win.down('[name=ip_prefix]')?.validate(); > }, > }, > },