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

Alexandre Derumier aderumier at odiso.com
Mon Jan 21 10:51:47 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..165dd88 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';
+		var rec2 = s.data.get('template');
+		if(rec2.data.value){
+		    template = rec2.data.value;
+                }
 	    }
 
 	    if (qmpstatus === 'prelaunch' || qmpstatus === 'paused') {
@@ -203,10 +208,10 @@ Ext.define('PVE.qemu.Config', {
 	    }
 
 	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running');
-	    resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
+	    resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running' || template === 1);
 	    shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
-	    removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
+	    removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped' || template);
 	});
 
 	me.on('afterrender', function() {
-- 
1.7.10.4




More information about the pve-devel mailing list