public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling
@ 2021-02-08 12:41 Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 2/5] vlan edit: Forbid blank vlan raw device Dominic Jäger
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dominic Jäger @ 2021-02-08 12:41 UTC (permalink / raw)
  To: pve-devel

The regex are are created as literals (with // and not new RegExp).
Therefore
 - The old Vlan_match value with double \\  has matched e.g. vlan\ddd instead
   of e.g. vlan123 and
 - the old VlanInterface_match value with double \\ has matched e.g.
   \www\X\dddd instead of e.g. vmbr0.1234

This fixes automatically disabling the fields vlan-raw-device and vlan-id (VLAN
tag) in the VLAN edit window.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 src/Utils.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Utils.js b/src/Utils.js
index 7b78eeb..af5f1db 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -854,7 +854,7 @@ utilities: {
 	me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(?::(\\d+))?$");
 	me.HostPortBrackets_match = new RegExp("^\\[(" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](?::(\\d+))?$");
 	me.IP6_dotnotation_match = new RegExp("^(" + IPV6_REGEXP + ")(?:\\.(\\d+))?$");
-	me.Vlan_match = /^vlan(\\d+)/;
-	me.VlanInterface_match = /(\\w+)\\.(\\d+)/;
+	me.Vlan_match = /^vlan(\d+)/;
+	me.VlanInterface_match = /(\w+)\.(\d+)/;
     },
 });
