public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management
@ 2020-12-03 10:34 Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 01/18] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Changelogv2:

- add ipams gui

Changelogv3:

- add internal pve ipam form
- ipam is optional for subnets

Changelogv4:
- add dns 

changelogv5:

- move subnets to vnet split panel (like ipsets)
- move controllers, ipams, dns to a new options panel

changelogv6:

- display pending grid 
- move dns/ipams options from subnets to zone
- various cleanup/bugfix

changelogv7:

- add new bgp controller plugin
- rework evpn controller plugin

changelogv8:

- update onlinehelp links to last pve-docs patches
- cleanup zoneview panel grid

changelogv9:
- add pending state column with hover tip

Alexandre Derumier (18):
  sdn: vnetedit: add subnets && remove ip/mac
  add sdn subnets
  add sdn ipams
  sdn: add PVEIpam
  sdn: subnets: ipam is optional
  add sdn dns
  subnets: add dns fields
  add vnet option to subnets and remove subnets list from vnet
  add vnet panel with vnet + subnets split view
  subnets: move ipam/dns in advanced section, and use "pve" as default
    ipam
  sdn: add options panel + move controller/ipam/dns view
  sdn: display pending values
  move ipams && dns options to zone
  sdn: browser: add onlinehelp
  sdn: evpn improvments
  sdn: update onlinehelp links
  sdn : zone content view: add alias && resize column
  sdn: add pending state column with hover tip

 www/manager6/Makefile                    |  16 +++
 www/manager6/Utils.js                    | 104 ++++++++++++++
 www/manager6/dc/Config.js                |  18 +--
 www/manager6/form/SDNDnsSelector.js      |  52 +++++++
 www/manager6/form/SDNIpamSelector.js     |  52 +++++++
 www/manager6/form/SDNVnetSelector.js     |  68 +++++++++
 www/manager6/sdn/Browser.js              |   2 +
 www/manager6/sdn/ControllerView.js       |  44 +++++-
 www/manager6/sdn/DnsView.js              | 132 ++++++++++++++++++
 www/manager6/sdn/IpamView.js             | 133 ++++++++++++++++++
 www/manager6/sdn/OptionsPanel.js         |  41 ++++++
 www/manager6/sdn/SubnetEdit.js           | 104 ++++++++++++++
 www/manager6/sdn/SubnetView.js           | 169 +++++++++++++++++++++++
 www/manager6/sdn/VnetEdit.js             |  43 +-----
 www/manager6/sdn/VnetPanel.js            |  39 ++++++
 www/manager6/sdn/VnetView.js             |  81 ++++++-----
 www/manager6/sdn/ZoneContentView.js      |  13 +-
 www/manager6/sdn/ZoneView.js             |  78 +++++++++--
 www/manager6/sdn/controllers/BgpEdit.js  |  62 +++++++++
 www/manager6/sdn/controllers/EvpnEdit.js |  16 +--
 www/manager6/sdn/dns/Base.js             |  73 ++++++++++
 www/manager6/sdn/dns/PowerdnsEdit.js     |  52 +++++++
 www/manager6/sdn/ipams/Base.js           |  73 ++++++++++
 www/manager6/sdn/ipams/NetboxEdit.js     |  47 +++++++
 www/manager6/sdn/ipams/PVEIpamEdit.js    |  34 +++++
 www/manager6/sdn/ipams/PhpIpamEdit.js    |  53 +++++++
 www/manager6/sdn/zones/Base.js           |  36 +++++
 www/manager6/sdn/zones/EvpnEdit.js       |   7 +
 www/manager6/sdn/zones/SimpleEdit.js     |   1 -
 29 files changed, 1530 insertions(+), 113 deletions(-)
 create mode 100644 www/manager6/form/SDNDnsSelector.js
 create mode 100644 www/manager6/form/SDNIpamSelector.js
 create mode 100644 www/manager6/form/SDNVnetSelector.js
 create mode 100644 www/manager6/sdn/DnsView.js
 create mode 100644 www/manager6/sdn/IpamView.js
 create mode 100644 www/manager6/sdn/OptionsPanel.js
 create mode 100644 www/manager6/sdn/SubnetEdit.js
 create mode 100644 www/manager6/sdn/SubnetView.js
 create mode 100644 www/manager6/sdn/VnetPanel.js
 create mode 100644 www/manager6/sdn/controllers/BgpEdit.js
 create mode 100644 www/manager6/sdn/dns/Base.js
 create mode 100644 www/manager6/sdn/dns/PowerdnsEdit.js
 create mode 100644 www/manager6/sdn/ipams/Base.js
 create mode 100644 www/manager6/sdn/ipams/NetboxEdit.js
 create mode 100644 www/manager6/sdn/ipams/PVEIpamEdit.js
 create mode 100644 www/manager6/sdn/ipams/PhpIpamEdit.js

-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 01/18] sdn: vnetedit: add subnets && remove ip/mac
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 02/18] add sdn subnets Alexandre Derumier
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/sdn/VnetEdit.js | 29 +++--------------------------
 www/manager6/sdn/VnetView.js | 18 +++---------------
 2 files changed, 6 insertions(+), 41 deletions(-)

diff --git a/www/manager6/sdn/VnetEdit.js b/www/manager6/sdn/VnetEdit.js
index aa40b41f..09e2f3bf 100644
--- a/www/manager6/sdn/VnetEdit.js
+++ b/www/manager6/sdn/VnetEdit.js
@@ -64,34 +64,11 @@ Ext.define('PVE.sdn.VnetInputPanel', {
 	},
 	{
 	    xtype: 'textfield',
-	    name: 'mac',
-	    fieldLabel: gettext('MAC Address'),
-	    vtype: 'MacAddress',
-	    skipEmptyText: true,
+	    name: 'subnets',
+	    fieldLabel: gettext('Subnets'),
 	    allowBlank: true,
-	    emptyText: 'auto',
 	},
-    ],
-    advancedItems: [
-	{
-	    xtype: 'textfield',
-	    name: 'ipv4',
-	    vtype: 'IPCIDRAddress',
-	    fieldLabel: 'IPv4/CIDR', // do not localize
-	    emptyText: 'Optional anycast addr. for BGP',
-	    skipEmptyText: true,
-	    allowBlank: true,
-	},
-	{
-	    xtype: 'textfield',
-	    name: 'ipv6',
-	    vtype: 'IP6CIDRAddress',
-	    fieldLabel: 'IPv6/CIDR', // do not localize
-	    emptyText: 'Optional anycast addr. for BGP',
-	    skipEmptyText: true,
-	    allowBlank: true,
-	},
-    ],
+    ]
 });
 
 Ext.define('PVE.sdn.VnetEdit', {
diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js
index e73632d1..604a2d1a 100644
--- a/www/manager6/sdn/VnetView.js
+++ b/www/manager6/sdn/VnetView.js
@@ -98,20 +98,10 @@ Ext.define('PVE.sdn.VnetView', {
 		    dataIndex: 'vlanaware',
 		},
 		{
-		    header: 'IPv4/CIDR',
+		    header: 'Subnets',
 		    flex: 1,
-		    dataIndex: 'ipv4',
+		    dataIndex: 'subnets',
 		},
-		{
-		    header: 'IPv6/CIDR',
-		    flex: 1,
-		    dataIndex: 'ipv6',
-		},
-		{
-		    header: 'MAC',
-		    flex: 1,
-		    dataIndex: 'mac',
-		}
 	    ],
 	    listeners: {
 		activate: reload,
@@ -127,9 +117,7 @@ Ext.define('PVE.sdn.VnetView', {
 	extend: 'Ext.data.Model',
 	fields: [
 	    'alias',
-	    'ipv4',
-	    'ipv6',
-	    'mac',
+	    'subnets',
 	    'tag',
 	    'type',
 	    'vnet',
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 02/18] add sdn subnets
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 01/18] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 03/18] add sdn ipams Alexandre Derumier
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile          |   2 +
 www/manager6/dc/Config.js      |   8 +++
 www/manager6/sdn/SubnetEdit.js |  95 +++++++++++++++++++++++++++++
 www/manager6/sdn/SubnetView.js | 107 +++++++++++++++++++++++++++++++++
 4 files changed, 212 insertions(+)
 create mode 100644 www/manager6/sdn/SubnetEdit.js
 create mode 100644 www/manager6/sdn/SubnetView.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 9e6e56ef..60a2894e 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -225,6 +225,8 @@ JSSRC= 							\
 	sdn/StatusView.js				\
 	sdn/VnetEdit.js					\
 	sdn/VnetView.js					\
+	sdn/SubnetEdit.js					\
+	sdn/SubnetView.js					\
 	sdn/ZoneContentView.js				\
 	sdn/ZoneView.js					\
 	sdn/controllers/Base.js				\
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 2fdba743..6f4756de 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -176,6 +176,14 @@ Ext.define('PVE.dc.Config', {
 		    hidden: true,
 		    iconCls: 'fa fa-network-wired',
 		    itemId: 'sdnvnet'
+		},
+		{
+		    xtype: 'pveSDNSubnetView',
+		    groups: ['sdn'],
+		    title: gettext('Subnets'),
+		    hidden: true,
+		    iconCls: 'fa fa-network-wired',
+		    itemId: 'sdnsubnet'
 		});
 	    }
 
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
new file mode 100644
index 00000000..e165ff73
--- /dev/null
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -0,0 +1,95 @@
+Ext.define('PVE.sdn.SubnetInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    onGetValues: function(values) {
+	let me = this;
+
+	if (me.isCreate) {
+	    values.type = 'subnet';
+	    values.subnet = values.cidr;
+	    delete values.cidr;
+	}
+
+	if (!values.gateway) {
+	    delete values.gateway;
+	}
+	if (!values.snat) {
+	    delete values.snat;
+	}
+
+	return values;
+    },
+
+    items: [
+	{
+	    xtype: 'pmxDisplayEditField',
+	    name: 'cidr',
+	    cbind: {
+		editable: '{isCreate}',
+	    },
+	    flex: 1,
+	    allowBlank: false,
+	    fieldLabel: gettext('Subnet'),
+	},
+	{
+	    xtype: 'textfield',
+	    name: 'gateway',
+	    vtype: 'IP64Address',
+	    fieldLabel: gettext('Gateway'),
+	    allowBlank: true,
+	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    name: 'snat',
+	    uncheckedValue: 0,
+	    checked: false,
+	    fieldLabel: 'SNAT'
+	},
+    ]
+});
+
+Ext.define('PVE.sdn.SubnetEdit', {
+    extend: 'Proxmox.window.Edit',
+
+    subject: gettext('Subnet'),
+
+    subnet: undefined,
+
+    width: 350,
+
+    initComponent: function() {
+	var me = this;
+
+	me.isCreate = me.subnet === undefined;
+
+	if (me.isCreate) {
+	    me.url = '/api2/extjs/cluster/sdn/subnets';
+	    me.method = 'POST';
+	} else {
+	    me.url = '/api2/extjs/cluster/sdn/subnets/' + me.subnet;
+	    me.method = 'PUT';
+	}
+
+	let ipanel = Ext.create('PVE.sdn.SubnetInputPanel', {
+	    isCreate: me.isCreate,
+	});
+
+	Ext.apply(me, {
+	    items: [
+		ipanel,
+	    ],
+	});
+
+	me.callParent();
+
+	if (!me.isCreate) {
+	    me.load({
+		success: function(response, options) {
+		    let values = response.result.data;
+		    ipanel.setValues(values);
+		},
+	    });
+	}
+    },
+});
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
new file mode 100644
index 00000000..e5cc03b7
--- /dev/null
+++ b/www/manager6/sdn/SubnetView.js
@@ -0,0 +1,107 @@
+Ext.define('PVE.sdn.SubnetView', {
+    extend: 'Ext.grid.GridPanel',
+    alias: 'widget.pveSDNSubnetView',
+
+    stateful: true,
+    stateId: 'grid-sdn-subnet',
+
+    initComponent : function() {
+	let me = this;
+
+	let store = new Ext.data.Store({
+	    model: 'pve-sdn-subnet',
+	    proxy: {
+                type: 'proxmox',
+		url: "/api2/json/cluster/sdn/subnets"
+	    },
+	    sorters: {
+		property: 'subnet',
+		order: 'DESC'
+	    }
+	});
+	let reload = () => store.load();
+
+	let sm = Ext.create('Ext.selection.RowModel', {});
+
+        let run_editor = function() {
+	    let rec = sm.getSelection()[0];
+
+	    let win = Ext.create('PVE.sdn.SubnetEdit',{
+		autoShow: true,
+		subnet: rec.data.subnet,
+	    });
+	    win.on('destroy', reload);
+        };
+
+	let edit_btn = new Proxmox.button.Button({
+	    text: gettext('Edit'),
+	    disabled: true,
+	    selModel: sm,
+	    handler: run_editor,
+	});
+
+	let remove_btn = Ext.create('Proxmox.button.StdRemoveButton', {
+	    selModel: sm,
+	    baseurl: '/cluster/sdn/subnets/',
+	    callback: reload
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    reloadStore: reload,
+	    selModel: sm,
+	    viewConfig: {
+		trackOver: false
+	    },
+	    tbar: [
+		{
+		    text: gettext('Create'),
+		    handler: function() {
+			let win = Ext.create('PVE.sdn.SubnetEdit', {
+			    autoShow: true,
+			    type: 'subnet',
+			});
+			win.on('destroy', reload);
+		    }
+		},
+		remove_btn,
+		edit_btn,
+	    ],
+	    columns: [
+		{
+		    header: 'ID',
+		    flex: 2,
+		    dataIndex: 'cidr'
+		},
+		{
+		    header: gettext('Gateway'),
+		    flex: 1,
+		    dataIndex: 'gateway',
+		},
+		{
+		    header: gettext('Snat'),
+		    flex: 1,
+		    dataIndex: 'snat',
+		}
+	    ],
+	    listeners: {
+		activate: reload,
+		itemdblclick: run_editor
+	    }
+	});
+
+	me.callParent();
+    }
+}, function() {
+
+    Ext.define('pve-sdn-subnet', {
+	extend: 'Ext.data.Model',
+	fields: [
+	    'cidr',
+	    'gateway',
+	    'snat',
+	],
+	idProperty: 'subnet'
+    });
+
+});
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 03/18] add sdn ipams
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 01/18] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 02/18] add sdn subnets Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 04/18] sdn: add PVEIpam Alexandre Derumier
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile                 |   5 +
 www/manager6/Utils.js                 |  25 +++++
 www/manager6/dc/Config.js             |   8 ++
 www/manager6/form/SDNIpamSelector.js  |  52 ++++++++++
 www/manager6/sdn/IpamView.js          | 131 ++++++++++++++++++++++++++
 www/manager6/sdn/SubnetEdit.js        |   7 ++
 www/manager6/sdn/SubnetView.js        |   7 +-
 www/manager6/sdn/ipams/Base.js        |  73 ++++++++++++++
 www/manager6/sdn/ipams/NetboxEdit.js  |  47 +++++++++
 www/manager6/sdn/ipams/PhpIpamEdit.js |  53 +++++++++++
 10 files changed, 407 insertions(+), 1 deletion(-)
 create mode 100644 www/manager6/form/SDNIpamSelector.js
 create mode 100644 www/manager6/sdn/IpamView.js
 create mode 100644 www/manager6/sdn/ipams/Base.js
 create mode 100644 www/manager6/sdn/ipams/NetboxEdit.js
 create mode 100644 www/manager6/sdn/ipams/PhpIpamEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 60a2894e..669b3cc7 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -52,6 +52,7 @@ JSSRC= 							\
 	form/QemuBiosSelector.js			\
 	form/SDNControllerSelector.js			\
 	form/SDNZoneSelector.js				\
