[pve-devel] [PATCH manager 1/3] ui/qemu: cleanup pveSelNode to variable

Stefan Reiter s.reiter at proxmox.com
Wed Dec 18 13:19:48 CET 2019


'vm' has been in use further down anyway, let's move it up.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 www/manager6/qemu/Config.js | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index 439dd0b3..58a1568c 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -6,20 +6,21 @@ Ext.define('PVE.qemu.Config', {
 
     initComponent: function() {
         var me = this;
+	var vm = me.pveSelNode.data;
 
-	var nodename = me.pveSelNode.data.node;
+	var nodename = vm.node;
 	if (!nodename) {
 	    throw "no node name specified";
 	}
 
-	var vmid = me.pveSelNode.data.vmid;
+	var vmid = vm.vmid;
 	if (!vmid) {
 	    throw "no VM ID specified";
 	}
 
-	var template = !!me.pveSelNode.data.template;
+	var template = !!vm.template;
 
-	var running = !!me.pveSelNode.data.uptime;
+	var running = !!vm.uptime;
 
 	var caps = Ext.state.Manager.get('GuiCap');
 
@@ -111,7 +112,7 @@ Ext.define('PVE.qemu.Config', {
 		    hidden: !caps.nodes['Sys.Console'],
 		    text: gettext('Manage HA'),
 		    handler: function() {
-			var ha = me.pveSelNode.data.hastate;
+			var ha = vm.hastate;
 			Ext.create('PVE.ha.VMResourceEdit', {
 			    vmid: vmid,
 			    isCreate: (!ha || ha === 'unmanaged')
@@ -192,8 +193,6 @@ Ext.define('PVE.qemu.Config', {
 	    iconCls: 'fa fa-power-off'
 	});
 
-	var vm = me.pveSelNode.data;
-
 	var consoleBtn = Ext.create('PVE.button.ConsoleButton', {
 	    disabled: !caps.vms['VM.Console'],
 	    hidden: template,
-- 
2.20.1





More information about the pve-devel mailing list