]>
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'),
167 vtype
: 'IP6CIDRAddress',
169 fieldLabel
: gettext('IPv6/CIDR'),
177 fieldLabel
: gettext('Gateway') + ' (' + gettext('IPv6') +')',
185 Ext
.define('PVE.qemu.IPConfigEdit', {
186 extend
: 'Proxmox.window.Edit',
190 initComponent: function() {
193 // convert confid from netX to ipconfigX
194 var match
= me
.confid
.match(/^net(\d+)$/);
196 me
.netid
= me
.confid
;
197 me
.confid
= 'ipconfig' + match
[1];
200 var nodename
= me
.pveSelNode
.data
.node
;
202 throw "no node name specified";
205 me
.isCreate
= me
.confid
? false : true;
207 var ipanel
= Ext
.create('PVE.qemu.IPConfigPanel', {
214 subject
: gettext('Network Config'),
221 success: function(response
, options
) {
222 me
.vmconfig
= response
.result
.data
;
224 var value
= me
.vmconfig
[me
.confid
];
226 ipconfig
= PVE
.Parser
.parseIPConfig(me
.confid
, value
);
228 Ext
.Msg
.alert(gettext('Error'), gettext('Unable to parse network configuration'));
233 ipanel
.setIPConfig(me
.confid
, ipconfig
);
234 ipanel
.setVMConfig(me
.vmconfig
);