+	form/SDNIpamSelector.js				\
 	form/ScsiHwSelector.js				\
 	form/SecurityGroupSelector.js			\
 	form/SnapshotSelector.js			\
@@ -231,6 +232,10 @@ JSSRC= 							\
 	sdn/ZoneView.js					\
 	sdn/controllers/Base.js				\
 	sdn/controllers/EvpnEdit.js			\
+        sdn/IpamView.js                                 \
+        sdn/ipams/Base.js                               \
+        sdn/ipams/NetboxEdit.js                         \
+        sdn/ipams/PhpIpamEdit.js                        \
 	sdn/zones/Base.js				\
 	sdn/zones/EvpnEdit.js				\
 	sdn/zones/QinQEdit.js				\
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index b70592b4..9791215f 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -801,6 +801,23 @@ Ext.define('PVE.Utils', { utilities: {
 	},
     },
 
+    sdnipamSchema: {
+	ipam: {
+	     name: 'ipam',
+	     hideAdd: true
+	},
+	netbox: {
+	    name: 'Netbox',
+	    ipanel: 'NetboxInputPanel',
+	    faIcon: 'th'
+	},
+	phpipam: {
+	    name: 'PhpIpam',
+	    ipanel: 'PhpIpamInputPanel',
+	    faIcon: 'th'
+	},
+    },
+
     format_sdnvnet_type: function(value, md, record) {
 	var schema = PVE.Utils.sdnvnetSchema[value];
 	if (schema) {
@@ -825,6 +842,14 @@ Ext.define('PVE.Utils', { utilities: {
 	return Proxmox.Utils.unknownText;
     },
 
+    format_sdnipam_type: function(value, md, record) {
+	var schema = PVE.Utils.sdnipamSchema[value];
+	if (schema) {
+	    return schema.name;
+	}
+	return Proxmox.Utils.unknownText;
+    },
+
     format_storage_type: function(value, md, record) {
 	if (value === 'rbd') {
 	    value = (!record || record.get('monhost') ? 'rbd' : 'pveceph');
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 6f4756de..081be7fb 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -184,6 +184,14 @@ Ext.define('PVE.dc.Config', {
 		    hidden: true,
 		    iconCls: 'fa fa-network-wired',
 		    itemId: 'sdnsubnet'
+		},
+		{
+		    xtype: 'pveSDNIpamView',
+		    groups: ['sdn'],
+		    title: gettext('Ipams'),
+		    hidden: true,
+		    iconCls: 'fa fa-network-wired',
+		    itemId: 'sdnipam'
 		});
 	    }
 
diff --git a/www/manager6/form/SDNIpamSelector.js b/www/manager6/form/SDNIpamSelector.js
new file mode 100644
index 00000000..5520d0fe
--- /dev/null
+++ b/www/manager6/form/SDNIpamSelector.js
@@ -0,0 +1,52 @@
+Ext.define('PVE.form.SDNIpamSelector', {
+    extend: 'Proxmox.form.ComboGrid',
+    alias: ['widget.pveSDNIpamSelector'],
+
+    allowBlank: false,
+    valueField: 'ipam',
+    displayField: 'ipam',
+
+    initComponent: function() {
+	var me = this;
+
+	var store = new Ext.data.Store({
+	    model: 'pve-sdn-ipam',
+            sorters: {
+                property: 'ipam',
+                order: 'DESC'
+            },
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    autoSelect: false,
+            listConfig: {
+		columns: [
+		    {
+			header: gettext('Ipam'),
+			sortable: true,
+			dataIndex: 'ipam',
+			flex: 1
+		    },
+		]
+	    }
+	});
+
+        me.callParent();
+
+	store.load();
+    }
+
+}, function() {
+
+    Ext.define('pve-sdn-ipam', {
+	extend: 'Ext.data.Model',
+	fields: [ 'ipam' ],
+	proxy: {
+            type: 'proxmox',
+	    url: "/api2/json/cluster/sdn/ipams"
+	},
+	idProperty: 'ipam'
+    });
+
+});
diff --git a/www/manager6/sdn/IpamView.js b/www/manager6/sdn/IpamView.js
new file mode 100644
index 00000000..605f44c7
--- /dev/null
+++ b/www/manager6/sdn/IpamView.js
@@ -0,0 +1,131 @@
+Ext.define('PVE.sdn.IpamView', {
+    extend: 'Ext.grid.GridPanel',
+    alias: ['widget.pveSDNIpamView'],
+
+    stateful: true,
+    stateId: 'grid-sdn-ipam',
+
+    createSDNEditWindow: function(type, sid) {
+	let schema = PVE.Utils.sdnipamSchema[type];
+	if (!schema || !schema.ipanel) {
+	    throw "no editor registered for ipam type: " + type;
+	}
+
+	Ext.create('PVE.sdn.ipams.BaseEdit', {
+	    paneltype: 'PVE.sdn.ipams.' + schema.ipanel,
+	    type: type,
+	    ipam: sid,
+	    autoShow: true,
+	    listeners: {
+		destroy: this.reloadStore
+	    }
+	});
+    },
+
+    initComponent : function() {
+	let me = this;
+
+	let store = new Ext.data.Store({
+	    model: 'pve-sdn-ipam',
+	    proxy: {
+                type: 'proxmox',
+		url: "/api2/json/cluster/sdn/ipams"
+	    },
+	    sorters: {
+		property: 'ipam',
+		order: 'DESC'
+	    },
+	});
+
+	let reload = function() {
+	    store.load();
+	};
+
+	let sm = Ext.create('Ext.selection.RowModel', {});
+
+	let run_editor = function() {
+	    let rec = sm.getSelection()[0];
+	    if (!rec) {
+		return;
+	    }
+	    let type = rec.data.type,
+	        ipam = rec.data.ipam;
+
+	    me.createSDNEditWindow(type, ipam);
+	};
+
+	let edit_btn = new Proxmox.button.Button({
+	    text: gettext('Edit'),
+	    disabled: true,
+	    selModel: sm,
+	    handler: run_editor
+	});
+
+	let remove_btn = Ext.create('Proxmox.button.StdRemoveButton', {
+	    selModel: sm,
+	    baseurl: '/cluster/sdn/ipams/',
+	    callback: reload
+	});
+
+	// else we cannot dynamically generate the add menu handlers
+	let addHandleGenerator = function(type) {
+	    return function() { me.createSDNEditWindow(type); };
+	};
+	let addMenuItems = [], type;
+
+	for (type in PVE.Utils.sdnipamSchema) {
+	    let ipam = PVE.Utils.sdnipamSchema[type];
+	    if (ipam.hideAdd) {
+		continue;
+	    }
+	    addMenuItems.push({
+		text:  PVE.Utils.format_sdnipam_type(type),
+		iconCls: 'fa fa-fw fa-' + ipam.faIcon,
+		handler: addHandleGenerator(type)
+	    });
+	}
+
+	Ext.apply(me, {
+	    store: store,
+	    reloadStore: reload,
+	    selModel: sm,
+	    viewConfig: {
+		trackOver: false
+	    },
+	    tbar: [
+		{
+		    text: gettext('Add'),
+		    menu: new Ext.menu.Menu({
+			items: addMenuItems
+		    })
+		},
+		remove_btn,
+		edit_btn,
+	    ],
+	    columns: [
+		{
+		    header: 'ID',
+		    flex: 2,
+		    dataIndex: 'ipam'
+		},
+		{
+		    header: gettext('Type'),
+		    flex: 1,
+		    dataIndex: 'type',
+		    renderer: PVE.Utils.format_sdnipam_type
+		},
+		{
+		    header: 'url',
+		    flex: 1,
+		    dataIndex: 'url',
+		},
+	    ],
+	    listeners: {
+		activate: reload,
+		itemdblclick: run_editor
+	    }
+	});
+
+	me.callParent();
+    }
+});
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index e165ff73..c9c6475b 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -46,6 +46,13 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
 	    checked: false,
 	    fieldLabel: 'SNAT'
 	},
+        {
+            xtype: 'pveSDNIpamSelector',
+            fieldLabel: gettext('Ipam'),
+            name: 'ipam',
+            value: '',
+            allowBlank: false,
+        },
     ]
 });
 
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
index e5cc03b7..95a468bc 100644
--- a/www/manager6/sdn/SubnetView.js
+++ b/www/manager6/sdn/SubnetView.js
@@ -79,9 +79,14 @@ Ext.define('PVE.sdn.SubnetView', {
 		    dataIndex: 'gateway',
 		},
 		{
-		    header: gettext('Snat'),
+		    header: 'SNAT',
 		    flex: 1,
 		    dataIndex: 'snat',
+		},
+		{
+		    header: 'Ipam',
+		    flex: 1,
+		    dataIndex: 'ipam',
 		}
 	    ],
 	    listeners: {
diff --git a/www/manager6/sdn/ipams/Base.js b/www/manager6/sdn/ipams/Base.js
new file mode 100644
index 00000000..7e0bf49b
--- /dev/null
+++ b/www/manager6/sdn/ipams/Base.js
@@ -0,0 +1,73 @@
+Ext.define('PVE.panel.SDNIpamBase', {
+    extend: 'Proxmox.panel.InputPanel',
+
+    type: '',
+
+    onGetValues: function(values) {
+        var me = this;
+
+        if (me.isCreate) {
+            values.type = me.type;
+        } else {
+            delete values.ipam;
+        }
+
+        return values;
+    },
+
+    initComponent : function() {
+        var me = this;
+
+        me.callParent();
+    }
+});
+
+Ext.define('PVE.sdn.ipams.BaseEdit', {
+    extend: 'Proxmox.window.Edit',
+
+    initComponent : function() {
+	var me = this;
+
+	me.isCreate = !me.ipam;
+
+	if (me.isCreate) {
+	    me.url = '/api2/extjs/cluster/sdn/ipams';
+	    me.method = 'POST';
+	} else {
+	    me.url = '/api2/extjs/cluster/sdn/ipams/' + me.ipam;
+	    me.method = 'PUT';
+	}
+
+	var ipanel = Ext.create(me.paneltype, {
+	    type: me.type,
+	    isCreate: me.isCreate,
+	    ipam: me.ipam
+	});
+
+	Ext.apply(me, {
+            subject: PVE.Utils.format_sdnipam_type(me.type),
+	    isAdd: true,
+	    items: [ ipanel ]
+	});
+
+	me.callParent();
+
+	if (!me.isCreate) {
+	    me.load({
+		success:  function(response, options) {
+		    var values = response.result.data;
+		    var ctypes = values.content || '';
+
+		    values.content = ctypes.split(',');
+
+		    if (values.nodes) {
+			values.nodes = values.nodes.split(',');
+		    }
+		    values.enable = values.disable ? 0 : 1;
+
+		    ipanel.setValues(values);
+		}
+	    });
+	}
+    }
+});
diff --git a/www/manager6/sdn/ipams/NetboxEdit.js b/www/manager6/sdn/ipams/NetboxEdit.js
new file mode 100644
index 00000000..5a0a84c8
--- /dev/null
+++ b/www/manager6/sdn/ipams/NetboxEdit.js
@@ -0,0 +1,47 @@
+Ext.define('PVE.sdn.ipams.NetboxInputPanel', {
+    extend: 'PVE.panel.SDNIpamBase',
+
+    //onlineHelp: 'pvesdn_ipam_plugin_netbox', // FIXME uncomment once doc-gen is updated
+
+    onGetValues: function(values) {
+        var me = this;
+
+        if (me.isCreate) {
+            values.type = me.type;
+        } else {
+            delete values.ipam;
+        }
+
+        return values;
+    },
+
+    initComponent : function() {
+	var me = this;
+
+        me.items = [
+           {
+            xtype: me.isCreate ? 'textfield' : 'displayfield',
+            name: 'ipam',
+            maxLength: 10,
+            value: me.zone || '',
+            fieldLabel: 'ID',
+            allowBlank: false
+          },
+          {
+            xtype: 'textfield',
+            name: 'url',
+            fieldLabel: gettext('Url'),
+            allowBlank: false,
+          },
+          {
+            xtype: 'textfield',
+            name: 'token',
+            fieldLabel: gettext('Token'),
+            allowBlank: false,
+          },
+
+	];
+
+	me.callParent();
+    }
+});
diff --git a/www/manager6/sdn/ipams/PhpIpamEdit.js b/www/manager6/sdn/ipams/PhpIpamEdit.js
new file mode 100644
index 00000000..c8da53a6
--- /dev/null
+++ b/www/manager6/sdn/ipams/PhpIpamEdit.js
@@ -0,0 +1,53 @@
+Ext.define('PVE.sdn.ipams.PhpIpamInputPanel', {
+    extend: 'PVE.panel.SDNIpamBase',
+
+    //onlineHelp: 'pvesdn_ipam_plugin_phpipam', // FIXME uncomment once doc-gen is updated
+
+    onGetValues: function(values) {
+        var me = this;
+
+        if (me.isCreate) {
+            values.type = me.type;
+        } else {
+            delete values.ipam;
+        }
+
+        return values;
+    },
+
+    initComponent : function() {
+	var me = this;
+
+        me.items = [
+           {
+            xtype: me.isCreate ? 'textfield' : 'displayfield',
+            name: 'ipam',
+            maxLength: 10,
+            value: me.zone || '',
+            fieldLabel: 'ID',
+            allowBlank: false
+          },
+          {
+            xtype: 'textfield',
+            name: 'url',
+            fieldLabel: gettext('Url'),
+            allowBlank: false,
+          },
+          {
+            xtype: 'textfield',
+            name: 'token',
+            fieldLabel: gettext('Token'),
+            allowBlank: false,
+          },
+          {
+            xtype: 'textfield',
+            name: 'section',
+            fieldLabel: gettext('Section'),
+            allowBlank: false,
+          },
+
+	];
+
+	me.callParent();
+    }
+});
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 04/18] sdn: add PVEIpam
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (2 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 03/18] add sdn ipams Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 05/18] sdn: subnets: ipam is optional Alexandre Derumier
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile                 |  1 +
 www/manager6/Utils.js                 |  5 ++++
 www/manager6/sdn/ipams/PVEIpamEdit.js | 34 +++++++++++++++++++++++++++
 3 files changed, 40 insertions(+)
 create mode 100644 www/manager6/sdn/ipams/PVEIpamEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 669b3cc7..58bf2186 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -235,6 +235,7 @@ JSSRC= 							\
         sdn/IpamView.js                                 \
         sdn/ipams/Base.js                               \
         sdn/ipams/NetboxEdit.js                         \
+        sdn/ipams/PVEIpamEdit.js                        \
         sdn/ipams/PhpIpamEdit.js                        \
 	sdn/zones/Base.js				\
 	sdn/zones/EvpnEdit.js				\
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 9791215f..4637929d 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -806,6 +806,11 @@ Ext.define('PVE.Utils', { utilities: {
 	     name: 'ipam',
 	     hideAdd: true
 	},
+	pve: {
+	    name: 'PVE',
+	    ipanel: 'PVEIpamInputPanel',
+	    faIcon: 'th'
+	},
 	netbox: {
 	    name: 'Netbox',
 	    ipanel: 'NetboxInputPanel',
diff --git a/www/manager6/sdn/ipams/PVEIpamEdit.js b/www/manager6/sdn/ipams/PVEIpamEdit.js
new file mode 100644
index 00000000..43d040e0
--- /dev/null
+++ b/www/manager6/sdn/ipams/PVEIpamEdit.js
@@ -0,0 +1,34 @@
+Ext.define('PVE.sdn.ipams.PVEIpamInputPanel', {
+    extend: 'PVE.panel.SDNIpamBase',
+
+    //onlineHelp: 'pvesdn_ipam_plugin_pve', // FIXME uncomment once doc-gen is updated
+
+    onGetValues: function(values) {
+        var me = this;
+
+        if (me.isCreate) {
+            values.type = me.type;
+        } else {
+            delete values.ipam;
+        }
+
+        return values;
+    },
+
+    initComponent : function() {
+	var me = this;
+
+        me.items = [
+           {
+            xtype: me.isCreate ? 'textfield' : 'displayfield',
+            name: 'ipam',
+            maxLength: 10,
+            value: me.zone || '',
+            fieldLabel: 'ID',
+            allowBlank: false
+          },
+	];
+
+	me.callParent();
+    }
+});
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 05/18] sdn: subnets: ipam is optional
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (3 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 04/18] sdn: add PVEIpam Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 06/18] add sdn dns Alexandre Derumier
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/sdn/SubnetEdit.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index c9c6475b..2afa1a27 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -51,7 +51,7 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
             fieldLabel: gettext('Ipam'),
             name: 'ipam',
             value: '',
-            allowBlank: false,
+            allowBlank: true,
         },
     ]
 });
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 06/18] add sdn dns
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (4 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 05/18] sdn: subnets: ipam is optional Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 07/18] subnets: add dns fields Alexandre Derumier
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile                |   4 +
 www/manager6/Utils.js                |  20 ++++
 www/manager6/dc/Config.js            |   8 ++
 www/manager6/form/SDNDnsSelector.js  |  52 +++++++++++
 www/manager6/sdn/DnsView.js          | 131 +++++++++++++++++++++++++++
 www/manager6/sdn/dns/Base.js         |  73 +++++++++++++++
 www/manager6/sdn/dns/PowerdnsEdit.js |  52 +++++++++++
 7 files changed, 340 insertions(+)
 create mode 100644 www/manager6/form/SDNDnsSelector.js
 create mode 100644 www/manager6/sdn/DnsView.js
 create mode 100644 www/manager6/sdn/dns/Base.js
 create mode 100644 www/manager6/sdn/dns/PowerdnsEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 58bf2186..fa809089 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -53,6 +53,7 @@ JSSRC= 							\
 	form/SDNControllerSelector.js			\
 	form/SDNZoneSelector.js				\
 	form/SDNIpamSelector.js				\
