]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/qemu/IPConfigEdit.js
1 Ext
.define('PVE.qemu.IPConfigPanel', {
2 extend
: 'Proxmox.panel.InputPanel',
3 xtype
: 'pveIPConfigPanel',
9 onGetValues: function(values
) {
12 if (values
.ipv4mode
!== 'static') {
13 values
.ip
= values
.ipv4mode
;
16 if (values
.ipv6mode
!== 'static') {
17 values
.ip6
= values
.ipv6mode
;
22 var cfg
= PVE
.Parser
.printIPConfig(values
);
24 params
.delete = [me
.confid
];
26 params
[me
.confid
] = cfg
;
31 setVMConfig: function(config
) {
36 setIPConfig: function(confid
, data
) {
41 if (data
.ip
=== 'dhcp') {
42 data
.ipv4mode
= data
.ip
;
45 data
.ipv4mode
= 'static';
47 if (data
.ip6
=== 'dhcp' || data
.ip6
=== 'auto') {
48 data
.ipv6mode
= data
.ip6
;
51 data
.ipv6mode
= 'static';
55 me
.setValues(me
.ipconfig
);
58 initComponent: function() {
65 xtype
: 'displayfield',
66 fieldLabel
: gettext('Network Device'),
79 text
: gettext('IPv4') + ':',
83 boxLabel
: gettext('Static'),
89 change: function(cb
, value
) {
90 me
.down('field[name=ip]').setDisabled(!value
);
91 me
.down('field[name=gw]').setDisabled(!value
);
97 boxLabel
: gettext('DHCP'),
108 vtype
: 'IPCIDRAddress',
111 fieldLabel
: gettext('IPv4/CIDR'),
119 fieldLabel
: gettext('Gateway') + ' (' + gettext('IPv4') +')',
125 xtype
: 'displayfield',
137 text
: gettext('IPv6') + ':',
141 boxLabel
: gettext('Static'),
143 inputValue
: 'static',
147 change: function(cb
, value
) {
148 me
.down('field[name=ip6]').setDisabled(!value
);
149 me
.down('field[name=gw6]').setDisabled(!value
);
155 boxLabel
: gettext('DHCP'),
163 boxLabel
: gettext('SLAAC'),
175 vtype
: 'IP6CIDRAddress',
177 fieldLabel
: gettext('IPv6/CIDR'),
185 fieldLabel
: gettext('Gateway') + ' (' + gettext('IPv6') +')',
193 Ext
.define('PVE.qemu.IPConfigEdit', {
194 extend
: 'Proxmox.window.Edit',
198 initComponent: function() {
201 // convert confid from netX to ipconfigX
202 var match
= me
.confid
.match(/^net(\d+)$/);
204 me
.netid
= me
.confid
;
205 me
.confid
= 'ipconfig' + match
[1];
208 var nodename
= me
.pveSelNode
.data
.node
;
210 throw "no node name specified";
213 me
.isCreate
= !me
.confid
;
215 var ipanel
= Ext
.create('PVE.qemu.IPConfigPanel', {
222 subject
: gettext('Network Config'),
229 success: function(response
, options
) {
230 me
.vmconfig
= response
.result
.data
;
232 var value
= me
.vmconfig
[me
.confid
];
234 ipconfig
= PVE
.Parser
.parseIPConfig(me
.confid
, value
);
236 Ext
.Msg
.alert(gettext('Error'), gettext('Unable to parse network configuration'));
241 ipanel
.setIPConfig(me
.confid
, ipconfig
);
242 ipanel
.setVMConfig(me
.vmconfig
);