-- 
2.20.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH widget-toolkit 2/5] vlan edit: Forbid blank vlan raw device
  2021-02-08 12:41 [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Dominic Jäger
@ 2021-02-08 12:41 ` Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 3/5] vlan edit: Move example from default value to tooltip Dominic Jäger
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominic Jäger @ 2021-02-08 12:41 UTC (permalink / raw)
  To: pve-devel

Users certainly have to insert a vlan raw device when the textfield is enabled.
Currently, they only see `invalid network interface name "` when submitting.
Forbidding the blank field shows the problem earlier.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 src/node/NetworkEdit.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/node/NetworkEdit.js b/src/node/NetworkEdit.js
index b2d1077..35edc31 100644
--- a/src/node/NetworkEdit.js
+++ b/src/node/NetworkEdit.js
@@ -128,6 +128,7 @@ Ext.define('Proxmox.node.NetworkEdit', {
 		name: 'vlan-raw-device',
 		value: me.vlanrawdevicevalue,
 		disabled: me.disablevlanrawdevice,
+		allowBlank: false,
 	    });
 
 	    column2.push({
-- 
2.20.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH widget-toolkit 3/5] vlan edit: Move example from default value to tooltip
  2021-02-08 12:41 [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 2/5] vlan edit: Forbid blank vlan raw device Dominic Jäger
@ 2021-02-08 12:41 ` Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 4/5] vlan edit: Set valid default name Dominic Jäger
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dominic Jäger @ 2021-02-08 12:41 UTC (permalink / raw)
  To: pve-devel

We usually choose default values that are valid input for the field.
interfaceX.1 is rejected by the API.

Instead, use a tooltip to demonstrate possible valid inputs for the field.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 src/node/NetworkEdit.js | 4 ++++
 src/node/NetworkView.js | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/node/NetworkEdit.js b/src/node/NetworkEdit.js
index 35edc31..9e56360 100644
--- a/src/node/NetworkEdit.js
+++ b/src/node/NetworkEdit.js
@@ -246,6 +246,10 @@ Ext.define('Proxmox.node.NetworkEdit', {
 	    value: me.iface,
 	    vtype: iface_vtype,
 	    allowBlank: false,
+	    autoEl: {
+		tag: 'div',
+		 'data-qtip': gettext('For example, vmbr0.100, vmbr0, vlan0.100, vlan0'),
+	    },
 	    listeners: {
 		change: function(f, value) {
 		    if (me.isCreate && iface_vtype === 'VlanName') {
diff --git a/src/node/NetworkView.js b/src/node/NetworkView.js
index 886b8de..4805636 100644
--- a/src/node/NetworkView.js
+++ b/src/node/NetworkView.js
@@ -235,7 +235,6 @@ Ext.define('Proxmox.node.NetworkView', {
 		    let win = Ext.create('Proxmox.node.NetworkEdit', {
 			nodename: me.nodename,
 			iftype: 'vlan',
-			iface_default: 'interfaceX.1',
 			onlineHelp: 'sysadmin_network_configuration',
 		    });
 		    win.on('destroy', reload);
-- 
2.20.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH widget-toolkit 4/5] vlan edit: Set valid default name
  2021-02-08 12:41 [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 2/5] vlan edit: Forbid blank vlan raw device Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 3/5] vlan edit: Move example from default value to tooltip Dominic Jäger
@ 2021-02-08 12:41 ` Dominic Jäger
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 5/5] vlan edit: Match explicit values to name field Dominic Jäger
  2021-02-09 13:29 ` [pve-devel] applied-series: [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Dominic Jäger @ 2021-02-08 12:41 UTC (permalink / raw)
  To: pve-devel

Using find_next_iface_id we get a valid VLAN name.
This way, inserting a vlan raw device is still required (but everything that is
inserted so far is valid).

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
Wasn't sure if we want this. Feel free to squash with previous 3/5.

 src/node/NetworkView.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/node/NetworkView.js b/src/node/NetworkView.js
index 4805636..a1570ce 100644
--- a/src/node/NetworkView.js
+++ b/src/node/NetworkView.js
@@ -235,6 +235,7 @@ Ext.define('Proxmox.node.NetworkView', {
 		    let win = Ext.create('Proxmox.node.NetworkEdit', {
 			nodename: me.nodename,
 			iftype: 'vlan',
+			iface_default: find_next_iface_id('vlan'),
 			onlineHelp: 'sysadmin_network_configuration',
 		    });
 		    win.on('destroy', reload);
-- 
2.20.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH widget-toolkit 5/5] vlan edit: Match explicit values to name field
  2021-02-08 12:41 [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Dominic Jäger
                   ` (2 preceding siblings ...)
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 4/5] vlan edit: Set valid default name Dominic Jäger
@ 2021-02-08 12:41 ` Dominic Jäger
  2021-02-09 13:29 ` [pve-devel] applied-series: [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Dominic Jäger @ 2021-02-08 12:41 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 src/node/NetworkEdit.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/node/NetworkEdit.js b/src/node/NetworkEdit.js
index 9e56360..d1ac454 100644
--- a/src/node/NetworkEdit.js
+++ b/src/node/NetworkEdit.js
@@ -258,8 +258,22 @@ Ext.define('Proxmox.node.NetworkEdit', {
 			if (Proxmox.Utils.VlanInterface_match.test(value)) {
 			    vlanidField.setDisabled(true);
 			    vlanrawdeviceField.setDisabled(true);
+			    // User defined those values in the `iface` (Name)
+			    // field. Match them (instead of leaving the
+			    // previous value) to make clear what is submitted
+			    // and how the fields `iface`, `vlan-id` and
+			    // `vlan-raw-device` are connected
+			    vlanidField.setValue(
+				value.match(Proxmox.Utils.VlanInterface_match)[2],
+			    );
+			    vlanrawdeviceField.setValue(
+				value.match(Proxmox.Utils.VlanInterface_match)[1],
+			    );
 			} else if (Proxmox.Utils.Vlan_match.test(value)) {
 			    vlanidField.setDisabled(true);
+			    vlanidField.setValue(
+				value.match(Proxmox.Utils.Vlan_match)[1],
+			    );
 			    vlanrawdeviceField.setDisabled(false);
 			} else {
 			    vlanidField.setDisabled(false);
-- 
2.20.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied-series: [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling
  2021-02-08 12:41 [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Dominic Jäger
                   ` (3 preceding siblings ...)
  2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 5/5] vlan edit: Match explicit values to name field Dominic Jäger
@ 2021-02-09 13:29 ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2021-02-09 13:29 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominic Jäger

On 08.02.21 13:41, Dominic Jäger wrote:
> The regex are are created as literals (with // and not new RegExp).
> Therefore
>  - The old Vlan_match value with double \\  has matched e.g. vlan\ddd instead
>    of e.g. vlan123 and
>  - the old VlanInterface_match value with double \\ has matched e.g.
>    \www\X\dddd instead of e.g. vmbr0.1234
> 
> This fixes automatically disabling the fields vlan-raw-device and vlan-id (VLAN
> tag) in the VLAN edit window.
> 
> Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
> ---
>  src/Utils.js | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

applied series, much thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-09 13:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 12:41 [pve-devel] [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Dominic Jäger
2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 2/5] vlan edit: Forbid blank vlan raw device Dominic Jäger
2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 3/5] vlan edit: Move example from default value to tooltip Dominic Jäger
2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 4/5] vlan edit: Set valid default name Dominic Jäger
2021-02-08 12:41 ` [pve-devel] [PATCH widget-toolkit 5/5] vlan edit: Match explicit values to name field Dominic Jäger
2021-02-09 13:29 ` [pve-devel] applied-series: [PATCH widget-toolkit 1/5] vlan edit: Fix automatic field disabling Thomas Lamprecht

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