From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 771661FF15E
	for <inbox@lore.proxmox.com>; Fri, 26 Jul 2024 14:51:30 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 9388C1E425;
	Fri, 26 Jul 2024 14:51:29 +0200 (CEST)
Date: Fri, 26 Jul 2024 14:51:20 +0200
To: Stefan Hanreich <s.hanreich@proxmox.com>, pve-devel@lists.proxmox.com
References: <20231222104316.107600-1-s.hanreich@proxmox.com>
In-Reply-To: <20231222104316.107600-1-s.hanreich@proxmox.com>
MIME-Version: 1.0
Message-ID: <mailman.697.1721998288.331.pve-devel@lists.proxmox.com>
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Post: <mailto:pve-devel@lists.proxmox.com>
From: Theodor Fumics via pve-devel <pve-devel@lists.proxmox.com>
Precedence: list
Cc: Theodor Fumics <theodor.fumics@gmx.net>
X-Mailman-Version: 2.1.29
X-BeenThere: pve-devel@lists.proxmox.com
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
Subject: Re: [pve-devel] [PATCH pve-manager] sdn: vnets: Hide irrelevant
 fields depending on zone type
Content-Type: multipart/mixed; boundary="===============7209080379661170673=="
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

--===============7209080379661170673==
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <theodor.fumics@gmx.net>
X-Original-To: pve-devel@lists.proxmox.com
Delivered-To: pve-devel@lists.proxmox.com
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by lists.proxmox.com (Postfix) with ESMTPS id 0BB9BC39E8
	for <pve-devel@lists.proxmox.com>; Fri, 26 Jul 2024 14:51:28 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id DD8941E2FB
	for <pve-devel@lists.proxmox.com>; Fri, 26 Jul 2024 14:51:27 +0200 (CEST)
