[pve-devel] r6291 - pve-manager/pve2/www/manager/qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Jul 11 06:57:41 CEST 2011


Author: dietmar
Date: 2011-07-11 06:57:41 +0200 (Mon, 11 Jul 2011)
New Revision: 6291

Modified:
   pve-manager/pve2/www/manager/qemu/HardwareView.js
   pve-manager/pve2/www/manager/qemu/Options.js
Log:
disable edit buttom when nothing selected


Modified: pve-manager/pve2/www/manager/qemu/HardwareView.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/HardwareView.js	2011-07-11 04:39:44 UTC (rev 6290)
+++ pve-manager/pve2/www/manager/qemu/HardwareView.js	2011-07-11 04:57:41 UTC (rev 6291)
@@ -1064,9 +1064,7 @@
 	    rows: rows,
 	    sorterFn: sorterFn,
 	    listeners: {
-		itemdblclick: function() {
-		    run_editor();
-		},
+		itemdblclick: run_editor,
 		selectionchange: set_button_status
 	    }
 	});

Modified: pve-manager/pve2/www/manager/qemu/Options.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/Options.js	2011-07-11 04:39:44 UTC (rev 6290)
+++ pve-manager/pve2/www/manager/qemu/Options.js	2011-07-11 04:57:41 UTC (rev 6291)
@@ -65,7 +65,6 @@
 	    }
 	};
 
-
 	var run_editor = function() {
 	    
 	    console.log("TEST EDIT");
@@ -73,20 +72,26 @@
 	    me.rstore.load();
 	};
 
+	var edit_btn = new Ext.Button({
+	    text: 'Edit',
+	    disabled: true,
+	    handler: run_editor
+	});
+
+	var set_button_status = function() {
+	    var sm = me.getSelectionModel();
+	    var rec = sm.getSelection()[0];
+	    edit_btn.setDisabled(!rec);
+	};
+
 	Ext.applyIf(me, {
 	    url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/config",
 	    cwidth1: 150,
-	    tbar: [ 
-		{
-		    text: "Edit",
-		    handler: run_editor
-		}
-	    ],
+	    tbar: [ edit_btn ],
 	    rows: rows,
 	    listeners: {
-		itemdblclick: function() {
-		    run_editor();
-		}
+		itemdblclick: run_editor,
+		selectionchange: set_button_status
 	    }
 	});
 




More information about the pve-devel mailing list