+	form/SDNDnsSelector.js				\
 	form/ScsiHwSelector.js				\
 	form/SecurityGroupSelector.js			\
 	form/SnapshotSelector.js			\
@@ -237,6 +238,9 @@ JSSRC= 							\
         sdn/ipams/NetboxEdit.js                         \
         sdn/ipams/PVEIpamEdit.js                        \
         sdn/ipams/PhpIpamEdit.js                        \
+        sdn/DnsView.js                                 \
+        sdn/dns/Base.js                               \
+        sdn/dns/PowerdnsEdit.js                         \
 	sdn/zones/Base.js				\
 	sdn/zones/EvpnEdit.js				\
 	sdn/zones/QinQEdit.js				\
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 4637929d..8c939536 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -823,6 +823,18 @@ Ext.define('PVE.Utils', { utilities: {
 	},
     },
 
+    sdndnsSchema: {
+	dns: {
+	     name: 'dns',
+	     hideAdd: true
+	},
+	powerdns: {
+	    name: 'powerdns',
+	    ipanel: 'PowerdnsInputPanel',
+	    faIcon: 'th'
+	},
+    },
+
     format_sdnvnet_type: function(value, md, record) {
 	var schema = PVE.Utils.sdnvnetSchema[value];
 	if (schema) {
@@ -855,6 +867,14 @@ Ext.define('PVE.Utils', { utilities: {
 	return Proxmox.Utils.unknownText;
     },
 
+    format_sdndns_type: function(value, md, record) {
+	var schema = PVE.Utils.sdndnsSchema[value];
+	if (schema) {
+	    return schema.name;
+	}
+	return Proxmox.Utils.unknownText;
+    },
+
     format_storage_type: function(value, md, record) {
 	if (value === 'rbd') {
 	    value = (!record || record.get('monhost') ? 'rbd' : 'pveceph');
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 081be7fb..b48eac3c 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -192,6 +192,14 @@ Ext.define('PVE.dc.Config', {
 		    hidden: true,
 		    iconCls: 'fa fa-network-wired',
 		    itemId: 'sdnipam'
+		},
+		{
+		    xtype: 'pveSDNDnsView',
+		    groups: ['sdn'],
+		    title: gettext('Dns'),
+		    hidden: true,
+		    iconCls: 'fa fa-network-wired',
+		    itemId: 'sdndns'
 		});
 	    }
 
diff --git a/www/manager6/form/SDNDnsSelector.js b/www/manager6/form/SDNDnsSelector.js
new file mode 100644
index 00000000..7abb1f01
--- /dev/null
+++ b/www/manager6/form/SDNDnsSelector.js
@@ -0,0 +1,52 @@
+Ext.define('PVE.form.SDNDnsSelector', {
+    extend: 'Proxmox.form.ComboGrid',
+    alias: ['widget.pveSDNDnsSelector'],
+
+    allowBlank: false,
+    valueField: 'dns',
+    displayField: 'dns',
+
+    initComponent: function() {
+	var me = this;
+
+	var store = new Ext.data.Store({
+	    model: 'pve-sdn-dns',
+            sorters: {
+                property: 'dns',
+                order: 'DESC'
+            },
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    autoSelect: false,
+            listConfig: {
+		columns: [
+		    {
+			header: gettext('dns'),
+			sortable: true,
+			dataIndex: 'dns',
+			flex: 1
+		    },
+		]
+	    }
+	});
+
+        me.callParent();
+
+	store.load();
+    }
+
+}, function() {
+
+    Ext.define('pve-sdn-dns', {
+	extend: 'Ext.data.Model',
+	fields: [ 'dns' ],
+	proxy: {
+            type: 'proxmox',
+	    url: "/api2/json/cluster/sdn/dns"
+	},
+	idProperty: 'dns'
+    });
+
+});
diff --git a/www/manager6/sdn/DnsView.js b/www/manager6/sdn/DnsView.js
new file mode 100644
index 00000000..6d47e38f
--- /dev/null
+++ b/www/manager6/sdn/DnsView.js
@@ -0,0 +1,131 @@
+Ext.define('PVE.sdn.DnsView', {
+    extend: 'Ext.grid.GridPanel',
+    alias: ['widget.pveSDNDnsView'],
+
+    stateful: true,
+    stateId: 'grid-sdn-dns',
+
+    createSDNEditWindow: function(type, sid) {
+	let schema = PVE.Utils.sdndnsSchema[type];
+	if (!schema || !schema.ipanel) {
+	    throw "no editor registered for dns type: " + type;
+	}
+
+	Ext.create('PVE.sdn.dns.BaseEdit', {
+	    paneltype: 'PVE.sdn.dns.' + schema.ipanel,
+	    type: type,
+	    dns: sid,
+	    autoShow: true,
+	    listeners: {
+		destroy: this.reloadStore
+	    }
+	});
+    },
+
+    initComponent : function() {
+	let me = this;
+
+	let store = new Ext.data.Store({
+	    model: 'pve-sdn-dns',
+	    proxy: {
+                type: 'proxmox',
+		url: "/api2/json/cluster/sdn/dns"
+	    },
+	    sorters: {
+		property: 'dns',
+		order: 'DESC'
+	    },
+	});
+
+	let reload = function() {
+	    store.load();
+	};
+
+	let sm = Ext.create('Ext.selection.RowModel', {});
+
+	let run_editor = function() {
+	    let rec = sm.getSelection()[0];
+	    if (!rec) {
+		return;
+	    }
+	    let type = rec.data.type,
+	        dns = rec.data.dns;
+
+	    me.createSDNEditWindow(type, dns);
+	};
+
+	let edit_btn = new Proxmox.button.Button({
+	    text: gettext('Edit'),
+	    disabled: true,
+	    selModel: sm,
+	    handler: run_editor
+	});
+
+	let remove_btn = Ext.create('Proxmox.button.StdRemoveButton', {
+	    selModel: sm,
+	    baseurl: '/cluster/sdn/dns/',
+	    callback: reload
+	});
+
+	// else we cannot dynamically generate the add menu handlers
+	let addHandleGenerator = function(type) {
+	    return function() { me.createSDNEditWindow(type); };
+	};
+	let addMenuItems = [], type;
+
+	for (type in PVE.Utils.sdndnsSchema) {
+	    let dns = PVE.Utils.sdndnsSchema[type];
+	    if (dns.hideAdd) {
+		continue;
+	    }
+	    addMenuItems.push({
+		text:  PVE.Utils.format_sdndns_type(type),
+		iconCls: 'fa fa-fw fa-' + dns.faIcon,
+		handler: addHandleGenerator(type)
+	    });
+	}
+
+	Ext.apply(me, {
+	    store: store,
+	    reloadStore: reload,
+	    selModel: sm,
+	    viewConfig: {
+		trackOver: false
+	    },
+	    tbar: [
+		{
+		    text: gettext('Add'),
+		    menu: new Ext.menu.Menu({
+			items: addMenuItems
+		    })
+		},
+		remove_btn,
+		edit_btn,
+	    ],
+	    columns: [
+		{
+		    header: 'ID',
+		    flex: 2,
+		    dataIndex: 'dns'
+		},
+		{
+		    header: gettext('Type'),
+		    flex: 1,
+		    dataIndex: 'type',
+		    renderer: PVE.Utils.format_sdndns_type
+		},
+		{
+		    header: 'url',
+		    flex: 1,
+		    dataIndex: 'url',
+		},
+	    ],
+	    listeners: {
+		activate: reload,
+		itemdblclick: run_editor
+	    }
+	});
+
+	me.callParent();
+    }
+});
diff --git a/www/manager6/sdn/dns/Base.js b/www/manager6/sdn/dns/Base.js
new file mode 100644
index 00000000..d3a3720b
--- /dev/null
+++ b/www/manager6/sdn/dns/Base.js
@@ -0,0 +1,73 @@
+Ext.define('PVE.panel.SDNDnsBase', {
+    extend: 'Proxmox.panel.InputPanel',
+
+    type: '',
+
+    onGetValues: function(values) {
+        var me = this;
+
+        if (me.isCreate) {
+            values.type = me.type;
+        } else {
+            delete values.dns;
+        }
+
+        return values;
+    },
+
+    initComponent : function() {
+        var me = this;
+
+        me.callParent();
+    }
+});
+
+Ext.define('PVE.sdn.dns.BaseEdit', {
+    extend: 'Proxmox.window.Edit',
+
+    initComponent : function() {
+	var me = this;
+
+	me.isCreate = !me.dns;
+
+	if (me.isCreate) {
+	    me.url = '/api2/extjs/cluster/sdn/dns';
+	    me.method = 'POST';
+	} else {
+	    me.url = '/api2/extjs/cluster/sdn/dns/' + me.dns;
+	    me.method = 'PUT';
+	}
+
+	var ipanel = Ext.create(me.paneltype, {
+	    type: me.type,
+	    isCreate: me.isCreate,
+	    dns: me.dns
+	});
+
+	Ext.apply(me, {
+            subject: PVE.Utils.format_sdndns_type(me.type),
+	    isAdd: true,
+	    items: [ ipanel ]
+	});
+
+	me.callParent();
+
+	if (!me.isCreate) {
+	    me.load({
+		success:  function(response, options) {
+		    var values = response.result.data;
+		    var ctypes = values.content || '';
+
+		    values.content = ctypes.split(',');
+
+		    if (values.nodes) {
+			values.nodes = values.nodes.split(',');
+		    }
+		    values.enable = values.disable ? 0 : 1;
+
+		    ipanel.setValues(values);
+		}
+	    });
+	}
+    }
+});
diff --git a/www/manager6/sdn/dns/PowerdnsEdit.js b/www/manager6/sdn/dns/PowerdnsEdit.js
new file mode 100644
index 00000000..5aa289fa
--- /dev/null
+++ b/www/manager6/sdn/dns/PowerdnsEdit.js
@@ -0,0 +1,52 @@
+Ext.define('PVE.sdn.dns.PowerdnsInputPanel', {
+    extend: 'PVE.panel.SDNDnsBase',
+
+    //onlineHelp: 'pvesdn_dns_plugin_pve', // FIXME uncomment once doc-gen is updated
+
+    onGetValues: function(values) {
+        var me = this;
+
+        if (me.isCreate) {
+            values.type = me.type;
+        } else {
+            delete values.dns;
+        }
+
+        return values;
+    },
+
+    initComponent : function() {
+	var me = this;
+
+        me.items = [
+           {
+            xtype: me.isCreate ? 'textfield' : 'displayfield',
+            name: 'dns',
+            maxLength: 10,
+            value: me.dns || '',
+            fieldLabel: 'ID',
+            allowBlank: false
+          },
+          {
+            xtype: 'textfield',
+            name: 'url',
+            fieldLabel: 'url',
+            allowBlank: false,
+          },
+          {
+            xtype: 'textfield',
+            name: 'key',
+            fieldLabel: gettext('api key'),
+            allowBlank: false,
+          },
+          {
+            xtype: 'proxmoxintegerfield',
+            name: 'ttl',
+            fieldLabel: 'ttl',
+            allowBlank: true
+          },
+	];
+
+	me.callParent();
+    }
+});
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 07/18] subnets: add dns fields
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (5 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 06/18] add sdn dns Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 08/18] add vnet option to subnets and remove subnets list from vnet Alexandre Derumier
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/sdn/SubnetEdit.js | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index 2afa1a27..ac9a40ea 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -53,6 +53,41 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
             value: '',
             allowBlank: true,
         },
+        {
+            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
+	},
     ]
 });
 
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 08/18] add vnet option to subnets and remove subnets list from vnet
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (6 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 07/18] subnets: add dns fields Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 09/18] add vnet panel with vnet + subnets split view Alexandre Derumier
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile                |  1 +
 www/manager6/form/SDNVnetSelector.js | 68 ++++++++++++++++++++++++++++
 www/manager6/sdn/SubnetEdit.js       |  7 +++
 www/manager6/sdn/SubnetView.js       |  5 ++
 www/manager6/sdn/VnetEdit.js         |  8 +---
 www/manager6/sdn/VnetView.js         | 22 +--------
 6 files changed, 83 insertions(+), 28 deletions(-)
 create mode 100644 www/manager6/form/SDNVnetSelector.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index fa809089..5bd062b0 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -52,6 +52,7 @@ JSSRC= 							\
 	form/QemuBiosSelector.js			\
 	form/SDNControllerSelector.js			\
 	form/SDNZoneSelector.js				\
