[pve-devel] [PATCH manager 1/2] add 'open console after create' checkbox for lxc

Dominik Csapak d.csapak at proxmox.com
Mon Jul 30 15:06:07 CEST 2018


a typical use case for creating a vm is to finish the wizard,
start the vm, and open the console to install the os

we already have the 'start after create' in the backend,
so implement the 'open console after create' in the frontend

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/lxc/CreateWizard.js | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/www/manager6/lxc/CreateWizard.js b/www/manager6/lxc/CreateWizard.js
index ea86c6aa..42f6c4ec 100644
--- a/www/manager6/lxc/CreateWizard.js
+++ b/www/manager6/lxc/CreateWizard.js
@@ -253,11 +253,24 @@ Ext.define('PVE.lxc.CreateWizard', {
 	    ],
 	    dockedItems: [
 		{
-		    xtype: 'proxmoxcheckbox',
-		    name: 'start',
+		    xtype: 'container',
+		    layout: 'hbox',
 		    dock: 'bottom',
 		    margin: '5 0 0 0',
-		    boxLabel: gettext('Start after created')
+		    items: [
+			{
+			    xtype: 'proxmoxcheckbox',
+			    name: 'start',
+			    flex: 1,
+			    boxLabel: gettext('Start after created')
+			},
+			{
+			    xtype: 'proxmoxcheckbox',
+			    name: 'openconsole',
+			    flex: 1,
+			    boxLabel: gettext('Open Console after created')
+			}
+		    ]
 		}
 	    ],
 	    listeners: {
@@ -302,6 +315,9 @@ Ext.define('PVE.lxc.CreateWizard', {
 		    delete kv.password;
 		}
 
+		var openconsole = kv.openconsole;
+		delete kv.openconsole;
+
 		Proxmox.Utils.API2Request({
 		    url: '/nodes/' + nodename + '/lxc',
 		    waitMsgTarget: wizard,
@@ -311,6 +327,11 @@ Ext.define('PVE.lxc.CreateWizard', {
 			var upid = response.result.data;
 
 			var win = Ext.create('Proxmox.window.TaskViewer', {
+			    taskDone: function() {
+				if (openconsole) {
+				    PVE.Utils.openDefaultConsoleWindow(true, 'lxc', kv.vmid, nodename, kv.hostname);
+				}
+			    },
 			    upid: upid
 			});
 			win.show();
-- 
2.11.0





More information about the pve-devel mailing list