* [pve-devel] [PATCH pve-manager 0/2] sdn : add subnets management
@ 2020-07-14 5:47 Alexandre Derumier
2020-07-14 5:47 ` [pve-devel] [PATCH pve-manager 1/2] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
2020-07-14 5:47 ` [pve-devel] [PATCH pve-manager 2/2] add sdn subnets Alexandre Derumier
0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Derumier @ 2020-07-14 5:47 UTC (permalink / raw)
To: pve-devel
Following pve-network
Alexandre Derumier (2):
sdn: vnetedit: add subnets && remove ip/mac
add sdn subnets
www/manager6/Makefile | 2 +
www/manager6/dc/Config.js | 8 +++
www/manager6/sdn/SubnetEdit.js | 95 +++++++++++++++++++++++++++++
www/manager6/sdn/SubnetView.js | 107 +++++++++++++++++++++++++++++++++
www/manager6/sdn/VnetEdit.js | 29 +--------
www/manager6/sdn/VnetView.js | 18 +-----
6 files changed, 218 insertions(+), 41 deletions(-)
create mode 100644 www/manager6/sdn/SubnetEdit.js
create mode 100644 www/manager6/sdn/SubnetView.js
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH pve-manager 1/2] sdn: vnetedit: add subnets && remove ip/mac
2020-07-14 5:47 [pve-devel] [PATCH pve-manager 0/2] sdn : add subnets management Alexandre Derumier
@ 2020-07-14 5:47 ` Alexandre Derumier
2020-07-14 5:47 ` [pve-devel] [PATCH pve-manager 2/2] add sdn subnets Alexandre Derumier
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Derumier @ 2020-07-14 5:47 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] 3+ messages in thread
* [pve-devel] [PATCH pve-manager 2/2] add sdn subnets
2020-07-14 5:47 [pve-devel] [PATCH pve-manager 0/2] sdn : add subnets management Alexandre Derumier
2020-07-14 5:47 ` [pve-devel] [PATCH pve-manager 1/2] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
@ 2020-07-14 5:47 ` Alexandre Derumier
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Derumier @ 2020-07-14 5:47 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] 3+ messages in thread
end of thread, other threads:[~2020-07-14 5:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 5:47 [pve-devel] [PATCH pve-manager 0/2] sdn : add subnets management Alexandre Derumier
2020-07-14 5:47 ` [pve-devel] [PATCH pve-manager 1/2] sdn: vnetedit: add subnets && remove ip/mac Alexandre Derumier
2020-07-14 5:47 ` [pve-devel] [PATCH pve-manager 2/2] add sdn subnets Alexandre Derumier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox