* [pve-devel] [PATCH pve-manager] sdn: adapt edit panels for new API endpoints
@ 2023-11-22 17:41 Stefan Hanreich
2023-11-22 18:35 ` [pve-devel] applied: " Thomas Lamprecht
2023-11-23 7:30 ` [pve-devel] " Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hanreich @ 2023-11-22 17:41 UTC (permalink / raw)
To: pve-devel
PUT endpoints have changed so they work like the other SectionConfig
endpoints. Reflect those changes in the UI.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
www/manager6/sdn/SubnetEdit.js | 23 ++++++++++-------
www/manager6/sdn/VnetEdit.js | 18 +++++++++-----
www/manager6/sdn/zones/Base.js | 2 +-
www/manager6/sdn/zones/EvpnEdit.js | 37 ++++++++--------------------
www/manager6/sdn/zones/SimpleEdit.js | 3 ++-
5 files changed, 39 insertions(+), 44 deletions(-)
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index 8851b013a..8fc3f52b0 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -11,13 +11,6 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
delete values.cidr;
}
- if (!values.gateway) {
- delete values.gateway;
- }
- if (!values.snat) {
- delete values.snat;
- }
-
return values;
},
@@ -33,18 +26,25 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
fieldLabel: gettext('Subnet'),
},
{
- xtype: 'textfield',
+ xtype: 'proxmoxtextfield',
name: 'gateway',
vtype: 'IP64Address',
fieldLabel: gettext('Gateway'),
allowBlank: true,
+ skipEmptyText: true,
+ cbind: {
+ deleteEmpty: "{!isCreate}",
+ },
},
{
xtype: 'proxmoxcheckbox',
name: 'snat',
- uncheckedValue: 0,
+ uncheckedValue: null,
checked: false,
fieldLabel: 'SNAT',
+ cbind: {
+ deleteEmpty: "{!isCreate}",
+ },
},
{
xtype: 'proxmoxtextfield',
@@ -52,6 +52,9 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
skipEmptyText: true,
fieldLabel: gettext('DNS Zone Prefix'),
allowBlank: true,
+ cbind: {
+ deleteEmpty: "{!isCreate}",
+ },
},
],
});
@@ -101,6 +104,8 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
if (value.length) {
data[me.getName()] = value;
+ } else if (!me.isCreate) {
+ data.delete = me.getName();
}
return data;
diff --git a/www/manager6/sdn/VnetEdit.js b/www/manager6/sdn/VnetEdit.js
index 0f55595f8..cdd83ed40 100644
--- a/www/manager6/sdn/VnetEdit.js
+++ b/www/manager6/sdn/VnetEdit.js
@@ -9,10 +9,6 @@ Ext.define('PVE.sdn.VnetInputPanel', {
values.type = 'vnet';
}
- if (!values.vlanaware) {
- delete values.vlanaware;
- }
-
return values;
},
@@ -29,10 +25,14 @@ Ext.define('PVE.sdn.VnetInputPanel', {
fieldLabel: gettext('Name'),
},
{
- xtype: 'textfield',
+ xtype: 'proxmoxtextfield',
name: 'alias',
fieldLabel: gettext('Alias'),
allowBlank: true,
+ skipEmptyText: true,
+ cbind: {
+ deleteEmpty: "{!isCreate}",
+ },
},
{
xtype: 'pveSDNZoneSelector',
@@ -48,13 +48,19 @@ Ext.define('PVE.sdn.VnetInputPanel', {
maxValue: 16777216,
fieldLabel: gettext('Tag'),
allowBlank: true,
+ cbind: {
+ deleteEmpty: "{!isCreate}",
+ },
},
{
xtype: 'proxmoxcheckbox',
name: 'vlanaware',
- uncheckedValue: 0,
+ uncheckedValue: null,
checked: false,
fieldLabel: gettext('VLAN Aware'),
+ cbind: {
+ deleteEmpty: "{!isCreate}",
+ },
},
],
});
diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index db9b47b18..2eecb101a 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -34,9 +34,9 @@ Ext.define('PVE.panel.SDNZoneBase', {
minValue: 100,
maxValue: 65000,
fieldLabel: 'MTU',
- skipEmptyText: true,
allowBlank: true,
emptyText: 'auto',
+ deleteEmpty: !me.isCreate,
},
{
xtype: 'pveNodeSelector',
diff --git a/www/manager6/sdn/zones/EvpnEdit.js b/www/manager6/sdn/zones/EvpnEdit.js
index cac1ef4d5..a08faef2d 100644
--- a/www/manager6/sdn/zones/EvpnEdit.js
+++ b/www/manager6/sdn/zones/EvpnEdit.js
@@ -8,30 +8,8 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
if (me.isCreate) {
values.type = me.type;
- } else {
- delete values.zone;
}
- if (!values.mac) {
- delete values.mac;
- }
-
- if (values['advertise-subnets'] === 0) {
- delete values['advertise-subnets'];
- }
-
- if (values['exitnodes-local-routing'] === 0) {
- delete values['exitnodes-local-routing'];
- }
-
- if (values['disable-arp-nd-suppression'] === 0) {
- delete values['disable-arp-nd-suppression'];
- }
-
- if (values['exitnodes-primary'] === '') {
- delete values['exitnodes-primary'];
- }
-
return values;
},
@@ -55,12 +33,13 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
allowBlank: false,
},
{
- xtype: 'textfield',
+ xtype: 'proxmoxtextfield',
name: 'mac',
fieldLabel: gettext('VNet MAC Address'),
vtype: 'MacAddress',
allowBlank: true,
emptyText: 'auto',
+ deleteEmpty: !me.isCreate,
},
{
xtype: 'pveNodeSelector',
@@ -79,29 +58,33 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
{
xtype: 'proxmoxcheckbox',
name: 'exitnodes-local-routing',
- uncheckedValue: 0,
+ uncheckedValue: null,
checked: false,
fieldLabel: gettext('Exit Nodes Local Routing'),
+ deleteEmpty: !me.isCreate,
},
{
xtype: 'proxmoxcheckbox',
name: 'advertise-subnets',
- uncheckedValue: 0,
+ uncheckedValue: null,
checked: false,
fieldLabel: gettext('Advertise Subnets'),
+ deleteEmpty: !me.isCreate,
},
{
xtype: 'proxmoxcheckbox',
name: 'disable-arp-nd-suppression',
- uncheckedValue: 0,
+ uncheckedValue: null,
checked: false,
fieldLabel: gettext('Disable ARP-nd Suppression'),
+ deleteEmpty: !me.isCreate,
},
{
- xtype: 'textfield',
+ xtype: 'proxmoxtextfield',
name: 'rt-import',
fieldLabel: gettext('Route Target Import'),
allowBlank: true,
+ deleteEmpty: !me.isCreate,
},
];
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index 7a6f1d0d9..89bd0031f 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -24,9 +24,10 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
xtype: 'proxmoxcheckbox',
name: 'dhcp',
inputValue: 'dnsmasq',
- uncheckedValue: undefined,
+ uncheckedValue: null,
checked: false,
fieldLabel: gettext('automatic DHCP'),
+ deleteEmpty: !me.isCreate,
},
];
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH pve-manager] sdn: adapt edit panels for new API endpoints
2023-11-22 17:41 [pve-devel] [PATCH pve-manager] sdn: adapt edit panels for new API endpoints Stefan Hanreich
@ 2023-11-22 18:35 ` Thomas Lamprecht
2023-11-23 7:30 ` [pve-devel] " Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-11-22 18:35 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Hanreich
Am 22/11/2023 um 18:41 schrieb Stefan Hanreich:
> PUT endpoints have changed so they work like the other SectionConfig
> endpoints. Reflect those changes in the UI.
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> www/manager6/sdn/SubnetEdit.js | 23 ++++++++++-------
> www/manager6/sdn/VnetEdit.js | 18 +++++++++-----
> www/manager6/sdn/zones/Base.js | 2 +-
> www/manager6/sdn/zones/EvpnEdit.js | 37 ++++++++--------------------
> www/manager6/sdn/zones/SimpleEdit.js | 3 ++-
> 5 files changed, 39 insertions(+), 44 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [pve-devel] [PATCH pve-manager] sdn: adapt edit panels for new API endpoints
2023-11-22 17:41 [pve-devel] [PATCH pve-manager] sdn: adapt edit panels for new API endpoints Stefan Hanreich
2023-11-22 18:35 ` [pve-devel] applied: " Thomas Lamprecht
@ 2023-11-23 7:30 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-11-23 7:30 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Hanreich
For the record, two things inline
Am 22/11/2023 um 18:41 schrieb Stefan Hanreich:
> diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
> index db9b47b18..2eecb101a 100644
> --- a/www/manager6/sdn/zones/Base.js
> +++ b/www/manager6/sdn/zones/Base.js
> @@ -34,9 +34,9 @@ Ext.define('PVE.panel.SDNZoneBase', {
> minValue: 100,
> maxValue: 65000,
> fieldLabel: 'MTU',
> - skipEmptyText: true,
> allowBlank: true,
> emptyText: 'auto',
> + deleteEmpty: !me.isCreate,
FYI: CBind doesn't works here because the items are set in initComponents, but
the CBind mixin is configured to run before that (see its `mixinConfig`)
If you'd have switched all to a fully declarative implementation it would have
worked.
Maybe we could detect that explicitly (delete done cbinds in the current hook
and warn if any new is found on a newly introduced after-initComponent one)
> },
> {
> xtype: 'pveNodeSelector',
> diff --git a/www/manager6/sdn/zones/EvpnEdit.js b/www/manager6/sdn/zones/EvpnEdit.js
> index cac1ef4d5..a08faef2d 100644
> --- a/www/manager6/sdn/zones/EvpnEdit.js
> +++ b/www/manager6/sdn/zones/EvpnEdit.js
> @@ -8,30 +8,8 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
> + uncheckedValue: null,
> + deleteEmpty: !me.isCreate,
Same here w.r.t. cbind was not working, but what I actually asked myself why
we do not couple the deleteEmpty to uncheckedValue=null, as that makes no
sense otherwise.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-23 7:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 17:41 [pve-devel] [PATCH pve-manager] sdn: adapt edit panels for new API endpoints Stefan Hanreich
2023-11-22 18:35 ` [pve-devel] applied: " Thomas Lamprecht
2023-11-23 7:30 ` [pve-devel] " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox