]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
use new PVE.lxc.NetworkInputPanel inside CreateWizard
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 20 Apr 2015 16:06:07 +0000 (18:06 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 20 Apr 2015 16:06:07 +0000 (18:06 +0200)
www/manager/lxc/CreateWizard.js
www/manager/lxc/Network.js

index c3bf519841fbbbafaf5184253d83090efed9c83c..cbb05a67aa04861a064da736e5efb9b844040752 100644 (file)
@@ -43,12 +43,11 @@ Ext.define('PVE.lxc.CreateWizard', {
            }
        });
 
-       var bridgesel = Ext.create('PVE.form.BridgeSelector', {
-           name: 'bridge',
-           fieldLabel: gettext('Bridge'),
-           labelAlign: 'right',
-           autoSelect: true,
-           allowBlank: false
+       var networkpanel = Ext.create('PVE.lxc.NetworkInputPanel', {
+           title: gettext('Network'),
+           insideWizard: true,
+           dataCache: {},
+           create: true,
        });
 
        Ext.applyIf(me, {
@@ -68,7 +67,7 @@ Ext.define('PVE.lxc.CreateWizard', {
                                change: function(f, value) {
                                    tmplstoragesel.setNodename(value);
                                    tmplsel.setStorage(undefined, value);
-                                   bridgesel.setNodename(value);
+                                   networkpanel.setNodename(value);
                                    storagesel.setNodename(value);
                                }
                            }
@@ -143,31 +142,7 @@ Ext.define('PVE.lxc.CreateWizard', {
                    title: gettext('Template'),
                    column1: [ tmplstoragesel, tmplsel]
                },
-//             {
-//                 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 };
-                   }
-               },
+               networkpanel,
                {
                    title: gettext('Confirm'),
                    layout: 'fit',
index 31b9f5b7d88f843440dafd67f6f5e67cad9ca8a7..66548012301243742b343154d28a55341087fb1e 100644 (file)
@@ -4,6 +4,19 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
 
     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) {
        var me = this;
 
@@ -15,7 +28,12 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
            id = me.ifname;
        }
 
+       if (!id) {
+           return {};
+       }
+
        var newdata = {};
+       
        newdata[id] = PVE.Parser.printLxcNetwork(values);
        return newdata;
     },
@@ -26,13 +44,14 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
        if (!me.dataCache) {
            throw "no dataCache specified";
        }
-
-       if (!me.nodename) {
-           throw "no node name specified";
-       }
        
        var cdata = {};
 
+       if (me.insideWizard) {
+           me.ifname = 'net0';
+           cdata.name = 'eth0';
+       }
+       
        if (!me.create) {
            if (!me.ifname) {
                throw "no interface name specified";
@@ -58,6 +77,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
            xtype: 'combobox',
            fieldLabel: gettext('ID'),
            store: netliststore,
+           editable: false,
            name: 'id',
            value: me.ifname,
            disabled: !me.create,