[pve-devel] [PATCH 05/11] config.js : disable start button if vm is a template on current (raw, qcow2)

Alexandre Derumier aderumier at odiso.com
Sun Feb 3 09:56:38 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/qemu/Config.js |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js
index 4beb027..b8bd00a 100644
--- a/www/manager/qemu/Config.js
+++ b/www/manager/qemu/Config.js
@@ -183,6 +183,7 @@ Ext.define('PVE.qemu.Config', {
         me.statusStore.on('load', function(s, records, success) {
 	    var status;
 	    var qmpstatus;
+	    var template;
 
 	    if (!success) {
 		me.workspace.checkVmMigration(me.pveSelNode);
@@ -192,6 +193,10 @@ Ext.define('PVE.qemu.Config', {
 		status = rec ? rec.data.value : 'unknown';
 		rec = s.data.get('qmpstatus');
 		qmpstatus = rec ? rec.data.value : 'unknown';
+		rec = s.data.get('template');
+		if(rec.data.value){
+		    template = rec.data.value;
+                }
 	    }
 
 	    if (qmpstatus === 'prelaunch' || qmpstatus === 'paused') {
@@ -202,8 +207,8 @@ Ext.define('PVE.qemu.Config', {
 		resumeBtn.setVisible(false)
 	    }
 
-	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running');
-	    resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || 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');
 	    stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
 	    removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
-- 
1.7.10.4




More information about the pve-devel mailing list