Received: from mout.gmx.net (mout.gmx.net [212.227.15.15])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by firstgate.proxmox.com (Proxmox) with ESMTPS
	for <pve-devel@lists.proxmox.com>; Fri, 26 Jul 2024 14:51:27 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net;
	s=s31663417; t=1721998281; x=1722603081; i=theodor.fumics@gmx.net;
	bh=osyiF0AA7SPhUi7J4QOlcjE2rofiQ5tr/9RfUJ3Nwaw=;
	h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:
	 References:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding:cc:content-transfer-encoding:
	 content-type:date:from:message-id:mime-version:reply-to:subject:
	 to;
	b=CTWkmcpEYW27AVVG0+knXZo7KOra5Uptj3wMnOM/seTnwtUJPhbYAENLWD/1PApe
	 FM0JupPpUBnC7jiVEf1gQ3M3xHQ9iblTnjhmtAUmkR9TyIyHwBR3q+Qc8fvtf4PR7
	 MvJXk3iyeZ/a348Wc6Zxi0Ukbnn97oYKReiANn7Ymn7TzVdbuNxvYKQaVXsYzqd5M
	 46SYg7rZ6/wldCgRng7YDul1T+hNWu1BGj65CN5r8mrGmzBgp75tqDkErKFMYjAdY
	 Rmd6//xAeAzAeNX35RNBOC7Io7mZdNtqD2dTK0WF9WnxHeNuHKDpdwVMxYEhBRkHZ
	 3UjPsCvOW9IHGCz00w==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from [192.168.16.89] ([94.136.29.99]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MFKKh-1sUrS53j6f-006Who; Fri, 26
 Jul 2024 14:51:20 +0200
Message-ID: <075ee2d4-c1c7-4a3e-8c25-e17ca67ec8a9@gmx.net>
Date: Fri, 26 Jul 2024 14:51:20 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [pve-devel] [PATCH pve-manager] sdn: vnets: Hide irrelevant
 fields depending on zone type
To: Stefan Hanreich <s.hanreich@proxmox.com>, pve-devel@lists.proxmox.com
References: <20231222104316.107600-1-s.hanreich@proxmox.com>
Content-Language: en-US
From: Theodor Fumics <theodor.fumics@gmx.net>
In-Reply-To: <20231222104316.107600-1-s.hanreich@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:Ww8M5tr/KsnFVQwGD7xYx2WA1WMWoIzUm69iP0jo6mKuBkRzT9h
 mlsMa0dqeA96x+xUDTtjRKcLKBamWpU+yWkJzC6pexhAsouEqE0wpYXkRduL7iHADzVCGw1
 mlXlC7a2fQ/IG4md5CuoqLT54+j4ySFk5J2J8iMEFkBy0F7oe/+g45R6Djsdp+ZUjVN5MtH
 ScR4h/n8s613NZCeXbedw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:SxgoHMYgGzc=;4KXAgr97dnN50DXJ3vyyQ3bBx+V
 TLVegnyEPx+MXz9p1gi+m5M8G+jGtmuBWjzMfCP5yEp2oPr/cWPhCqIGPd33/1uu+7KZ3nHvT
 J75kl+WQTAHrHHrZ1gi9u8D1fXa6sQxrz35k+VIeezsOwQ0pbsPj3dyNnKxHiqDuYanrYX77+
 eO+ZtuQ5pXnkfFvc6po6pzmTmb//qB2t3YpMvaUog4Ih+6Oxvugh/hLoXQn8e46emtI+xbsmr
 Uf3AY/ih+QW5LT9p/NKLzln0L0ZNqEaLEQfxZdfNWXwZnmdVJpoibHgrOmNl2K2OHXOclDKlx
 0AAV9M55cJ6ZOZJTtl7HHdtUqwqka8hv8p24kDJKplAL9zjbO9PNvc3gCEzuPSsfUcZwcV8dH
 lM5gDMMyH0Zmip1rbZLFCE6AUPDyZfpQZYU1VcisxggiHgzdTxNfskU+bsi/uBAocwxvPb9R7
 rGFMIbkhqjyqloZZRItX99ce4pDqsq0h908+AV9wlA3xFK2VlX2qoU+CBVGk4F2qaLsasGmhO
 rYgIzKfEbu7p3FeeNhLqf/1KSCjt9oAnjoA+l+LNEeiuyywvxYVSQsKj77L5oSmHHCN60rHAU
 gOOQ/88OxZ9dKz7trP+ocQE1F9PUezveGklykXS0s3dci+wRQRMzGNdGqg+McQP5728Nf50O1
 rmNqPmvO7ckJlHkxJfQQOg2mHAO51SosO3YrnMoWMpFyV/rOHQ9RXjtb4HbDGuMCAx+MD2NMq
 G4vtrq6WuhhbYOkoz5K1ZVL/dWbiseJQmR+L/DRxOSruf4Q8/9DT+hdSXNl5F41Mu2CG0zLmA
 EQ9Ks3Q+2Y2Hcx5X3e5lrjpQ==
X-SPAM-LEVEL: Spam detection results:  0
	AWL                     0.000 Adjusted score from AWL reputation of From: address
	BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
	DKIM_SIGNED               0.1 Message has a DKIM or DK signature, not necessarily valid
	DKIM_VALID               -0.1 Message has at least one valid DKIM or DK signature
	DKIM_VALID_AU            -0.1 Message has a valid DKIM or DK signature from author's domain
	DKIM_VALID_EF            -0.1 Message has a valid DKIM or DK signature from envelope-from domain
	DMARC_PASS               -0.1 DMARC pass policy
	FREEMAIL_FROM           0.001 Sender email is commonly abused enduser mail provider
	RCVD_IN_DNSWL_LOW        -0.7 Sender listed at https://www.dnswl.org/, low trust
	RCVD_IN_MSPIKE_H2      -0.001 Average reputation (+2)
	SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
	SPF_PASS               -0.001 SPF: sender matches SPF record

I=E2=80=99ve tested the changes thoroughly. The fields in the VnetEdit dia=
log
now correctly hide based on the selected zone type. For the EVPN zone
type, the VLAN Aware field is hidden, and for the simple zone type, the
tag field is correctly hidden. Everything is working perfectly.

Tested-by: Theodor Fumics <theodor.fumics@gmx.net>
Reviewed-by: Theodor Fumics <theodor.fumics@gmx.net>

On 12/22/23 11:43, Stefan Hanreich wrote:
> Not all fields in the VnetEdit dialog are necessary for every zone
> type. This lead to confusion for some users. Hide fields in the
> VNetEdit dialog depending on which kind of zone is selected in order
> to prevent potential confusion.
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
>   www/manager6/form/SDNZoneSelector.js |  2 +-
>   www/manager6/sdn/VnetEdit.js         | 40 ++++++++++++++++++++++++++++
>   2 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/www/manager6/form/SDNZoneSelector.js b/www/manager6/form/SD=
NZoneSelector.js
> index 28c3457d2..0d0327529 100644
> --- a/www/manager6/form/SDNZoneSelector.js
> +++ b/www/manager6/form/SDNZoneSelector.js
> @@ -40,7 +40,7 @@ Ext.define('PVE.form.SDNZoneSelector', {
>   }, function() {
>       Ext.define('pve-sdn-zone', {
>   	extend: 'Ext.data.Model',
> -	fields: ['zone'],
> +	fields: ['zone', 'type'],
>   	proxy: {
>               type: 'proxmox',
>   	    url: "/api2/json/cluster/sdn/zones",
> diff --git a/www/manager6/sdn/VnetEdit.js b/www/manager6/sdn/VnetEdit.js
> index cdd83ed40..9fb6cd6c7 100644
> --- a/www/manager6/sdn/VnetEdit.js
> +++ b/www/manager6/sdn/VnetEdit.js
> @@ -12,6 +12,13 @@ Ext.define('PVE.sdn.VnetInputPanel', {
>   	return values;
>       },
>
> +    initComponent: function() {
> +	let me =3D this;
> +
> +	me.callParent();
> +	me.setZoneType(undefined);
> +    },
> +
>       items: [
>   	{
>   	    xtype: 'pmxDisplayEditField',
> @@ -40,9 +47,21 @@ Ext.define('PVE.sdn.VnetInputPanel', {
>   	    name: 'zone',
>   	    value: '',
>   	    allowBlank: false,
> +	    listeners: {
> +		change: function() {
> +		    let me =3D this;
> +
> +		    let record =3D me.findRecordByValue(me.value);
> +		    let zoneType =3D record?.data?.type;
> +
> +		    let panel =3D me.up('panel');
> +		    panel.setZoneType(zoneType);
> +		},
> +	    },
>   	},
>   	{
>   	    xtype: 'proxmoxintegerfield',
> +	    itemId: 'sdnVnetTagField',
>   	    name: 'tag',
>   	    minValue: 1,
>   	    maxValue: 16777216,
> @@ -54,6 +73,7 @@ Ext.define('PVE.sdn.VnetInputPanel', {
>   	},
>   	{
>   	    xtype: 'proxmoxcheckbox',
> +	    itemId: 'sdnVnetVlanAwareField',
>   	    name: 'vlanaware',
>   	    uncheckedValue: null,
>   	    checked: false,
> @@ -63,6 +83,26 @@ Ext.define('PVE.sdn.VnetInputPanel', {
>   	    },
>   	},
>       ],
> +
> +    setZoneType: function(zoneType) {
> +	let me =3D this;
> +
> +	let tagField =3D me.down('#sdnVnetTagField');
> +	if (!zoneType || zoneType =3D=3D=3D 'simple') {
> +	    tagField.setVisible(false);
> +	    tagField.setValue('');
> +	} else {
> +	    tagField.setVisible(true);
> +	}
> +
> +	let vlanField =3D me.down('#sdnVnetVlanAwareField');
> +	if (!zoneType || zoneType =3D=3D=3D 'evpn') {
> +	    vlanField.setVisible(false);
> +	    vlanField.setValue('');
> +	} else {
> +	    vlanField.setVisible(true);
> +	}
> +    },
>   });
>
>   Ext.define('PVE.sdn.VnetEdit', {


--===============7209080379661170673==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

--===============7209080379661170673==--