[pve-devel] [PATCH pve-manager] sdn: adapt edit panels for new API endpoints
Stefan Hanreich
s.hanreich at proxmox.com
Wed Nov 22 18:41:05 CET 2023
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 at 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
More information about the pve-devel
mailing list