public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Lendl <s.lendl@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH widget-toolkit 10/10] form: include VlanField from PVE
Date: Thu, 11 Jan 2024 16:53:13 +0100	[thread overview]
Message-ID: <20240111155303.1072675-21-s.lendl@proxmox.com> (raw)
In-Reply-To: <20240111155303.1072675-1-s.lendl@proxmox.com>

copied from PVE

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
---
 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 01145b1..6c65763 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..c30fa72
--- /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.42.0





  parent reply	other threads:[~2024-01-11 15:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 15:52 [pbs-devel] [PATCH widget-toolkit/proxmox-backup 00/10] Fix #3115: VLAN Network Interface Configuration Stefan Lendl
2024-01-11 15:52 ` [pbs-devel] [PATCH proxmox-backup 01/10] tests: move network tests to parser.rs Stefan Lendl
2024-01-11 15:52 ` [pbs-devel] [PATCH proxmox-backup 02/10] tests: rudimentary NetworkConfig.write_config tests Stefan Lendl
2024-01-11 15:52 ` [pbs-devel] [PATCH proxmox-backup 03/10] config: write vlan network interface Stefan Lendl
2024-01-17  9:50   ` Lukas Wagner
2024-01-11 15:53 ` [pbs-devel] [PATCH proxmox-backup 04/10] config: parse vlan interface from config Stefan Lendl
2024-01-11 15:53 ` [pbs-devel] [PATCH proxmox-backup 05/10] config: remove unnecessary pub in various methods in NetworkConfig Stefan Lendl
2024-01-17  9:50   ` Lukas Wagner
2024-01-11 15:53 ` [pbs-devel] [PATCH proxmox-backup 06/10] fmt: fix intendation in api macro Stefan Lendl
2024-01-11 15:53 ` [pbs-devel] [PATCH proxmox-backup 07/10] api: create and update vlan interfaces Stefan Lendl
2024-01-17  9:50   ` Lukas Wagner
2024-01-11 15:53 ` [pbs-devel] [PATCH proxmox-backup 08/10] refactor(api): simplify setting interface properties Stefan Lendl
2024-01-17  9:50   ` Lukas Wagner
2024-01-11 15:53 ` [pbs-devel] [PATCH proxmox-backup 09/10] ui: enable vlan widget Stefan Lendl
2024-01-11 15:53 ` Stefan Lendl [this message]
2024-01-11 16:01   ` [pbs-devel] [PATCH widget-toolkit 10/10] form: include VlanField from PVE Lukas Wagner
2024-01-17  9:50 ` [pbs-devel] [PATCH widget-toolkit/proxmox-backup 00/10] Fix #3115: VLAN Network Interface Configuration Lukas Wagner
2024-01-22 11:06 ` Stefan Lendl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240111155303.1072675-21-s.lendl@proxmox.com \
    --to=s.lendl@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal