[pve-devel] [PATCH pve-manager] ui: sdn: zonedit: fix display && refactor
Alexandre Derumier
aderumier at odiso.com
Sat Jun 17 14:43:05 CEST 2023
move ipam selector to main items as it's non optional, and it's breaking
display if present in advanced.
move common id,mtu,nodes fields from modules to base
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
www/manager6/sdn/zones/Base.js | 34 ++++++++++++++++++++++++++--
www/manager6/sdn/zones/EvpnEdit.js | 27 ----------------------
www/manager6/sdn/zones/QinQEdit.js | 26 ---------------------
www/manager6/sdn/zones/SimpleEdit.js | 30 +-----------------------
www/manager6/sdn/zones/VlanEdit.js | 27 ----------------------
www/manager6/sdn/zones/VxlanEdit.js | 26 ---------------------
6 files changed, 33 insertions(+), 137 deletions(-)
diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index 347889c0..655352a8 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -18,14 +18,44 @@ Ext.define('PVE.panel.SDNZoneBase', {
initComponent: function() {
var me = this;
- me.advancedItems = [
+ me.items.unshift({
+ xtype: me.isCreate ? 'textfield' : 'displayfield',
+ name: 'zone',
+ maxLength: 8,
+ value: me.zone || '',
+ fieldLabel: 'ID',
+ allowBlank: false,
+ });
+
+ me.items.push(
+ {
+ xtype: 'proxmoxintegerfield',
+ name: 'mtu',
+ minValue: 100,
+ maxValue: 65000,
+ fieldLabel: 'MTU',
+ skipEmptyText: true,
+ allowBlank: true,
+ emptyText: 'auto',
+ },
+ {
+ xtype: 'pveNodeSelector',
+ name: 'nodes',
+ fieldLabel: gettext('Nodes'),
+ emptyText: gettext('All') + ' (' + gettext('No restrictions') +')',
+ multiSelect: true,
+ autoSelect: false,
+ },
{
xtype: 'pveSDNIpamSelector',
fieldLabel: gettext('Ipam'),
name: 'ipam',
- value: 'pve',
+ value: me.ipam || 'pve',
allowBlank: false,
},
+ );
+
+ me.advancedItems = [
{
xtype: 'pveSDNDnsSelector',
fieldLabel: gettext('Dns server'),
diff --git a/www/manager6/sdn/zones/EvpnEdit.js b/www/manager6/sdn/zones/EvpnEdit.js
index f1314ad5..1d13976c 100644
--- a/www/manager6/sdn/zones/EvpnEdit.js
+++ b/www/manager6/sdn/zones/EvpnEdit.js
@@ -39,14 +39,6 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
var me = this;
me.items = [
- {
- xtype: me.isCreate ? 'textfield' : 'displayfield',
- name: 'zone',
- maxLength: 8,
- value: me.zone || '',
- fieldLabel: 'ID',
- allowBlank: false,
- },
{
xtype: 'pveSDNControllerSelector',
fieldLabel: gettext('Controller'),
@@ -111,25 +103,6 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
fieldLabel: gettext('Route-target import'),
allowBlank: true,
},
- {
- xtype: 'proxmoxintegerfield',
- name: 'mtu',
- minValue: 100,
- maxValue: 65000,
- fieldLabel: 'MTU',
- skipEmptyText: true,
- allowBlank: true,
- emptyText: 'auto',
- },
- {
- xtype: 'pveNodeSelector',
- name: 'nodes',
- fieldLabel: gettext('Nodes'),
- emptyText: gettext('All') + ' (' + gettext('No restrictions') +')',
- multiSelect: true,
- autoSelect: false,
- },
-
];
me.callParent();
diff --git a/www/manager6/sdn/zones/QinQEdit.js b/www/manager6/sdn/zones/QinQEdit.js
index d9e117d9..c059a7a2 100644
--- a/www/manager6/sdn/zones/QinQEdit.js
+++ b/www/manager6/sdn/zones/QinQEdit.js
@@ -19,14 +19,6 @@ Ext.define('PVE.sdn.zones.QinQInputPanel', {
let me = this;
me.items = [
- {
- xtype: me.isCreate ? 'textfield' : 'displayfield',
- name: 'zone',
- maxLength: 8,
- value: me.zone || '',
- fieldLabel: 'ID',
- allowBlank: false,
- },
{
xtype: 'textfield',
name: 'bridge',
@@ -52,24 +44,6 @@ Ext.define('PVE.sdn.zones.QinQInputPanel', {
['802.1ad', '802.1ad'],
],
},
- {
- xtype: 'proxmoxintegerfield',
- name: 'mtu',
- minValue: 100,
- maxValue: 65000,
- fieldLabel: 'MTU',
- skipEmptyText: true,
- allowBlank: true,
- emptyText: 'auto',
- },
- {
- xtype: 'pveNodeSelector',
- name: 'nodes',
- fieldLabel: gettext('Nodes'),
- emptyText: gettext('All') + ' (' + gettext('No restrictions') +')',
- multiSelect: true,
- autoSelect: false,
- },
];
me.callParent();
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index 56df7952..cb7c3403 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -18,35 +18,7 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
initComponent: function() {
var me = this;
- me.items = [
- {
- xtype: me.isCreate ? 'textfield' : 'displayfield',
- name: 'zone',
- maxLength: 10,
- value: me.zone || '',
- fieldLabel: 'ID',
- allowBlank: false,
- },
- {
- xtype: 'proxmoxintegerfield',
- name: 'mtu',
- minValue: 100,
- maxValue: 65000,
- fieldLabel: 'MTU',
- skipEmptyText: true,
- allowBlank: true,
- emptyText: 'auto',
- },
- {
- xtype: 'pveNodeSelector',
- name: 'nodes',
- fieldLabel: gettext('Nodes'),
- emptyText: gettext('All') + ' (' + gettext('No restrictions') +')',
- multiSelect: true,
- autoSelect: false,
- },
-
- ];
+ me.items = [];
me.callParent();
},
diff --git a/www/manager6/sdn/zones/VlanEdit.js b/www/manager6/sdn/zones/VlanEdit.js
index 93d2bede..23530bfc 100644
--- a/www/manager6/sdn/zones/VlanEdit.js
+++ b/www/manager6/sdn/zones/VlanEdit.js
@@ -19,39 +19,12 @@ Ext.define('PVE.sdn.zones.VlanInputPanel', {
var me = this;
me.items = [
- {
- xtype: me.isCreate ? 'textfield' : 'displayfield',
- name: 'zone',
- maxLength: 10,
- value: me.zone || '',
- fieldLabel: 'ID',
- allowBlank: false,
- },
{
xtype: 'textfield',
name: 'bridge',
fieldLabel: 'Bridge',
allowBlank: false,
},
- {
- xtype: 'proxmoxintegerfield',
- name: 'mtu',
- minValue: 100,
- maxValue: 65000,
- fieldLabel: 'MTU',
- skipEmptyText: true,
- allowBlank: true,
- emptyText: 'auto',
- },
- {
- xtype: 'pveNodeSelector',
- name: 'nodes',
- fieldLabel: gettext('Nodes'),
- emptyText: gettext('All') + ' (' + gettext('No restrictions') +')',
- multiSelect: true,
- autoSelect: false,
- },
-
];
me.callParent();
diff --git a/www/manager6/sdn/zones/VxlanEdit.js b/www/manager6/sdn/zones/VxlanEdit.js
index 41cc7e68..b556790d 100644
--- a/www/manager6/sdn/zones/VxlanEdit.js
+++ b/www/manager6/sdn/zones/VxlanEdit.js
@@ -21,38 +21,12 @@ Ext.define('PVE.sdn.zones.VxlanInputPanel', {
var me = this;
me.items = [
- {
- xtype: me.isCreate ? 'textfield' : 'displayfield',
- maxLength: 8,
- name: 'zone',
- value: me.zone || '',
- fieldLabel: 'ID',
- allowBlank: false,
- },
{
xtype: 'textfield',
name: 'peers',
fieldLabel: gettext('Peer Address List'),
allowBlank: false,
},
- {
- xtype: 'proxmoxintegerfield',
- name: 'mtu',
- minValue: 100,
- maxValue: 65000,
- fieldLabel: 'MTU',
- skipEmptyText: true,
- allowBlank: true,
- emptyText: 'auto',
- },
- {
- xtype: 'pveNodeSelector',
- name: 'nodes',
- fieldLabel: gettext('Nodes'),
- emptyText: gettext('All') + ' (' + gettext('No restrictions') +')',
- multiSelect: true,
- autoSelect: false,
- },
];
me.callParent();
--
2.39.2
More information about the pve-devel
mailing list