+	form/SDNVnetSelector.js				\
 	form/SDNIpamSelector.js				\
 	form/SDNDnsSelector.js				\
 	form/ScsiHwSelector.js				\
diff --git a/www/manager6/form/SDNVnetSelector.js b/www/manager6/form/SDNVnetSelector.js
new file mode 100644
index 00000000..0f9a6613
--- /dev/null
+++ b/www/manager6/form/SDNVnetSelector.js
@@ -0,0 +1,68 @@
+Ext.define('PVE.form.SDNVnetSelector', {
+    extend: 'Proxmox.form.ComboGrid',
+    alias: ['widget.pveSDNVnetSelector'],
+
+    allowBlank: false,
+    valueField: 'vnet',
+    displayField: 'vnet',
+
+    initComponent: function() {
+	var me = this;
+
+	var store = new Ext.data.Store({
+	    model: 'pve-sdn-vnet',
+            sorters: {
+                property: 'vnet',
+                order: 'DESC'
+            },
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    autoSelect: false,
+            listConfig: {
+		columns: [
+		    {
+			header: gettext('Vnet'),
+			sortable: true,
+			dataIndex: 'vnet',
+			flex: 1
+		    },
+		    {
+			header: gettext('Alias'),
+			flex: 1,
+			dataIndex: 'alias',
+		    },
+		    {
+			header: gettext('Tag'),
+			flex: 1,
+			dataIndex: 'tag',
+		    }
+		]
+	    }
+	});
+
+        me.callParent();
+
+	store.load();
+    }
+
+}, function() {
+
+    Ext.define('pve-sdn-vnet', {
+	extend: 'Ext.data.Model',
+	fields: [
+	    'alias',
+	    'tag',
+	    'type',
+	    'vnet',
+	    'zone',
+	],
+	proxy: {
+            type: 'proxmox',
+	    url: "/api2/json/cluster/sdn/vnets"
+	},
+	idProperty: 'vnet'
+    });
+
+});
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index ac9a40ea..8badc34a 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -32,6 +32,13 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
 	    allowBlank: false,
 	    fieldLabel: gettext('Subnet'),
 	},
