[pve-devel] [RFC PATCH 3/3] www/network: ipv6 related columns and edit fields
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon Jun 22 16:07:07 CEST 2015
---
www/manager/Toolkit.js | 6 ++++++
www/manager/Utils.js | 1 +
www/manager/node/NetworkEdit.js | 39 +++++++++++++++++++++++++++++++++++++++
www/manager/node/NetworkView.js | 20 ++++++++++++++++++--
4 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/www/manager/Toolkit.js b/www/manager/Toolkit.js
index c9a354f..ecee399 100644
--- a/www/manager/Toolkit.js
+++ b/www/manager/Toolkit.js
@@ -25,6 +25,12 @@ Ext.apply(Ext.form.field.VTypes, {
IP6AddressText: gettext('Example') + ': 2001:DB8::42',
IP6AddressMask: /[A-Fa-f0-9:]/,
+ IP6Subnet: function(v) {
+ return IP6_subnet_match.test(v);
+ },
+ IP6SubnetText: gettext('Example') + ': 112',
+ IP6SubnetMask: /[0-9]/,
+
IP6CIDRAddress: function(v) {
return IP6_cidr_match.test(v);
},
diff --git a/www/manager/Utils.js b/www/manager/Utils.js
index 7632822..345c756 100644
--- a/www/manager/Utils.js
+++ b/www/manager/Utils.js
@@ -45,6 +45,7 @@ var IPV6_REGEXP = "(?:" +
var IP6_match = new RegExp("^(?:" + IPV6_REGEXP + ")$");
var IP6_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + ")\/[0-9]{1,3}?$");
var IP6_bracket_match = new RegExp("^\\[(" + IPV6_REGEXP + ")\\]");
+var IP6_subnet_match = new RegExp("^(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$");
var IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
diff --git a/www/manager/node/NetworkEdit.js b/www/manager/node/NetworkEdit.js
index 072bee6..eef892b 100644
--- a/www/manager/node/NetworkEdit.js
+++ b/www/manager/node/NetworkEdit.js
@@ -233,6 +233,45 @@ Ext.define('PVE.node.NetworkEdit', {
fieldLabel: gettext('Gateway'),
vtype: 'IPAddress',
name: 'gateway'
+ },
+ {
+ xtype: 'pvetextfield',
+ deleteEmpty: !me.create,
+ fieldLabel: gettext('IPv6 address'),
+ vtype: 'IP6Address',
+ name: 'address6'
+ },
+ {
+ xtype: 'pvetextfield',
+ deleteEmpty: !me.create,
+ fieldLabel: gettext('Subnet length'),
+ vtype: 'IP6Subnet',
+ name: 'netmask6',
+ validator: function(value) {
+ /*jslint confusion: true */
+ if (!me.items) {
+ return true;
+ }
+ var address = me.down('field[name=address6]').getValue();
+ if (value !== '') {
+ if (address === '') {
+ return "IPv6 subnet length requires option 'IPv6 address'";
+ }
+ } else {
+ if (address !== '') {
+ return "Option 'IPv6 address' requires an IPv6 subnet length";
+ }
+ }
+
+ return true;
+ }
+ },
+ {
+ xtype: 'pvetextfield',
+ deleteEmpty: !me.create,
+ fieldLabel: gettext('Gateway'),
+ vtype: 'IP6Address',
+ name: 'gateway6'
}
]);
}
diff --git a/www/manager/node/NetworkView.js b/www/manager/node/NetworkView.js
index 4b1db77..177df85 100644
--- a/www/manager/node/NetworkView.js
+++ b/www/manager/node/NetworkView.js
@@ -277,6 +277,21 @@ Ext.define('PVE.node.NetworkView', {
header: gettext('Gateway'),
sortable: true,
dataIndex: 'gateway'
+ },
+ {
+ header: gettext('IPv6 address'),
+ sortable: true,
+ dataIndex: 'address6'
+ },
+ {
+ header: gettext('IPv6 subnet length'),
+ sortable: true,
+ dataIndex: 'netmask6'
+ },
+ {
+ header: gettext('IPv6 Gateway'),
+ sortable: true,
+ dataIndex: 'gateway6'
}
],
listeners: {
@@ -312,8 +327,9 @@ Ext.define('PVE.node.NetworkView', {
extend: 'Ext.data.Model',
fields: [
'iface', 'type', 'active', 'autostart',
- 'bridge_ports', 'slaves', 'address',
- 'netmask', 'gateway'
+ 'bridge_ports', 'slaves',
+ 'address', 'netmask', 'gateway',
+ 'address6', 'netmask6', 'gateway6',
],
idProperty: 'iface'
});
--
2.1.4
More information about the pve-devel
mailing list