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

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


same as for containers

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

diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index e0e2e128..83af957e 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -202,11 +202,24 @@ Ext.define('PVE.qemu.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: {
@@ -238,12 +251,42 @@ Ext.define('PVE.qemu.CreateWizard', {
 		var nodename = kv.nodename;
 		delete kv.nodename;
 
+		var openconsole = kv.openconsole;
+		delete kv.openconsole;
+
+		var vmid = kv.vmid;
+
 		Proxmox.Utils.API2Request({
 		    url: '/nodes/' + nodename + '/qemu',
 		    waitMsgTarget: wizard,
 		    method: 'POST',
 		    params: kv,
 		    success: function(response){
+			var upid = response.result.data;
+
+			var win = Ext.create('Proxmox.window.TaskProgress', {
+			    taskDone: function() {
+				if (openconsole) {
+				    Proxmox.Utils.API2Request({
+					url: '/nodes/' + nodename + '/qemu/' + vmid + '/status/current',
+					failure: function(response, opts) {
+					    Ext.Msg.alert('Error', response.htmlStatus);
+					},
+					success: function(response, opts) {
+					    var allowSpice = response.result.data.spice;
+					    var allowXtermjs = response.result.data.serial;
+					    var consoles = {
+						spice: allowSpice,
+						xtermjs: allowXtermjs
+					    };
+					    PVE.Utils.openDefaultConsoleWindow(consoles, 'kvm', vmid, nodename, kv.name);
+					}
+				    });
+				}
+			    },
+			    upid: upid
+			});
+			win.show();
 			wizard.close();
 		    },
 		    failure: function(response, opts) {
-- 
2.11.0





More information about the pve-devel mailing list