+        {
+            xtype: 'pveSDNVnetSelector',
+            fieldLabel: gettext('Vnet'),
+            name: 'vnet',
+            value: '',
+            allowBlank: true,
+        },
 	{
 	    xtype: 'textfield',
 	    name: 'gateway',
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
index 95a468bc..012d127b 100644
--- a/www/manager6/sdn/SubnetView.js
+++ b/www/manager6/sdn/SubnetView.js
@@ -73,6 +73,11 @@ Ext.define('PVE.sdn.SubnetView', {
 		    flex: 2,
 		    dataIndex: 'cidr'
 		},
+		{
+		    header: gettext('Vnet'),
+		    flex: 1,
+		    dataIndex: 'vnet',
+		},
 		{
 		    header: gettext('Gateway'),
 		    flex: 1,
diff --git a/www/manager6/sdn/VnetEdit.js b/www/manager6/sdn/VnetEdit.js
index 09e2f3bf..03e539ab 100644
--- a/www/manager6/sdn/VnetEdit.js
+++ b/www/manager6/sdn/VnetEdit.js
@@ -61,13 +61,7 @@ Ext.define('PVE.sdn.VnetInputPanel', {
 	    uncheckedValue: 0,
 	    checked: false,
 	    fieldLabel: gettext('VLAN Aware')
-	},
-	{
-	    xtype: 'textfield',
-	    name: 'subnets',
-	    fieldLabel: gettext('Subnets'),
-	    allowBlank: true,
-	},
+	}
     ]
 });
 
diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js
index 604a2d1a..eefb6e42 100644
--- a/www/manager6/sdn/VnetView.js
+++ b/www/manager6/sdn/VnetView.js
@@ -96,12 +96,7 @@ Ext.define('PVE.sdn.VnetView', {
 		    header: gettext('VLAN Aware'),
 		    flex: 1,
 		    dataIndex: 'vlanaware',
-		},
-		{
-		    header: 'Subnets',
-		    flex: 1,
-		    dataIndex: 'subnets',
-		},
+		}
 	    ],
 	    listeners: {
 		activate: reload,
@@ -111,19 +106,4 @@ Ext.define('PVE.sdn.VnetView', {
 
 	me.callParent();
     }
-}, function() {
-
-    Ext.define('pve-sdn-vnet', {
-	extend: 'Ext.data.Model',
-	fields: [
-	    'alias',
-	    'subnets',
-	    'tag',
-	    'type',
-	    'vnet',
-	    'zone',
-	],
-	idProperty: 'vnet'
-    });
-
 });
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 09/18] add vnet panel with vnet + subnets split view
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (7 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 08/18] add vnet option to subnets and remove subnets list from vnet Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 10/18] subnets: move ipam/dns in advanced section, and use "pve" as default ipam Alexandre Derumier
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile          |  5 +--
 www/manager6/dc/Config.js      | 10 +-----
 www/manager6/sdn/SubnetEdit.js | 13 +++----
 www/manager6/sdn/SubnetView.js | 62 ++++++++++++++++++++++------------
 www/manager6/sdn/VnetPanel.js  | 39 +++++++++++++++++++++
 www/manager6/sdn/VnetView.js   | 14 ++++++--
 6 files changed, 100 insertions(+), 43 deletions(-)
 create mode 100644 www/manager6/sdn/VnetPanel.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 5bd062b0..d30b6529 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -228,8 +228,9 @@ JSSRC= 							\
 	sdn/StatusView.js				\
 	sdn/VnetEdit.js					\
 	sdn/VnetView.js					\
