From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 0E34991790 for ; Thu, 4 Apr 2024 12:01:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E057D366F4 for ; Thu, 4 Apr 2024 12:00:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 4 Apr 2024 12:00:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 780BD4525F for ; Thu, 4 Apr 2024 12:00:49 +0200 (CEST) From: Stefan Lendl To: pbs-devel@lists.proxmox.com Date: Thu, 4 Apr 2024 12:00:28 +0200 Message-ID: <20240404100036.188225-2-s.lendl@proxmox.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404100036.188225-1-s.lendl@proxmox.com> References: <20240404100036.188225-1-s.lendl@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.023 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 Subject: [pbs-devel] [PATCH widget-toolkit v3 1/9] form: include vlan field widget from PVE X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Apr 2024 10:01:24 -0000 Copied from PVE to use in PBS network configuration. Signed-off-by: Stefan Lendl Tested-by: Lukas Wagner Reviewed-by: Lukas Wagner --- src/Makefile | 1 + src/form/VlanField.js | 40 ++++++++++++++++++++++++++++++++++++++++ src/node/NetworkEdit.js | 6 +++--- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/form/VlanField.js diff --git a/src/Makefile b/src/Makefile index 89f9962..0b1e88c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -31,6 +31,7 @@ JSSRC= \ form/ExpireDate.js \ form/IntegerField.js \ form/TextField.js \ + form/VlanField.js \ form/DateTimeField.js \ form/Checkbox.js \ form/KVComboBox.js \ diff --git a/src/form/VlanField.js b/src/form/VlanField.js new file mode 100644 index 0000000..71b580d --- /dev/null +++ b/src/form/VlanField.js @@ -0,0 +1,40 @@ +Ext.define('Proxmox.form.field.VlanField', { + extend: 'Ext.form.field.Number', + alias: ['widget.proxmoxvlanfield'], + + deleteEmpty: false, + + emptyText: gettext('no VLAN'), + + fieldLabel: gettext('VLAN Tag'), + + allowBlank: true, + + getSubmitData: function() { + var me = this, + data = null, + val; + if (!me.disabled && me.submitValue) { + val = me.getSubmitValue(); + if (val) { + data = {}; + data[me.getName()] = val; + } else if (me.deleteEmpty) { + data = {}; + data.delete = me.getName(); + } + } + return data; + }, + + initComponent: function() { + var me = this; + + Ext.apply(me, { + minValue: 1, + maxValue: 4094, + }); + + me.callParent(); + }, +}); diff --git a/src/node/NetworkEdit.js b/src/node/NetworkEdit.js index bb9add3..b81a21d 100644 --- a/src/node/NetworkEdit.js +++ b/src/node/NetworkEdit.js @@ -97,7 +97,7 @@ Ext.define('Proxmox.node.NetworkEdit', { name: 'ovs_bridge', }); column2.push({ - xtype: 'pveVlanField', + xtype: 'proxmoxvlanfield', deleteEmpty: !me.isCreate, name: 'ovs_tag', value: '', @@ -140,7 +140,7 @@ Ext.define('Proxmox.node.NetworkEdit', { }); column2.push({ - xtype: 'pveVlanField', + xtype: 'proxmoxvlanfield', name: 'vlan-id', value: me.vlanidvalue, disabled: me.disablevlanid, @@ -211,7 +211,7 @@ Ext.define('Proxmox.node.NetworkEdit', { name: 'ovs_bridge', }); column2.push({ - xtype: 'pveVlanField', + xtype: 'proxmoxvlanfield', deleteEmpty: !me.isCreate, name: 'ovs_tag', value: '', -- 2.44.0