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

Alexandre Derumier aderumier at odiso.com
Wed Dec 12 13:32:41 CET 2012


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

diff --git a/www/manager/qemu/Config.js b/www/manager/qemu/Config.js
index c557687..585406d 100644
--- a/www/manager/qemu/Config.js
+++ b/www/manager/qemu/Config.js
@@ -173,19 +173,26 @@ Ext.define('PVE.qemu.Config', {
 
         me.statusStore.on('load', function(s, records, success) {
 	    var status;
+	    var template;
 	    if (!success) {
 		me.workspace.checkVmMigration(me.pveSelNode);
 		status = 'unknown';
 	    } else {
 		var rec = s.data.get('status');
 		status = rec ? rec.data.value : 'unknown';
+
+		var rec2 = s.data.get('template');
+		if(rec2.data.value){
+		    template = rec2.data.value;
+		}
+
 	    }
 
-	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running');
+	    startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template === 1);
 	    resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
 	    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