iface_vtype = 'BondName';
} else if (me.iftype === 'eth' && !me.isCreate) {
iface_vtype = 'InterfaceName';
- } else if (me.iftype === 'vlan' && !me.isCreate) {
- iface_vtype = 'InterfaceName';
+ } else if (me.iftype === 'vlan') {
+ iface_vtype = 'VlanName';
} else if (me.iftype === 'OVSBridge') {
iface_vtype = 'BridgeName';
} else if (me.iftype === 'OVSBond') {
fieldLabel: gettext('OVS options'),
name: 'ovs_options'
});
+ } else if (me.iftype === 'vlan') {
+
+ if(!me.isCreate) {
+
+ me.disablevlanid = false;
+ me.disablevlanrawdevice = false;
+ me.vlanrawdevicevalue = '';
+ me.vlanidvalue = '';
+
+ if (Proxmox.Utils.VlanInterface_match.test(me.iface)) {
+ me.disablevlanid = true;
+ me.disablevlanrawdevice = true;
+ var arr = Proxmox.Utils.VlanInterface_match.exec(me.iface);
+ me.vlanrawdevicevalue = arr[1];
+ me.vlanidvalue = arr[2];
+
+ } else if (Proxmox.Utils.Vlan_match.test(me.iface)) {
+ me.disablevlanid = true;
+ var arr = Proxmox.Utils.Vlan_match.exec(me.iface);
+ me.vlanidvalue = arr[1];
+ }
+ } else {
+
+ me.disablevlanid = true;
+ me.disablevlanrawdevice = true;
+ }
+
+ column2.push({
+ xtype: 'textfield',
+ fieldLabel: gettext('Vlan raw device'),
+ name: 'vlan-raw-device',
+ value: me.vlanrawdevicevalue,
+ disabled: me.disablevlanrawdevice
+ });
+
+ column2.push({
+ xtype: 'pveVlanField',
+ name: 'vlan-id',
+ value: me.vlanidvalue,
+ disabled: me.disablevlanid
+
+ });
+
} else if (me.iftype === 'bond') {
column2.push({
xtype: 'textfield',
name: 'iface',
value: me.iface,
vtype: iface_vtype,
- allowBlank: false
+ allowBlank: false,
+ listeners: {
+ change: function(f, value) {
+ if (me.isCreate && iface_vtype === 'VlanName') {
+ var vlanidField = me.down('field[name=vlan-id]');
+ var vlanrawdeviceField = me.down('field[name=vlan-raw-device]');
+ if (Proxmox.Utils.VlanInterface_match.test(value)) {
+ vlanidField.setDisabled(true);
+ vlanrawdeviceField.setDisabled(true);
+ } else if (Proxmox.Utils.Vlan_match.test(value)) {
+ vlanidField.setDisabled(true);
+ vlanrawdeviceField.setDisabled(false);
+ } else {
+ vlanidField.setDisabled(false);
+ vlanrawdeviceField.setDisabled(false);
+ }
+ }
+ }
+ }
}
];
// defines what types of network devices we want to create
// order is always the same
- types: ['bridge', 'bond', 'ovs'],
+ types: ['bridge', 'bond', 'vlan', 'ovs'],
showApplyBtn: false,
});
}
+ if (me.types.indexOf('vlan') !== -1) {
+ menu_items.push({
+ text: Proxmox.Utils.render_network_iface_type('vlan'),
+ handler: function() {
+ var win = Ext.create('Proxmox.node.NetworkEdit', {
+ nodename: me.nodename,
+ iftype: 'vlan',
+ iface_default: 'interfaceX.1'
+ });
+ win.on('destroy', reload);
+ win.show();
+ }
+ });
+ }
+
if (me.types.indexOf('ovs') !== -1) {
if (menu_items.length > 0) {
menu_items.push({ xtype: 'menuseparator' });