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

Alexandre Derumier aderumier at odiso.com
Tue Dec 18 10:18:22 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