[pve-devel] [PATCH v9 pve-manager 13/18] move ipams && dns options to zone

Alexandre Derumier aderumier at odiso.com
Thu Dec 3 11:34:20 CET 2020


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager6/Utils.js                |  4 +--
 www/manager6/sdn/SubnetEdit.js       | 39 +-------------------------
 www/manager6/sdn/SubnetView.js       | 23 ++-------------
 www/manager6/sdn/VnetEdit.js         | 10 ++-----
 www/manager6/sdn/ZoneView.js         | 42 ++++++++++++++++++++++++++--
 www/manager6/sdn/zones/Base.js       | 31 ++++++++++++++++++++
 www/manager6/sdn/zones/SimpleEdit.js |  1 -
 7 files changed, 78 insertions(+), 72 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 257af3fd..98cb8ca1 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -178,7 +178,7 @@ Ext.define('PVE.Utils', { utilities: {
     render_sdn_pending: function(rec,value,key, index) {
         if (rec.data.state === 'deleted') {
             if (value === undefined) {
-                return '';
+                return ' ';
             } else {
                 return '<div style="text-decoration: line-through;">'+ value +'</div>';
             }
@@ -188,7 +188,7 @@ Ext.define('PVE.Utils', { utilities: {
                 value = rec.data.pending[key];
             }
             if (value === undefined || value === null) {
-                value = '';
+                value = ' ';
             }
             return '<div style="color:green">' + value + '</div>';
         } else if (rec.data.state === 'changed') {
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index 653c8ae5..83c6961c 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -46,50 +46,13 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
 	    checked: false,
 	    fieldLabel: 'SNAT'
 	},
-    ],
-    advancedItems: [
-        {
-            xtype: 'pveSDNIpamSelector',
-            fieldLabel: gettext('Ipam'),
-            name: 'ipam',
-            value: 'pve',
-            allowBlank: false,
-        },
-        {
-            xtype: 'pveSDNDnsSelector',
-            fieldLabel: gettext('Dns server'),
-            name: 'dns',
-            value: '',
-            allowBlank: true,
-        },
-	{
-	    xtype: 'proxmoxtextfield',
-	    name: 'dnszone',
-	    skipEmptyText: true,
-	    fieldLabel: gettext('DNS zone'),
-	    allowBlank: true
-	},
 	{
 	    xtype: 'proxmoxtextfield',
 	    name: 'dnszoneprefix',
 	    skipEmptyText: true,
 	    fieldLabel: gettext('DNS zone prefix'),
 	    allowBlank: true
-	},
-        {
-            xtype: 'pveSDNDnsSelector',
-            fieldLabel: gettext('Reverse Dns server'),
-            name: 'reversedns',
-            value: '',
-            allowBlank: true,
-        },
-	{
-	    xtype: 'proxmoxtextfield',
-	    name: 'reversednszone',
-	    skipEmptyText: true,
-	    fieldLabel: gettext('Reverse DNS zone'),
-	    allowBlank: true
-	},
+	}
     ]
 });
 
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
index 0c04ddf1..bff047fb 100644
--- a/www/manager6/sdn/SubnetView.js
+++ b/www/manager6/sdn/SubnetView.js
@@ -124,30 +124,13 @@ Ext.define('PVE.sdn.SubnetView', {
                     }
 		},
 		{
-		    header: 'Ipam',
+		    header: gettext('Dns prefix'),
 		    flex: 1,
-		    dataIndex: 'ipam',
+		    dataIndex: 'dnszoneprefix',
                     renderer: function(value, metaData, rec) {
-                        return PVE.Utils.render_sdn_pending(rec, value, 'ipam');
+                        return PVE.Utils.render_sdn_pending(rec, value, 'dnszoneprefix');
                     }
 		},
-                {
-                    header: gettext('Pending'),
-                    flex: 3,
-                    dataIndex: 'pending',
-                    renderer: function(value, metaData, rec) {
-                        if(value !== undefined ) {
-                                delete value.cidr;
-                                delete value.gateway;
-                                delete value.snat;
-                                delete value.ipam;
-				if(!Ext.Object.isEmpty(value)){
-				    return JSON.stringify(value);
-				}
-                        }
-                        return '';
-                    }
-                },
 
 	    ],
 	    listeners: {
diff --git a/www/manager6/sdn/VnetEdit.js b/www/manager6/sdn/VnetEdit.js
index 03e539ab..af5d6cde 100644
--- a/www/manager6/sdn/VnetEdit.js
+++ b/www/manager6/sdn/VnetEdit.js
@@ -9,14 +9,8 @@ Ext.define('PVE.sdn.VnetInputPanel', {
 	    values.type = 'vnet';
 	}
 
-	if (!values.ipv6) {
-	    delete values.ipv6;
-	}
-	if (!values.ipv4) {
-	    delete values.ipv4;
-	}
-	if (!values.mac) {
-	    delete values.mac;
+	if (!values.vlanaware) {
+	    delete values.vlanaware;
 	}
 
 	return values;
diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js
index b530bd5f..d842654a 100644
--- a/www/manager6/sdn/ZoneView.js
+++ b/www/manager6/sdn/ZoneView.js
@@ -117,7 +117,7 @@ Ext.define('PVE.sdn.ZoneView', {
 	    columns: [
 		{
 		    header: 'ID',
-		    flex: 2,
+		    width: 100,
 		    dataIndex: 'zone',
                     renderer: function(value, metaData, rec) {
                         return PVE.Utils.render_sdn_pending(rec, value, 'zone', 1);
@@ -125,7 +125,7 @@ Ext.define('PVE.sdn.ZoneView', {
 		},
 		{
 		    header: gettext('Type'),
-		    flex: 1,
+		    width: 100,
 		    dataIndex: 'type',
                     renderer: function(value, metaData, rec) {
                         return PVE.Utils.render_sdn_pending(rec, value, 'type', 1);
@@ -133,7 +133,7 @@ Ext.define('PVE.sdn.ZoneView', {
 		},
 		{
 		    header: 'MTU',
-		    flex: 1,
+		    width: 50,
 		    dataIndex: 'mtu',
                     renderer: function(value, metaData, rec) {
                         return PVE.Utils.render_sdn_pending(rec, value, 'mtu');
@@ -147,6 +147,38 @@ Ext.define('PVE.sdn.ZoneView', {
                         return PVE.Utils.render_sdn_pending(rec, value, 'nodes');
                     }
 		},
+		{
+		    header: 'Ipam',
+		    flex: 3,
+		    dataIndex: 'ipam',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'ipam');
+                    }
+		},
+		{
+		    header: gettext('Domain'),
+		    flex: 3,
+		    dataIndex: 'dnszone',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'dnszone');
+                    }
+		},
+		{
+		    header: gettext('Dns'),
+		    flex: 3,
+		    dataIndex: 'dns',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'dns');
+                    }
+		},
+		{
+		    header: gettext('Reverse dns'),
+		    flex: 3,
+		    dataIndex: 'reversedns',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'reversedns');
+                    }
+		},
 		{
 		    header: gettext('Pending'),
 		    flex: 3,
@@ -157,6 +189,10 @@ Ext.define('PVE.sdn.ZoneView', {
 				delete value.zone;
 				delete value.type;
 				delete value.mtu;
+				delete value.ipam;
+				delete value.dns;
+				delete value.reversedns;
+				delete value.dnszone;
 				if(!Ext.Object.isEmpty(value)){
 				    return JSON.stringify(value);
  				}
diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index 724ae317..6e2f5c1c 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -18,6 +18,37 @@ Ext.define('PVE.panel.SDNZoneBase', {
     initComponent : function() {
         var me = this;
 
+        me.advancedItems = [
+            {
+                xtype: 'pveSDNIpamSelector',
+                fieldLabel: gettext('Ipam'),
+                name: 'ipam',
+                value: 'pve',
+                allowBlank: false,
+            },
+            {
+                xtype: 'pveSDNDnsSelector',
+                fieldLabel: gettext('Dns server'),
+                name: 'dns',
+                value: '',
+                allowBlank: true,
+            },
+            {
+                xtype: 'pveSDNDnsSelector',
+                fieldLabel: gettext('Reverse Dns server'),
+                name: 'reversedns',
+                value: '',
+                allowBlank: true,
+            },
+            {
+                xtype: 'proxmoxtextfield',
+                name: 'dnszone',
+                skipEmptyText: true,
+                fieldLabel: gettext('DNS zone'),
+                allowBlank: true
+            },
+        ];
+
         me.callParent();
     }
 });
diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js
index 7e2d8dd7..c9faa5a0 100644
--- a/www/manager6/sdn/zones/SimpleEdit.js
+++ b/www/manager6/sdn/zones/SimpleEdit.js
@@ -45,7 +45,6 @@ Ext.define('PVE.sdn.zones.SimpleInputPanel', {
             multiSelect: true,
             autoSelect: false
           },
-
 	];
 
 	me.callParent();
-- 
2.20.1





More information about the pve-devel mailing list