-	sdn/SubnetEdit.js					\
-	sdn/SubnetView.js					\
+	sdn/VnetPanel.js				\
+	sdn/SubnetEdit.js				\
+	sdn/SubnetView.js				\
 	sdn/ZoneContentView.js				\
 	sdn/ZoneView.js					\
 	sdn/controllers/Base.js				\
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index b48eac3c..48238a4e 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -170,21 +170,13 @@ Ext.define('PVE.dc.Config', {
 		    itemId: 'sdnzone'
 		},
 		{
-		    xtype: 'pveSDNVnetView',
+		    xtype: 'pveSDNVnet',
 		    groups: ['sdn'],
 		    title: gettext('Vnets'),
 		    hidden: true,
 		    iconCls: 'fa fa-network-wired',
 		    itemId: 'sdnvnet'
 		},
-		{
-		    xtype: 'pveSDNSubnetView',
-		    groups: ['sdn'],
-		    title: gettext('Subnets'),
-		    hidden: true,
-		    iconCls: 'fa fa-network-wired',
-		    itemId: 'sdnsubnet'
-		},
 		{
 		    xtype: 'pveSDNIpamView',
 		    groups: ['sdn'],
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index 8badc34a..d8c61dd6 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -32,13 +32,6 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
 	    allowBlank: false,
 	    fieldLabel: gettext('Subnet'),
 	},
-        {
-            xtype: 'pveSDNVnetSelector',
-            fieldLabel: gettext('Vnet'),
-            name: 'vnet',
-            value: '',
-            allowBlank: true,
-        },
 	{
 	    xtype: 'textfield',
 	    name: 'gateway',
@@ -107,16 +100,18 @@ Ext.define('PVE.sdn.SubnetEdit', {
 
     width: 350,
 
+    base_url: undefined,
+
     initComponent: function() {
 	var me = this;
 
 	me.isCreate = me.subnet === undefined;
 
 	if (me.isCreate) {
-	    me.url = '/api2/extjs/cluster/sdn/subnets';
+	    me.url = me.base_url;
 	    me.method = 'POST';
 	} else {
-	    me.url = '/api2/extjs/cluster/sdn/subnets/' + me.subnet;
+	    me.url = me.base_url + '/' + me.subnet;
 	    me.method = 'PUT';
 	}
 
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
index 012d127b..96240617 100644
--- a/www/manager6/sdn/SubnetView.js
+++ b/www/manager6/sdn/SubnetView.js
@@ -5,21 +5,38 @@ Ext.define('PVE.sdn.SubnetView', {
     stateful: true,
     stateId: 'grid-sdn-subnet',
 
+    base_url: undefined,
+
+    remove_btn: undefined,
+
+    setBaseUrl: function(url) {
+        var me = this;
+
+        me.base_url = url;
+
+        if (url === undefined) {
+            me.store.removeAll();
+        } else {
+            me.remove_btn.baseurl = url + '/';
+            me.store.setProxy({
+                type: 'proxmox',
+                url: '/api2/json/' + url
+            });
+
+            me.store.load();
+        }
+    },
+
     initComponent : function() {
 	let me = this;
 
-	let store = new Ext.data.Store({
-	    model: 'pve-sdn-subnet',
-	    proxy: {
-                type: 'proxmox',
-		url: "/api2/json/cluster/sdn/subnets"
-	    },
-	    sorters: {
-		property: 'subnet',
-		order: 'DESC'
-	    }
-	});
-	let reload = () => store.load();
+        var store = new Ext.data.Store({
+            model: 'pve-sdn-subnet'
+        });
+
+        var reload = function() {
+            store.load();
+        };
 
 	let sm = Ext.create('Ext.selection.RowModel', {});
 
@@ -29,6 +46,7 @@ Ext.define('PVE.sdn.SubnetView', {
 	    let win = Ext.create('PVE.sdn.SubnetEdit',{
 		autoShow: true,
 		subnet: rec.data.subnet,
+		base_url: me.base_url,
 	    });
 	    win.on('destroy', reload);
         };
@@ -40,10 +58,12 @@ Ext.define('PVE.sdn.SubnetView', {
 	    handler: run_editor,
 	});
 
-	let remove_btn = Ext.create('Proxmox.button.StdRemoveButton', {
+	me.remove_btn = Ext.create('Proxmox.button.StdRemoveButton', {
 	    selModel: sm,
-	    baseurl: '/cluster/sdn/subnets/',
-	    callback: reload
+	    baseurl: me.base_url + '/',
+            callback: function() {
+                reload();
+            },
 	});
 
 	Ext.apply(me, {
@@ -59,12 +79,13 @@ Ext.define('PVE.sdn.SubnetView', {
 		    handler: function() {
 			let win = Ext.create('PVE.sdn.SubnetEdit', {
 			    autoShow: true,
+			    base_url: me.base_url,
 			    type: 'subnet',
 			});
 			win.on('destroy', reload);
 		    }
 		},
-		remove_btn,
+		me.remove_btn,
 		edit_btn,
 	    ],
 	    columns: [
@@ -73,11 +94,6 @@ Ext.define('PVE.sdn.SubnetView', {
 		    flex: 2,
 		    dataIndex: 'cidr'
 		},
-		{
-		    header: gettext('Vnet'),
-		    flex: 1,
-		    dataIndex: 'vnet',
-		},
 		{
 		    header: gettext('Gateway'),
 		    flex: 1,
@@ -101,6 +117,10 @@ Ext.define('PVE.sdn.SubnetView', {
 	});
 
 	me.callParent();
+
+        if (me.base_url) {
+            me.setBaseUrl(me.base_url); // load
+        }
     }
 }, function() {
 
diff --git a/www/manager6/sdn/VnetPanel.js b/www/manager6/sdn/VnetPanel.js
new file mode 100644
index 00000000..4b1cbc6e
--- /dev/null
+++ b/www/manager6/sdn/VnetPanel.js
@@ -0,0 +1,39 @@
+Ext.define('PVE.sdn.Vnet', {
+    extend: 'Ext.panel.Panel',
+    alias: 'widget.pveSDNVnet',
+
+    title: 'Vnet',
+
+    onlineHelp: 'pvesdn_config_vnet',
+
+    initComponent: function() {
+	var me = this;
+
+	var subnetview_panel = Ext.createWidget('pveSDNSubnetView', {
+            title: gettext('Subnets'),
+	    region: 'center',
+	    border: false
+	});
+
+	var vnetview_panel = Ext.createWidget('pveSDNVnetView', {
+            title: 'Vnets',
+	    region: 'west',
+	    subnetview_panel: subnetview_panel,
+	    width: '50%',
+	    border: false,
+	    split: true
+	});
+
+	Ext.apply(me, {
+            layout: 'border',
+            items: [ vnetview_panel, subnetview_panel ],
+	    listeners: {
+		show: function() {
+		    subnetview_panel.fireEvent('show', subnetview_panel);
+		}
+	    }
+	});
+
+	me.callParent();
+    }
+});
diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js
index eefb6e42..e3d86c9a 100644
--- a/www/manager6/sdn/VnetView.js
+++ b/www/manager6/sdn/VnetView.js
@@ -7,6 +7,8 @@ Ext.define('PVE.sdn.VnetView', {
     stateful: true,
     stateId: 'grid-sdn-vnet',
 
+    subnetview_panel: undefined,
+
     initComponent : function() {
 	let me = this;
 
@@ -100,10 +102,18 @@ Ext.define('PVE.sdn.VnetView', {
 	    ],
 	    listeners: {
 		activate: reload,
-		itemdblclick: run_editor
+		itemdblclick: run_editor,
+                show: reload,
+                select: function(sm, rec) {
+                    var url = '/cluster/sdn/vnets/' + rec.data.vnet + '/subnets';
+                    me.subnetview_panel.setBaseUrl(url);
+                },
+                deselect: function() {
+                    me.subnetview_panel.setBaseUrl(undefined);
+                },
 	    }
 	});
-
+	store.load();
 	me.callParent();
     }
 });
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 10/18] subnets: move ipam/dns in advanced section, and use "pve" as default ipam
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (8 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 09/18] add vnet panel with vnet + subnets split view Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 11/18] sdn: add options panel + move controller/ipam/dns view Alexandre Derumier
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Utils.js          | 3 ++-
 www/manager6/sdn/SubnetEdit.js | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 8c939536..5440b972 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -809,7 +809,8 @@ Ext.define('PVE.Utils', { utilities: {
 	pve: {
 	    name: 'PVE',
 	    ipanel: 'PVEIpamInputPanel',
-	    faIcon: 'th'
+	    faIcon: 'th',
+	    hideAdd: true
 	},
 	netbox: {
 	    name: 'Netbox',
diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index d8c61dd6..653c8ae5 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -46,12 +46,14 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
 	    checked: false,
 	    fieldLabel: 'SNAT'
 	},
+    ],
+    advancedItems: [
         {
             xtype: 'pveSDNIpamSelector',
             fieldLabel: gettext('Ipam'),
             name: 'ipam',
-            value: '',
-            allowBlank: true,
+            value: 'pve',
+            allowBlank: false,
         },
         {
             xtype: 'pveSDNDnsSelector',
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 11/18] sdn: add options panel + move controller/ipam/dns view
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (9 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 10/18] subnets: move ipam/dns in advanced section, and use "pve" as default ipam Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 12/18] sdn: display pending values Alexandre Derumier
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile              |  1 +
 www/manager6/dc/Config.js          | 24 +++--------------
 www/manager6/sdn/ControllerView.js |  1 +
 www/manager6/sdn/DnsView.js        |  1 +
 www/manager6/sdn/IpamView.js       |  2 ++
 www/manager6/sdn/OptionsPanel.js   | 41 ++++++++++++++++++++++++++++++
 6 files changed, 50 insertions(+), 20 deletions(-)
 create mode 100644 www/manager6/sdn/OptionsPanel.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index d30b6529..5b702d4b 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -233,6 +233,7 @@ JSSRC= 							\
 	sdn/SubnetView.js				\
 	sdn/ZoneContentView.js				\
 	sdn/ZoneView.js					\
+        sdn/OptionsPanel.js				\
 	sdn/controllers/Base.js				\
 	sdn/controllers/EvpnEdit.js			\
         sdn/IpamView.js                                 \
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 48238a4e..d242aef2 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -153,14 +153,6 @@ Ext.define('PVE.dc.Config', {
 		    itemId: 'sdn',
 		    expandedOnInit: true
 		},
-		{
-		    xtype: 'pveSDNControllerView',
-		    groups: ['sdn'],
-		    title: gettext('Controllers'),
-		    hidden: true,
-		    iconCls: 'fa fa-crosshairs',
-		    itemId: 'sdncontroller'
-		},
 		{
 		    xtype: 'pveSDNZoneView',
 		    groups: ['sdn'],
@@ -178,20 +170,12 @@ Ext.define('PVE.dc.Config', {
 		    itemId: 'sdnvnet'
 		},
 		{
-		    xtype: 'pveSDNIpamView',
-		    groups: ['sdn'],
-		    title: gettext('Ipams'),
-		    hidden: true,
-		    iconCls: 'fa fa-network-wired',
-		    itemId: 'sdnipam'
-		},
-		{
-		    xtype: 'pveSDNDnsView',
+		    xtype: 'pveSDNOptions',
 		    groups: ['sdn'],
-		    title: gettext('Dns'),
+		    title: gettext('Options'),
 		    hidden: true,
-		    iconCls: 'fa fa-network-wired',
-		    itemId: 'sdndns'
+		    iconCls: 'fa fa-gear',
+		    itemId: 'sdnoptions'
 		});
 	    }
 
diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js
index 0d991af3..4fdcdecd 100644
--- a/www/manager6/sdn/ControllerView.js
+++ b/www/manager6/sdn/ControllerView.js
@@ -125,6 +125,7 @@ Ext.define('PVE.sdn.ControllerView', {
 	    }
 	});
 
+	store.load();
 	me.callParent();
     }
 });
diff --git a/www/manager6/sdn/DnsView.js b/www/manager6/sdn/DnsView.js
index 6d47e38f..2459327e 100644
--- a/www/manager6/sdn/DnsView.js
+++ b/www/manager6/sdn/DnsView.js
@@ -126,6 +126,7 @@ Ext.define('PVE.sdn.DnsView', {
 	    }
 	});
 
+	store.load();
 	me.callParent();
     }
 });
diff --git a/www/manager6/sdn/IpamView.js b/www/manager6/sdn/IpamView.js
index 605f44c7..4635b2ab 100644
--- a/www/manager6/sdn/IpamView.js
+++ b/www/manager6/sdn/IpamView.js
@@ -126,6 +126,8 @@ Ext.define('PVE.sdn.IpamView', {
 	    }
 	});
 
+	store.load();
 	me.callParent();
+
     }
 });
diff --git a/www/manager6/sdn/OptionsPanel.js b/www/manager6/sdn/OptionsPanel.js
new file mode 100644
index 00000000..d9145299
--- /dev/null
+++ b/www/manager6/sdn/OptionsPanel.js
@@ -0,0 +1,41 @@
+Ext.define('PVE.sdn.Options', {
+    extend: 'Ext.panel.Panel',
+    alias: 'widget.pveSDNOptions',
+
+    title: 'Options',
+
+    layout: {
+        type: 'vbox',
+        align: 'stretch'
+    },
+
+//    onlineHelp: 'pvesdn_config_vnet',
+
+   initComponent: function() {
+        var me = this;
+
+        me.items = [
+	{
+            xtype: 'pveSDNControllerView',
+            title: gettext('Controllers'),
+            border: 0,
+            collapsible: true,
+            padding: '0 0 20 0'
+        },
+	{
+            xtype: 'pveSDNIpamView',
+            title: gettext('Ipams'),
+            border: 0,
+            collapsible: true,
+            padding: '0 0 20 0'
+        },{
+            xtype: 'pveSDNDnsView',
+            flex: 1,
+            collapsible: true,
+            title: gettext('Dns'),
+            border: 0,
+        }];
+
+        me.callParent();
+    }
+});
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 12/18] sdn: display pending values
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (10 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 11/18] sdn: add options panel + move controller/ipam/dns view Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 13/18] move ipams && dns options to zone Alexandre Derumier
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Utils.js              | 29 ++++++++++++++++++
 www/manager6/sdn/ControllerView.js | 39 +++++++++++++++++++++---
 www/manager6/sdn/SubnetView.js     | 49 +++++++++++++++++++++++++++---
 www/manager6/sdn/VnetView.js       | 31 +++++++++++++++++--
 www/manager6/sdn/ZoneView.js       | 47 +++++++++++++++++++++++++---
 5 files changed, 181 insertions(+), 14 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 5440b972..257af3fd 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -175,6 +175,35 @@ Ext.define('PVE.Utils', { utilities: {
 	'HEALTH_ERR':'critical'
     },
 
+    render_sdn_pending: function(rec,value,key, index) {
+        if (rec.data.state === 'deleted') {
+            if (value === undefined) {
+                return '';
+            } else {
+                return '<div style="text-decoration: line-through;">'+ value +'</div>';
+            }
+
+        } else if (rec.data.state === 'new') {
+            if(index === undefined) {
+                value = rec.data.pending[key];
+            }
+            if (value === undefined || value === null) {
+                value = '';
+            }
+            return '<div style="color:green">' + value + '</div>';
+        } else if (rec.data.state === 'changed') {
+            if (value === undefined || value === null) {
+                value = '<br>';
+            }
+            if (rec.data.pending[key] === undefined || rec.data.pending[key] === null) {
+                rec.data.pending[key] = value;
+            }
+           return '<div style="text-decoration: line-through;">'+ value +'</div>' + '<div style="color:orange">' + rec.data.pending[key] + '</div>';
+        } else {
+            return value;
+        }
+    },
+
     render_ceph_health: function(healthObj) {
 	var state = {
 	    iconCls: PVE.Utils.get_health_icon(),
diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js
index 4fdcdecd..e4730be0 100644
--- a/www/manager6/sdn/ControllerView.js
+++ b/www/manager6/sdn/ControllerView.js
@@ -31,7 +31,7 @@ Ext.define('PVE.sdn.ControllerView', {
 	    model: 'pve-sdn-controller',
 	    proxy: {
                 type: 'proxmox',
-		url: "/api2/json/cluster/sdn/controllers"
+		url: "/api2/json/cluster/sdn/controllers?pending=1"
 	    },
 	    sorters: {
 		property: 'controller',
@@ -45,6 +45,16 @@ Ext.define('PVE.sdn.ControllerView', {
 
 	var sm = Ext.create('Ext.selection.RowModel', {});
 
+	var set_button_status = function() {
+	    var rec = me.selModel.getSelection()[0];
+
+	    if (!rec || rec.data.state === 'deleted') {
+		edit_btn.disable();
+		remove_btn.disable();
+		return;
+	    }
+	};
+
 	var run_editor = function() {
 	    var rec = sm.getSelection()[0];
 	    if (!rec) {
@@ -109,19 +119,40 @@ Ext.define('PVE.sdn.ControllerView', {
 		    header: 'ID',
 		    flex: 2,
 		    sortable: true,
-		    dataIndex: 'controller'
+		    dataIndex: 'controller',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'controller', 1);
+                    }
 		},
 		{
 		    header: gettext('Type'),
 		    flex: 1,
 		    sortable: true,
 		    dataIndex: 'type',
-		    renderer: PVE.Utils.format_sdncontroller_type
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'type', 1);
+                    }
 		},
+                {
+                    header: gettext('Pending'),
+                    flex: 3,
+                    dataIndex: 'pending',
+                    renderer: function(value, metaData, rec) {
+                        if(value !== undefined ) {
+                                delete value.controller;
+                                delete value.type;
+				if(!Ext.Object.isEmpty(value)){
+				    return JSON.stringify(value);
+				}
+                        }
+                        return '';
+                    }
+                }
 	    ],
 	    listeners: {
 		activate: reload,
-		itemdblclick: run_editor
+		itemdblclick: run_editor,
+                selectionchange: set_button_status
 	    }
 	});
 
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
index 96240617..0c04ddf1 100644
--- a/www/manager6/sdn/SubnetView.js
+++ b/www/manager6/sdn/SubnetView.js
@@ -20,7 +20,7 @@ Ext.define('PVE.sdn.SubnetView', {
             me.remove_btn.baseurl = url + '/';
             me.store.setProxy({
                 type: 'proxmox',
-                url: '/api2/json/' + url
+                url: '/api2/json/' + url + '?pending=1'
             });
 
             me.store.load();
@@ -40,6 +40,16 @@ Ext.define('PVE.sdn.SubnetView', {
 
 	let sm = Ext.create('Ext.selection.RowModel', {});
 
+	var set_button_status = function() {
+	    var rec = me.selModel.getSelection()[0];
+
+	    if (!rec || rec.data.state === 'deleted') {
+		edit_btn.disable();
+		remove_btn.disable();
+		return;
+	    }
+	};
+
         let run_editor = function() {
 	    let rec = sm.getSelection()[0];
 
@@ -92,27 +102,58 @@ Ext.define('PVE.sdn.SubnetView', {
 		{
 		    header: 'ID',
 		    flex: 2,
-		    dataIndex: 'cidr'
+		    dataIndex: 'cidr',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'cidr', 1);
+                    }
 		},
 		{
 		    header: gettext('Gateway'),
 		    flex: 1,
 		    dataIndex: 'gateway',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'gateway');
+                    }
 		},
 		{
 		    header: 'SNAT',
 		    flex: 1,
 		    dataIndex: 'snat',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'snat');
+                    }
 		},
 		{
 		    header: 'Ipam',
 		    flex: 1,
 		    dataIndex: 'ipam',
-		}
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'ipam');
+                    }
+		},
+                {
+                    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: {
 		activate: reload,
-		itemdblclick: run_editor
+		itemdblclick: run_editor,
+                selectionchange: set_button_status
 	    }
 	});
 
diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js
index e3d86c9a..da0234dd 100644
--- a/www/manager6/sdn/VnetView.js
+++ b/www/manager6/sdn/VnetView.js
@@ -16,17 +16,28 @@ Ext.define('PVE.sdn.VnetView', {
 	    model: 'pve-sdn-vnet',
 	    proxy: {
                 type: 'proxmox',
-		url: "/api2/json/cluster/sdn/vnets"
+		url: "/api2/json/cluster/sdn/vnets?pending=1"
 	    },
 	    sorters: {
 		property: 'vnet',
 		order: 'DESC'
 	    }
 	});
+
 	let reload = () => store.load();
 
 	let sm = Ext.create('Ext.selection.RowModel', {});
 
+	var set_button_status = function() {
+	    var rec = me.selModel.getSelection()[0];
+
+	    if (!rec || rec.data.state === 'deleted') {
+		edit_btn.disable();
+ 		remove_btn.disable();
+		return;
+ 	    }
+	};
+
         let run_editor = function() {
 	    let rec = sm.getSelection()[0];
 
@@ -77,32 +88,48 @@ Ext.define('PVE.sdn.VnetView', {
 		{
 		    header: 'ID',
 		    flex: 2,
-		    dataIndex: 'vnet'
+		    dataIndex: 'vnet',
+                    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending(rec, value, 'vnet', 1);
+		    }
 		},
 		{
 		    header: gettext('Alias'),
 		    flex: 1,
 		    dataIndex: 'alias',
+                    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending(rec, value, 'alias');
+		    }
 		},
 		{
 		    header: gettext('Zone'),
 		    flex: 1,
 		    dataIndex: 'zone',
+                    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending(rec, value, 'zone');
+		    }
 		},
 		{
 		    header: gettext('Tag'),
 		    flex: 1,
 		    dataIndex: 'tag',
+                    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending(rec, value, 'tag');
+		    }
 		},
 		{
 		    header: gettext('VLAN Aware'),
 		    flex: 1,
 		    dataIndex: 'vlanaware',
+                    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending(rec, value, 'vlanaware');
+		    }
 		}
 	    ],
 	    listeners: {
 		activate: reload,
 		itemdblclick: run_editor,
+		selectionchange: set_button_status,
                 show: reload,
                 select: function(sm, rec) {
                     var url = '/cluster/sdn/vnets/' + rec.data.vnet + '/subnets';
diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js
index 7b664537..b530bd5f 100644
--- a/www/manager6/sdn/ZoneView.js
+++ b/www/manager6/sdn/ZoneView.js
@@ -31,7 +31,7 @@ Ext.define('PVE.sdn.ZoneView', {
 	    model: 'pve-sdn-zone',
 	    proxy: {
                 type: 'proxmox',
-		url: "/api2/json/cluster/sdn/zones"
+		url: "/api2/json/cluster/sdn/zones?pending=1"
 	    },
 	    sorters: {
 		property: 'zone',
@@ -45,6 +45,16 @@ Ext.define('PVE.sdn.ZoneView', {
 
 	let sm = Ext.create('Ext.selection.RowModel', {});
 
+	var set_button_status = function() {
+	    var rec = me.selModel.getSelection()[0];
+
+	    if (!rec || rec.data.state === 'deleted') {
+		edit_btn.disable();
+		remove_btn.disable();
+ 		return;
+ 	    }
+	};
+
 	let run_editor = function() {
 	    let rec = sm.getSelection()[0];
 	    if (!rec) {
@@ -108,28 +118,57 @@ Ext.define('PVE.sdn.ZoneView', {
 		{
 		    header: 'ID',
 		    flex: 2,
-		    dataIndex: 'zone'
+		    dataIndex: 'zone',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'zone', 1);
+                    }
 		},
 		{
 		    header: gettext('Type'),
 		    flex: 1,
 		    dataIndex: 'type',
-		    renderer: PVE.Utils.format_sdnzone_type
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'type', 1);
+                    }
 		},
 		{
 		    header: 'MTU',
 		    flex: 1,
 		    dataIndex: 'mtu',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'mtu');
+                    }
 		},
 		{
 		    header: gettext('Nodes'),
 		    flex: 3,
 		    dataIndex: 'nodes',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'nodes');
+                    }
+		},
+		{
+		    header: gettext('Pending'),
+		    flex: 3,
+		    dataIndex: 'pending',
+                    renderer: function(value, metaData, rec) {
+			if(value !== undefined ) {
+				delete value.nodes;
+				delete value.zone;
+				delete value.type;
+				delete value.mtu;
+				if(!Ext.Object.isEmpty(value)){
+				    return JSON.stringify(value);
+ 				}
+			}
+			return '';
+                    }
 		},
 	    ],
 	    listeners: {
 		activate: reload,
-		itemdblclick: run_editor
+		itemdblclick: run_editor,
+                selectionchange: set_button_status
 	    }
 	});
 
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 13/18] move ipams && dns options to zone
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (11 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 12/18] sdn: display pending values Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 14/18] sdn: browser: add onlinehelp Alexandre Derumier
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@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




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

