From 29223818a9dc2ccffd3226d5ae3e009de5f78d2c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 26 Jun 2013 13:39:28 +0200 Subject: [PATCH] add button to start spice console --- www/manager/qemu/Config.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js index efa4de5f..8424514d 100644 --- a/www/manager/qemu/Config.js +++ b/www/manager/qemu/Config.js @@ -118,13 +118,29 @@ Ext.define('PVE.qemu.Config', { } }); + var spiceBtn = Ext.create('Ext.Button', { + text: gettext('Spice'), + disabled: !caps.vms['VM.Console'], + handler: function() { + Ext.core.DomHelper.append(document.body, { + tag : 'iframe', + id : 'downloadIframe', + frameBorder : 0, + width : 0, + height : 0, + css : 'display:none;visibility:hidden;height:0px;', + src : '/api2/spiceconfig/nodes/' + nodename + '/qemu/' + vmid + '/spiceproxy' + }); + } + }); + var descr = vmid + " (" + (vmname ? "'" + vmname + "' " : "'VM " + vmid + "'") + ")"; Ext.apply(me, { title: Ext.String.format(gettext("Virtual Machine {0} on node {1}"), descr, "'" + nodename + "'"), hstateid: 'kvmtab', tbar: [ resumeBtn, startBtn, shutdownBtn, stopBtn, resetBtn, - removeBtn, migrateBtn, consoleBtn ], + removeBtn, migrateBtn, consoleBtn, spiceBtn], defaults: { statusStore: me.statusStore }, items: [ { @@ -190,6 +206,7 @@ Ext.define('PVE.qemu.Config', { var status; var qmpstatus; var template; + var spice; if (!success) { me.workspace.checkVmMigration(me.pveSelNode); @@ -203,6 +220,8 @@ Ext.define('PVE.qemu.Config', { if(rec.data.value){ template = rec.data.value; } + spice = s.data.get('spice') ? true : false; + } if (qmpstatus === 'prelaunch' || qmpstatus === 'paused') { @@ -212,7 +231,10 @@ Ext.define('PVE.qemu.Config', { startBtn.setVisible(true); resumeBtn.setVisible(false); } + + spiceBtn.setVisible(spice); + spiceBtn.setDisabled(!caps.vms['VM.Console'] || status !== 'running'); startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template); resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running' || template); shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');