From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8783F1FF15E for ; Fri, 26 Jul 2024 15:33:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E4AA61EB03; Fri, 26 Jul 2024 15:33:04 +0200 (CEST) To: pve-devel@lists.proxmox.com Date: Fri, 26 Jul 2024 15:27:45 +0200 MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Theodor Fumics via pve-devel Precedence: list Cc: Theodor Fumics X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: [pve-devel] [PATCH manager] sdn: subnets: hide irrelevant fields depending on zone type Content-Type: multipart/mixed; boundary="===============4650268781587992726==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============4650268781587992726== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: 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 6F5D0C3A7C for ; Fri, 26 Jul 2024 15:33:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4C2711EA62 for ; Fri, 26 Jul 2024 15:33:02 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (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 ; Fri, 26 Jul 2024 15:33:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1722000781; x=1722605581; i=theodor.fumics@gmx.net; bh=Z7LghGCVKQVlsfUc+BaY4T6uwPQR4Vvna9QAkwMDFS8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id: MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Ij50g30bQgnv1Wdvv0HNo7cTRqj6nKXdA1nnzYFfj2TnjSnYHi55Z+QNV7eVbKiQ c3Gd6NZwoZUNBTXgRp4MH+CSWMFCc0s/2Jc4hr+Gstua28WrIDSqVQQjhzxxrRyPh SWFxWhOrABA89Ekv0cfiw0N0wdeSkrQcZuSM6aogoe3Y8LjC2Uwb9NOPxVBMQqbNI U9F3IeN8OLyTM8gLwG2JSux8+0KVviplXFLiDH7ceSV1n0ebNaBKYTmiEBQfXYNX6 MwTWzhvIOMFpE1ZyCU1/F0rGX8dSKr/Us9p8LnmoigBSecAFjb6WP228tUn74SGTH bOY/Iz5lWE9qKIkflw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from praktikum3.proxmox.com ([94.136.29.99]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MiJZO-1s2y2b0Jkc-00nnFI; Fri, 26 Jul 2024 15:27:51 +0200 From: Theodor Fumics To: pve-devel@lists.proxmox.com Subject: [PATCH manager] sdn: subnets: hide irrelevant fields depending on zone type Date: Fri, 26 Jul 2024 15:27:45 +0200 Message-Id: <20240726132745.168971-1-theodor.fumics@gmx.net> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:b2Ba6ycXRgEuKNL66W1EIeqpNy4a6PrB4qbXpBUcAEgqAxiy4S0 xrRCA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AM-LEVEL: Spam detection results: 0 AWL -0.001 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_H3 0.001 Good reputation (+3) RCVD_IN_MSPIKE_WL 0.001 Mailspike good senders SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record The SNAT option is only applicable to Simple and EVPN zone types. For other zone types, this field is irrelevant and can cause confusion. This commit hides the SNAT field when it is not applicable to the selected zone type, improving clarity for users. Signed-off-by: Theodor Fumics =2D-- www/manager6/sdn/SubnetEdit.js | 18 ++++++++++++++++++ www/manager6/sdn/SubnetView.js | 16 ++++++++++++++++ www/manager6/sdn/VnetView.js | 9 +++++++++ 3 files changed, 43 insertions(+) diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.= js index 8fc3f52b..d80eeca2 100644 =2D-- a/www/manager6/sdn/SubnetEdit.js +++ b/www/manager6/sdn/SubnetEdit.js @@ -2,6 +2,8 @@ Ext.define('PVE.sdn.SubnetInputPanel', { extend: 'Proxmox.panel.InputPanel', mixins: ['Proxmox.Mixin.CBind'], + zoneInfo: undefined, + onGetValues: function(values) { let me =3D this; @@ -38,6 +40,7 @@ Ext.define('PVE.sdn.SubnetInputPanel', { }, { xtype: 'proxmoxcheckbox', + itemId: 'snatSubnetCheckbox', name: 'snat', uncheckedValue: null, checked: false, @@ -57,6 +60,18 @@ Ext.define('PVE.sdn.SubnetInputPanel', { }, }, ], + + initComponent: function() { + let me =3D this; + me.callParent(); + + let zoneType =3D me.zoneInfo?.type; + + var showSNATCheckbox =3D ['simple', 'evpn'].includes(zoneType); + + var snatCheckbox =3D me.down('#snatSubnetCheckbox'); + snatCheckbox.setHidden(!showSNATCheckbox); + }, }); Ext.define('PVE.sdn.SubnetDhcpRangePanel', { @@ -243,6 +258,8 @@ Ext.define('PVE.sdn.SubnetEdit', { base_url: undefined, + zoneInfo: undefined, + bodyPadding: 0, initComponent: function() { @@ -261,6 +278,7 @@ Ext.define('PVE.sdn.SubnetEdit', { let ipanel =3D Ext.create('PVE.sdn.SubnetInputPanel', { isCreate: me.isCreate, title: gettext('General'), + zoneInfo: me.zoneInfo, }); let dhcpPanel =3D Ext.create('PVE.sdn.SubnetDhcpRangePanel', { diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.= js index d342f0ba..fd103d78 100644 =2D-- a/www/manager6/sdn/SubnetView.js +++ b/www/manager6/sdn/SubnetView.js @@ -7,6 +7,9 @@ Ext.define('PVE.sdn.SubnetView', { base_url: undefined, + zoneName: undefined, + zoneInfo: undefined, + remove_btn: undefined, setBaseUrl: function(url) { @@ -28,6 +31,18 @@ Ext.define('PVE.sdn.SubnetView', { } }, + loadZone: function(name) { + let me =3D this; + + Proxmox.Utils.API2Request({ + url: `/cluster/sdn/zones/${name}?pending=3D1`, + method: 'GET', + success: function(response) { + me.zoneInfo =3D response?.result?.data; + }, + }); + }, + initComponent: function() { let me =3D this; @@ -59,6 +74,7 @@ Ext.define('PVE.sdn.SubnetView', { let win =3D Ext.create('PVE.sdn.SubnetEdit', { autoShow: true, base_url: me.base_url, + zoneInfo: me.zoneInfo, type: 'subnet', }); win.on('destroy', reload); diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js index 3fd3c916..9c9dcc5b 100644 =2D-- a/www/manager6/sdn/VnetView.js +++ b/www/manager6/sdn/VnetView.js @@ -141,6 +141,15 @@ Ext.define('PVE.sdn.VnetView', { select: function(_sm, rec) { let url =3D `/cluster/sdn/vnets/${rec.data.vnet}/subnets`; me.subnetview_panel.setBaseUrl(url); + + let zoneName; + if (rec.data.pending) { + zoneName =3D rec.data.pending.zone; + } else { + zoneName =3D rec.data.zone; + } + + me.subnetview_panel.loadZone(zoneName); }, deselect: function() { me.subnetview_panel.setBaseUrl(undefined); =2D- 2.39.2 --===============4650268781587992726== 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 --===============4650268781587992726==--