* [pve-devel] [PATCH v9 pve-manager 14/18] sdn: browser: add onlinehelp
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (12 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 13/18] move ipams && dns options to zone Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 15/18] sdn: evpn improvments Alexandre Derumier
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

(needed, or the panel don't load)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/sdn/Browser.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/manager6/sdn/Browser.js b/www/manager6/sdn/Browser.js
index 1415f966..e5ffc0e8 100644
--- a/www/manager6/sdn/Browser.js
+++ b/www/manager6/sdn/Browser.js
@@ -2,6 +2,8 @@ Ext.define('PVE.sdn.Browser', {
     extend: 'PVE.panel.Config',
     alias: 'widget.PVE.sdn.Browser',
 
+    onlineHelp: 'chapter_pvesdn',
+
     initComponent: function() {
         var me = this;
 
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 15/18] sdn: evpn improvments
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (13 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 14/18] sdn: browser: add onlinehelp Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 16/18] sdn: update onlinehelp links Alexandre Derumier
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Makefile                    |  1 +
 www/manager6/Utils.js                    |  5 ++
 www/manager6/sdn/ControllerView.js       |  9 ++++
 www/manager6/sdn/controllers/BgpEdit.js  | 62 ++++++++++++++++++++++++
 www/manager6/sdn/controllers/EvpnEdit.js | 16 +-----
 www/manager6/sdn/zones/Base.js           |  5 ++
 www/manager6/sdn/zones/EvpnEdit.js       |  7 +++
 7 files changed, 91 insertions(+), 14 deletions(-)
 create mode 100644 www/manager6/sdn/controllers/BgpEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 5b702d4b..60850b3e 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -236,6 +236,7 @@ JSSRC= 							\
         sdn/OptionsPanel.js				\
 	sdn/controllers/Base.js				\
 	sdn/controllers/EvpnEdit.js			\
+	sdn/controllers/BgpEdit.js			\
         sdn/IpamView.js                                 \
         sdn/ipams/Base.js                               \
         sdn/ipams/NetboxEdit.js                         \
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 98cb8ca1..89706c32 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -828,6 +828,11 @@ Ext.define('PVE.Utils', { utilities: {
 	    ipanel: 'EvpnInputPanel',
 	    faIcon: 'crosshairs'
 	},
+	bgp: {
+	    name: 'bgp',
+	    ipanel: 'BgpInputPanel',
+	    faIcon: 'crosshairs'
+	},
     },
 
     sdnipamSchema: {
diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js
index e4730be0..9e400f7f 100644
--- a/www/manager6/sdn/ControllerView.js
+++ b/www/manager6/sdn/ControllerView.js
@@ -133,6 +133,15 @@ Ext.define('PVE.sdn.ControllerView', {
                         return PVE.Utils.render_sdn_pending(rec, value, 'type', 1);
                     }
 		},
+		{
+		    header: gettext('Node'),
+		    flex: 1,
+		    sortable: true,
+		    dataIndex: 'node',
+                    renderer: function(value, metaData, rec) {
+                        return PVE.Utils.render_sdn_pending(rec, value, 'node', 1);
+                    }
+		},
                 {
                     header: gettext('Pending'),
                     flex: 3,
diff --git a/www/manager6/sdn/controllers/BgpEdit.js b/www/manager6/sdn/controllers/BgpEdit.js
new file mode 100644
index 00000000..2af7a7bd
--- /dev/null
+++ b/www/manager6/sdn/controllers/BgpEdit.js
@@ -0,0 +1,62 @@
+Ext.define('PVE.sdn.controllers.BgpInputPanel', {
+    extend: 'PVE.panel.SDNControllerBase',
+
+    onlineHelp: 'pvesdn_controller_plugin_evpn',
+
+    initComponent : function() {
+	var me = this;
+
+	me.items = [
+	    {
+		xtype: me.isCreate ? 'textfield' : 'displayfield',
+		name: 'controller',
+		maxLength: 8,
+		value: me.controllerid || '',
+		fieldLabel: 'ID',
+		allowBlank: false
+	    },
+	    {
+		xtype: 'proxmoxintegerfield',
+		name: 'asn',
+		minValue: 1,
+		maxValue: 4294967295,
+		value: 65000,
+		fieldLabel: 'ASN #',
+		allowBlank: false
+	    },
+	    {
+		xtype: 'textfield',
+		name: 'peers',
+		fieldLabel: gettext('Peers'),
+		allowBlank: false
+	    },
+	    {
+		xtype: 'proxmoxcheckbox',
+		name: 'ebgp',
+		uncheckedValue: 0,
+		checked: false,
+		fieldLabel: 'EBGP'
+	    },
+	    {
+		xtype: 'pveNodeSelector',
+		name: 'node',
+		fieldLabel: gettext('Node'),
+		multiSelect: false,
+		autoSelect: false,
+		allowBlank: false
+	    },
+
+	];
+
+	me.advancedItems = [
+
+	    {
+		xtype: 'textfield',
+		name: 'loopback',
+		fieldLabel: gettext('Loopback Interface'),
+	    },
+	];
+
+	me.callParent();
+    }
+});
diff --git a/www/manager6/sdn/controllers/EvpnEdit.js b/www/manager6/sdn/controllers/EvpnEdit.js
index 125a8fc7..5aa924f0 100644
--- a/www/manager6/sdn/controllers/EvpnEdit.js
+++ b/www/manager6/sdn/controllers/EvpnEdit.js
@@ -29,20 +29,8 @@ Ext.define('PVE.sdn.controllers.EvpnInputPanel', {
 		name: 'peers',
 		fieldLabel: gettext('Peers'),
 		allowBlank: false
-	    },
-	    {
-		xtype: 'textfield',
-		name: 'gateway-external-peers',
-		fieldLabel: gettext('External Gateway Peers'),
-		allowBlank: true
-	    },
-	    {
-		xtype: 'pveNodeSelector',
-		name: 'gateway-nodes',
-		fieldLabel: gettext('Gateway Nodes'),
-		multiSelect: true,
-		autoSelect: false
-	    },
+	    }
+
 	];
 
 	me.callParent();
diff --git a/www/manager6/sdn/zones/Base.js b/www/manager6/sdn/zones/Base.js
index 6e2f5c1c..9eb31fd4 100644
--- a/www/manager6/sdn/zones/Base.js
+++ b/www/manager6/sdn/zones/Base.js
@@ -94,6 +94,11 @@ Ext.define('PVE.sdn.zones.BaseEdit', {
 		    if (values.nodes) {
 			values.nodes = values.nodes.split(',');
 		    }
+
+		    if (values.exitnodes) {
+			values.exitnodes = values.exitnodes.split(',');
+		    }
+
 		    values.enable = values.disable ? 0 : 1;
 
 		    ipanel.setValues(values);
diff --git a/www/manager6/sdn/zones/EvpnEdit.js b/www/manager6/sdn/zones/EvpnEdit.js
index f5a9560e..1a078a81 100644
--- a/www/manager6/sdn/zones/EvpnEdit.js
+++ b/www/manager6/sdn/zones/EvpnEdit.js
@@ -35,6 +35,13 @@ Ext.define('PVE.sdn.zones.EvpnInputPanel', {
 	    fieldLabel: 'VRF-VXLAN Tag',
 	    allowBlank: false
 	  },
+	  {
+	    xtype: 'pveNodeSelector',
+	    name: 'exitnodes',
+	    fieldLabel: gettext('Exit Nodes'),
+	    multiSelect: true,
+	    autoSelect: false
+	  },
 	  {
 	    xtype: 'pveSDNControllerSelector',
 	    fieldLabel: gettext('Controller'),
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 16/18] sdn: update onlinehelp links
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (14 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 15/18] sdn: evpn improvments Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 17/18] sdn : zone content view: add alias && resize column Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 18/18] sdn: add pending state column with hover tip Alexandre Derumier
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/sdn/ControllerView.js | 2 +-
 www/manager6/sdn/OptionsPanel.js   | 2 +-
 www/manager6/sdn/ZoneView.js       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js
index 9e400f7f..10c9c446 100644
--- a/www/manager6/sdn/ControllerView.js
+++ b/www/manager6/sdn/ControllerView.js
@@ -2,7 +2,7 @@ Ext.define('PVE.sdn.ControllerView', {
     extend: 'Ext.grid.GridPanel',
     alias: ['widget.pveSDNControllerView'],
 
-    onlineHelp: 'pvesdn_controller_plugins',
+    onlineHelp: 'pvesdn_config_controllers',
 
     stateful: true,
     stateId: 'grid-sdn-controller',
diff --git a/www/manager6/sdn/OptionsPanel.js b/www/manager6/sdn/OptionsPanel.js
index d9145299..781c44b0 100644
--- a/www/manager6/sdn/OptionsPanel.js
+++ b/www/manager6/sdn/OptionsPanel.js
@@ -9,7 +9,7 @@ Ext.define('PVE.sdn.Options', {
         align: 'stretch'
     },
 
-//    onlineHelp: 'pvesdn_config_vnet',
+   onlineHelp: 'pvesdn_config_controllers',
 
    initComponent: function() {
         var me = this;
diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js
index d842654a..ae44f95f 100644
--- a/www/manager6/sdn/ZoneView.js
+++ b/www/manager6/sdn/ZoneView.js
@@ -2,7 +2,7 @@ Ext.define('PVE.sdn.ZoneView', {
     extend: 'Ext.grid.GridPanel',
     alias: ['widget.pveSDNZoneView'],
 
-    onlineHelp: 'pvesdn_zone_plugins',
+    onlineHelp: 'pvesdn_config_zone',
 
     stateful: true,
     stateId: 'grid-sdn-zone',
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 17/18] sdn : zone content view: add alias && resize column
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (15 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 16/18] sdn: update onlinehelp links Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 18/18] sdn: add pending state column with hover tip Alexandre Derumier
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/sdn/ZoneContentView.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/www/manager6/sdn/ZoneContentView.js b/www/manager6/sdn/ZoneContentView.js
index 20a5fe1e..7069e52a 100644
--- a/www/manager6/sdn/ZoneContentView.js
+++ b/www/manager6/sdn/ZoneContentView.js
@@ -57,18 +57,25 @@ Ext.define('PVE.sdn.ZoneContentView', {
 	    columns: [
 		{
 		    header: 'VNet',
-		    flex: 1,
+		    width: 100,
 		    sortable: true,
 		    dataIndex: 'vnet'
 		},
+		{
+		    header: 'Alias',
+		    width: 300,
+		    sortable: true,
+		    dataIndex: 'alias'
+		},
 		{
 		    header: gettext('Status'),
-		    width: 20,
+		    width: 100,
+		    sortable: true,
 		    dataIndex: 'status',
 		},
 		{
 		    header: gettext('Details'),
-		    width: 20,
+		    flex: 1,
 		    dataIndex: 'statusmsg',
 		},
 	    ],
-- 
2.20.1




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

* [pve-devel] [PATCH v9 pve-manager 18/18] sdn: add pending state column with hover tip
  2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
                   ` (16 preceding siblings ...)
  2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 17/18] sdn : zone content view: add alias && resize column Alexandre Derumier
@ 2020-12-03 10:34 ` Alexandre Derumier
  17 siblings, 0 replies; 19+ messages in thread
From: Alexandre Derumier @ 2020-12-03 10:34 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 www/manager6/Utils.js              | 71 +++++++++++++++++++-----------
 www/manager6/sdn/ControllerView.js | 17 +++----
 www/manager6/sdn/SubnetView.js     | 12 ++++-
 www/manager6/sdn/VnetView.js       |  8 ++++
 www/manager6/sdn/ZoneView.js       | 27 +++---------
 5 files changed, 75 insertions(+), 60 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 89706c32..5a6267fe 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -176,32 +176,51 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     render_sdn_pending: function(rec,value,key, index) {
-        if (rec.data.state === 'deleted') {
-            if (value === undefined) {
-                return ' ';
-            } else {
-                return '<div style="text-decoration: line-through;">'+ value +'</div>';
-            }
-
-        } else if (rec.data.state === 'new') {
-            if(index === undefined) {
-                value = rec.data.pending[key];
-            }
-            if (value === undefined || value === null) {
-                value = ' ';
-            }
-            return '<div style="color:green">' + value + '</div>';
-        } else if (rec.data.state === 'changed') {
-            if (value === undefined || value === null) {
-                value = '<br>';
-            }
-            if (rec.data.pending[key] === undefined || rec.data.pending[key] === null) {
-                rec.data.pending[key] = value;
-            }
-           return '<div style="text-decoration: line-through;">'+ value +'</div>' + '<div style="color:orange">' + rec.data.pending[key] + '</div>';
-        } else {
-            return value;
-        }
+	if (rec.data.state === undefined || rec.data.state === null) {
+	    return value;
+	}
+
+	if (rec.data.state === 'deleted') {
+	    if (value === undefined) {
+		return ' ';
+	    } else {
+		return '<div style="text-decoration: line-through;">'+ value +'</div>';
+	    }
+	} else {
+
+	    if (rec.data.pending[key] !== undefined && rec.data.pending[key] !== null) {
+		if (rec.data.pending[key] === 'deleted') {
+		    return ' ';
+		} else {
+		    return rec.data.pending[key];
+		}
+	    } else {
+		return value;
+	    }
+	}
+	return value;
+    },
+
+    render_sdn_pending_state: function(rec,value) {
+
+	if (value === undefined || value === null) {
+	    return ' ';
+	}
+
+	let icon = `<i class="fa fa-fw fa-refresh warning"></i>`;
+
+	if (value === 'deleted') {
+	    return '<span>' + icon + value + '</span>';
+	}
+
+	let tip = 'Pending apply: <br>';
+
+	for (const [key, keyvalue] of Object.entries(rec.data.pending)) {
+	    if (((rec.data[key] !== undefined && rec.data.pending[key] !== rec.data[key]) || rec.data[key] === undefined)) {
+		tip = tip + `${key}: ${keyvalue} <br>`;
+	    }
+	}
+	return '<span data-qtip="' + tip + '">'+ icon + value + '</span>';
     },
 
     render_ceph_health: function(healthObj) {
diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js
index 10c9c446..7981eba9 100644
--- a/www/manager6/sdn/ControllerView.js
+++ b/www/manager6/sdn/ControllerView.js
@@ -143,19 +143,12 @@ Ext.define('PVE.sdn.ControllerView', {
                     }
 		},
                 {
-                    header: gettext('Pending'),
-                    flex: 3,
-                    dataIndex: 'pending',
+                    header: gettext('State'),
+		    width: 100,
+                    dataIndex: 'state',
                     renderer: function(value, metaData, rec) {
-                        if(value !== undefined ) {
-                                delete value.controller;
-                                delete value.type;
-				if(!Ext.Object.isEmpty(value)){
-				    return JSON.stringify(value);
-				}
-                        }
-                        return '';
-                    }
+                        return PVE.Utils.render_sdn_pending_state(rec, value);
+		    }
                 }
 	    ],
 	    listeners: {
diff --git a/www/manager6/sdn/SubnetView.js b/www/manager6/sdn/SubnetView.js
index bff047fb..9a85bbbc 100644
--- a/www/manager6/sdn/SubnetView.js
+++ b/www/manager6/sdn/SubnetView.js
@@ -129,8 +129,16 @@ Ext.define('PVE.sdn.SubnetView', {
 		    dataIndex: 'dnszoneprefix',
                     renderer: function(value, metaData, rec) {
                         return PVE.Utils.render_sdn_pending(rec, value, 'dnszoneprefix');
-                    }
-		},
+		    }
+                },
+		{
+		    header: gettext('State'),
+		    width: 100,
+		    dataIndex: 'state',
+		    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending_state(rec, value);
+		    }
+		}
 
 	    ],
 	    listeners: {
diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js
index da0234dd..a38a9c9a 100644
--- a/www/manager6/sdn/VnetView.js
+++ b/www/manager6/sdn/VnetView.js
@@ -124,6 +124,14 @@ Ext.define('PVE.sdn.VnetView', {
                     renderer: function(value, metaData, rec) {
 			return PVE.Utils.render_sdn_pending(rec, value, 'vlanaware');
 		    }
+		},
+		{
+		    header: gettext('State'),
+		    width: 100,
+		    dataIndex: 'state',
+                    renderer: function(value, metaData, rec) {
+			return PVE.Utils.render_sdn_pending_state(rec, value);
+		    }
 		}
 	    ],
 	    listeners: {
diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js
index ae44f95f..0d4ce9ac 100644
--- a/www/manager6/sdn/ZoneView.js
+++ b/www/manager6/sdn/ZoneView.js
@@ -179,27 +179,14 @@ Ext.define('PVE.sdn.ZoneView', {
                         return PVE.Utils.render_sdn_pending(rec, value, 'reversedns');
                     }
 		},
-		{
-		    header: gettext('Pending'),
-		    flex: 3,
-		    dataIndex: 'pending',
+                {
+                    header: gettext('State'),
+		    width: 100,
+                    dataIndex: 'state',
                     renderer: function(value, metaData, rec) {
-			if(value !== undefined ) {
-				delete value.nodes;
-				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);
- 				}
-			}
-			return '';
-                    }
-		},
+                        return PVE.Utils.render_sdn_pending_state(rec, value);
+		    }
+                }
 	    ],
 	    listeners: {
 		activate: reload,
-- 
2.20.1




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

end of thread, other threads:[~2020-12-03 10:35 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 10:34 [pve-devel] [PATCH v9 pve-manager 00/18] sdn: add subnets management Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 01/18] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 02/18] add sdn subnets Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 03/18] add sdn ipams Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 04/18] sdn: add PVEIpam Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 05/18] sdn: subnets: ipam is optional Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 06/18] add sdn dns Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 07/18] subnets: add dns fields Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 08/18] add vnet option to subnets and remove subnets list from vnet Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 09/18] add vnet panel with vnet + subnets split view Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 10/18] subnets: move ipam/dns in advanced section, and use "pve" as default ipam Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 11/18] sdn: add options panel + move controller/ipam/dns view Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 12/18] sdn: display pending values Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 13/18] move ipams && dns options to zone Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 14/18] sdn: browser: add onlinehelp Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 15/18] sdn: evpn improvments Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 16/18] sdn: update onlinehelp links Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 17/18] sdn : zone content view: add alias && resize column Alexandre Derumier
2020-12-03 10:34 ` [pve-devel] [PATCH v9 pve-manager 18/18] sdn: add pending state column with hover tip Alexandre Derumier

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