public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management
@ 2020-08-24 16:48 Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 1/8] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 UTC (permalink / raw)
  To: pve-devel

Following pve-network

Changelogv2:

- add ipams gui

Changelogv3:

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

Changelogv4:

- add dns gui
- reworking vnet-subnet association

Alexandre Derumier (8):
  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

 www/manager6/Makefile                 |  13 +++
 www/manager6/Utils.js                 |  50 +++++++++
 www/manager6/dc/Config.js             |  24 +++++
 www/manager6/form/SDNDnsSelector.js   |  52 ++++++++++
 www/manager6/form/SDNIpamSelector.js  |  52 ++++++++++
 www/manager6/form/SDNVnetSelector.js  |  68 ++++++++++++
 www/manager6/sdn/DnsView.js           | 131 +++++++++++++++++++++++
 www/manager6/sdn/IpamView.js          | 131 +++++++++++++++++++++++
 www/manager6/sdn/SubnetEdit.js        | 144 ++++++++++++++++++++++++++
 www/manager6/sdn/SubnetView.js        | 117 +++++++++++++++++++++
 www/manager6/sdn/VnetEdit.js          |  33 +-----
 www/manager6/sdn/VnetView.js          |  32 ------
 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 ++++++++++
 18 files changed, 1116 insertions(+), 63 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/SubnetEdit.js
 create mode 100644 www/manager6/sdn/SubnetView.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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 1/8] sdn: vnetedit: add subnets && remove ip/mac
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 2/8] add sdn subnets Alexandre Derumier
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 2/8] add sdn subnets
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 1/8] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 3/8] add sdn ipams Alexandre Derumier
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 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 a5e908bb..48924674 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -207,6 +207,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 905c3dc0..610b38db 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 3/8] add sdn ipams
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 1/8] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 2/8] add sdn subnets Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 4/8] sdn: add PVEIpam Alexandre Derumier
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 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 48924674..e6bf8647 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -100,6 +100,7 @@ JSSRC= 							\
 	form/QemuBiosSelector.js			\
 	form/SDNControllerSelector.js			\
 	form/SDNZoneSelector.js				\
+	form/SDNIpamSelector.js				\
 	form/ScsiHwSelector.js				\
 	form/SecurityGroupSelector.js			\
 	form/SnapshotSelector.js			\
@@ -213,6 +214,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 bf9ceda9..f8560584 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 610b38db..f92bb24b 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 4/8] sdn: add PVEIpam
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
                   ` (2 preceding siblings ...)
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 3/8] add sdn ipams Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 5/8] sdn: subnets: ipam is optional Alexandre Derumier
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 UTC (permalink / raw)
  To: pve-devel

---
 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 e6bf8647..5c25f4fb 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -217,6 +217,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 f8560584..20417841 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 5/8] sdn: subnets: ipam is optional
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
                   ` (3 preceding siblings ...)
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 4/8] sdn: add PVEIpam Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 6/8] add sdn dns Alexandre Derumier
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 UTC (permalink / raw)
  To: pve-devel

---
 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 6/8] add sdn dns
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
                   ` (4 preceding siblings ...)
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 5/8] sdn: subnets: ipam is optional Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 7/8] subnets: add dns fields Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 8/8] add vnet option to subnets and remove subnets list from vnet Alexandre Derumier
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 UTC (permalink / raw)
  To: pve-devel

---
 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 5c25f4fb..11761df5 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -101,6 +101,7 @@ JSSRC= 							\
 	form/SDNControllerSelector.js			\
 	form/SDNZoneSelector.js				\
 	form/SDNIpamSelector.js				\
+	form/SDNDnsSelector.js				\
 	form/ScsiHwSelector.js				\
 	form/SecurityGroupSelector.js			\
 	form/SnapshotSelector.js			\
@@ -219,6 +220,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 20417841..0823510c 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 f92bb24b..d525c93d 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 7/8] subnets: add dns fields
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
                   ` (5 preceding siblings ...)
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 6/8] add sdn dns Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 8/8] add vnet option to subnets and remove subnets list from vnet Alexandre Derumier
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 UTC (permalink / raw)
  To: pve-devel

---
 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] 9+ messages in thread

* [pve-devel] [PATCH v4 pve-manager 8/8] add vnet option to subnets and remove subnets list from vnet
  2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
                   ` (6 preceding siblings ...)
  2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 7/8] subnets: add dns fields Alexandre Derumier
@ 2020-08-24 16:48 ` Alexandre Derumier
  7 siblings, 0 replies; 9+ messages in thread
From: Alexandre Derumier @ 2020-08-24 16:48 UTC (permalink / raw)
  To: pve-devel

---
 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 11761df5..7cb5939d 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -100,6 +100,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] 9+ messages in thread

end of thread, other threads:[~2020-08-24 16:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 16:48 [pve-devel] [PATCH v4 pve-manager 0/8] sdn : add subnets management Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 1/8] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 2/8] add sdn subnets Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 3/8] add sdn ipams Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 4/8] sdn: add PVEIpam Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 5/8] sdn: subnets: ipam is optional Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 6/8] add sdn dns Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 7/8] subnets: add dns fields Alexandre Derumier
2020-08-24 16:48 ` [pve-devel] [PATCH v4 pve-manager 8/8] add vnet option to subnets and remove subnets list from vnet 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