Commit a3aa27b4 authored by Dietmar Maurer's avatar Dietmar Maurer

use new PVE.lxc.NetworkInputPanel inside CreateWizard

parent b542888d
...@@ -43,12 +43,11 @@ Ext.define('PVE.lxc.CreateWizard', { ...@@ -43,12 +43,11 @@ Ext.define('PVE.lxc.CreateWizard', {
} }
}); });
var bridgesel = Ext.create('PVE.form.BridgeSelector', { var networkpanel = Ext.create('PVE.lxc.NetworkInputPanel', {
name: 'bridge', title: gettext('Network'),
fieldLabel: gettext('Bridge'), insideWizard: true,
labelAlign: 'right', dataCache: {},
autoSelect: true, create: true,
allowBlank: false
}); });
Ext.applyIf(me, { Ext.applyIf(me, {
...@@ -68,7 +67,7 @@ Ext.define('PVE.lxc.CreateWizard', { ...@@ -68,7 +67,7 @@ Ext.define('PVE.lxc.CreateWizard', {
change: function(f, value) { change: function(f, value) {
tmplstoragesel.setNodename(value); tmplstoragesel.setNodename(value);
tmplsel.setStorage(undefined, value); tmplsel.setStorage(undefined, value);
bridgesel.setNodename(value); networkpanel.setNodename(value);
storagesel.setNodename(value); storagesel.setNodename(value);
} }
} }
...@@ -143,31 +142,7 @@ Ext.define('PVE.lxc.CreateWizard', { ...@@ -143,31 +142,7 @@ Ext.define('PVE.lxc.CreateWizard', {
title: gettext('Template'), title: gettext('Template'),
column1: [ tmplstoragesel, tmplsel] column1: [ tmplstoragesel, tmplsel]
}, },
// { networkpanel,
// xtype: 'pveLxcResourceInputPanel',
// title: gettext('Resources')
// },
{
xtype: 'inputpanel',
title: gettext('Network'),
column1: [
bridgesel,
{
xtype: 'pvecheckbox',
fieldLabel: gettext('Firewall'),
name: 'firewall',
checked: false,
disabled: true
}
],
onGetValues: function(values) {
var netif = PVE.Parser.printLxcNetwork({
link: values.bridge,
firewall: values.firewall
});
return { net0: netif };
}
},
{ {
title: gettext('Confirm'), title: gettext('Confirm'),
layout: 'fit', layout: 'fit',
......
...@@ -4,6 +4,19 @@ Ext.define('PVE.lxc.NetworkInputPanel', { ...@@ -4,6 +4,19 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
insideWizard: false, insideWizard: false,
setNodename: function(nodename) {
var me = this;
if (!nodename || (me.nodename === nodename)) {
return;
}
me.nodename = nodename;
var bridgesel = me.query("[isFormField][name=link]")[0];
bridgesel.setNodename(nodename);
},
onGetValues: function(values) { onGetValues: function(values) {
var me = this; var me = this;
...@@ -15,7 +28,12 @@ Ext.define('PVE.lxc.NetworkInputPanel', { ...@@ -15,7 +28,12 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
id = me.ifname; id = me.ifname;
} }
if (!id) {
return {};
}
var newdata = {}; var newdata = {};
newdata[id] = PVE.Parser.printLxcNetwork(values); newdata[id] = PVE.Parser.printLxcNetwork(values);
return newdata; return newdata;
}, },
...@@ -27,12 +45,13 @@ Ext.define('PVE.lxc.NetworkInputPanel', { ...@@ -27,12 +45,13 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
throw "no dataCache specified"; throw "no dataCache specified";
} }
if (!me.nodename) {
throw "no node name specified";
}
var cdata = {}; var cdata = {};
if (me.insideWizard) {
me.ifname = 'net0';
cdata.name = 'eth0';
}
if (!me.create) { if (!me.create) {
if (!me.ifname) { if (!me.ifname) {
throw "no interface name specified"; throw "no interface name specified";
...@@ -58,6 +77,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', { ...@@ -58,6 +77,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
xtype: 'combobox', xtype: 'combobox',
fieldLabel: gettext('ID'), fieldLabel: gettext('ID'),
store: netliststore, store: netliststore,
editable: false,
name: 'id', name: 'id',
value: me.ifname, value: me.ifname,
disabled: !me.create, disabled: !me.create,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment