[pve-devel] [PATCH manager 1/6] Fix usage of 'me'

Dominic Jäger d.jaeger at proxmox.com
Tue May 18 14:12:13 CEST 2021


Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
 www/manager6/lxc/MPEdit.js       |  6 ++---
 www/manager6/qemu/AgentIPView.js |  4 +--
 www/manager6/qemu/CloudInit.js   | 44 ++++++++++++++++----------------
 www/manager6/qemu/DisplayEdit.js |  4 +--
 www/manager6/qemu/SSHKey.js      |  4 +--
 www/manager6/qemu/SerialEdit.js  |  4 +--
 www/manager6/storage/Base.js     |  8 +++---
 7 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/www/manager6/lxc/MPEdit.js b/www/manager6/lxc/MPEdit.js
index d9a160a0..2a30cd27 100644
--- a/www/manager6/lxc/MPEdit.js
+++ b/www/manager6/lxc/MPEdit.js
@@ -189,11 +189,11 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
 		disabled: '{hasMP}',
 	    },
 	    validator: function(value) {
-		var me = this.up('inputpanel');
-		if (!me.rendered) {
+		let view = this.up('inputpanel');
+		if (!view.rendered) {
 		    return;
 		}
-		if (Ext.isDefined(me.vmconfig["mp"+value])) {
+		if (Ext.isDefined(view.vmconfig["mp"+value])) {
 		    return "Mount point is already in use.";
 		}
 		/* returns a string above */
diff --git a/www/manager6/qemu/AgentIPView.js b/www/manager6/qemu/AgentIPView.js
index fd75437f..6518dfd6 100644
--- a/www/manager6/qemu/AgentIPView.js
+++ b/www/manager6/qemu/AgentIPView.js
@@ -87,10 +87,10 @@ Ext.define('PVE.qemu.AgentIPView', {
 		    hidden: true,
 		    ui: 'default-toolbar',
 		    handler: function(btn) {
-			var me = this.up('pveAgentIPView');
+			let view = this.up('pveAgentIPView');
 
 			var win = Ext.create('PVE.window.IPInfo');
-			win.down('grid').getStore().setData(me.nics);
+			win.down('grid').getStore().setData(view.nics);
 			win.show();
 		    },
 		    text: gettext('More'),
diff --git a/www/manager6/qemu/CloudInit.js b/www/manager6/qemu/CloudInit.js
index 43405a67..8465b402 100644
--- a/www/manager6/qemu/CloudInit.js
+++ b/www/manager6/qemu/CloudInit.js
@@ -10,19 +10,19 @@ Ext.define('PVE.qemu.CloudInit', {
 	    disabled: true,
 	    dangerous: true,
 	    confirmMsg: function(rec) {
-		var me = this.up('grid');
+		let view = this.up('grid');
 		var warn = gettext('Are you sure you want to remove entry {0}');
 
 		var entry = rec.data.key;
 		var msg = Ext.String.format(warn, "'"
-		    + me.renderKey(entry, {}, rec) + "'");
+		    + view.renderKey(entry, {}, rec) + "'");
 
 		return msg;
 	    },
 	    enableFn: function(record) {
-		var me = this.up('grid');
+		let view = this.up('grid');
 		var caps = Ext.state.Manager.get('GuiCap');
-		if (me.rows[record.data.key].never_delete ||
+		if (view.rows[record.data.key].never_delete ||
 		    !caps.vms['VM.Config.Network']) {
 		    return false;
 		}
@@ -33,8 +33,8 @@ Ext.define('PVE.qemu.CloudInit', {
 		return true;
 	    },
 	    handler: function() {
-		var me = this.up('grid');
-		var records = me.getSelection();
+		let view = this.up('grid');
+		let records = view.getSelection();
 		if (!records || !records.length) {
 		    return;
 		}
@@ -48,15 +48,15 @@ Ext.define('PVE.qemu.CloudInit', {
 		var params = {};
 		params.delete = id;
 		Proxmox.Utils.API2Request({
-		    url: me.baseurl + '/config',
-		    waitMsgTarget: me,
+		    url: view.baseurl + '/config',
+		    waitMsgTarget: view,
 		    method: 'PUT',
 		    params: params,
 		    failure: function(response, opts) {
 			Ext.Msg.alert('Error', response.htmlStatus);
 		    },
 		    callback: function() {
-			me.reload();
+			view.reload();
 		    },
 		});
 	    },
@@ -66,12 +66,12 @@ Ext.define('PVE.qemu.CloudInit', {
 	    xtype: 'proxmoxButton',
 	    disabled: true,
 	    enableFn: function(rec) {
-		let me = this.up('pveCiPanel');
-		return !!me.rows[rec.data.key].editor;
+		let view = this.up('pveCiPanel');
+		return !!view.rows[rec.data.key].editor;
 	    },
 	    handler: function() {
-		var me = this.up('grid');
-		me.run_editor();
+		let view = this.up('grid');
+		view.run_editor();
 	    },
 	    text: gettext('Edit'),
 	},
@@ -81,37 +81,37 @@ Ext.define('PVE.qemu.CloudInit', {
 	    itemId: 'savebtn',
 	    text: gettext('Regenerate Image'),
 	    handler: function() {
-		var me = this.up('grid');
+		let view = this.up('grid');
 		var eject_params = {};
 		var insert_params = {};
-		var disk = PVE.Parser.parseQemuDrive(me.ciDriveId, me.ciDrive);
+		let disk = PVE.Parser.parseQemuDrive(view.ciDriveId, view.ciDrive);
 		var storage = '';
 		var stormatch = disk.file.match(/^([^\:]+)\:/);
 		if (stormatch) {
 		    storage = stormatch[1];
 		}
-		eject_params[me.ciDriveId] = 'none,media=cdrom';
-		insert_params[me.ciDriveId] = storage + ':cloudinit';
+		eject_params[view.ciDriveId] = 'none,media=cdrom';
+		insert_params[view.ciDriveId] = storage + ':cloudinit';
 
 		var failure = function(response, opts) {
 		    Ext.Msg.alert('Error', response.htmlStatus);
 		};
 
 		Proxmox.Utils.API2Request({
-		    url: me.baseurl + '/config',
-		    waitMsgTarget: me,
+		    url: view.baseurl + '/config',
+		    waitMsgTarget: view,
 		    method: 'PUT',
 		    params: eject_params,
 		    failure: failure,
 		    callback: function() {
 			Proxmox.Utils.API2Request({
-			    url: me.baseurl + '/config',
-			    waitMsgTarget: me,
+			    url: view.baseurl + '/config',
+			    waitMsgTarget: view,
 			    method: 'PUT',
 			    params: insert_params,
 			    failure: failure,
 			    callback: function() {
-				me.reload();
+				view.reload();
 			    },
 			});
 		    },
diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index 9f1c4fdd..82e6777e 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -34,7 +34,7 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 	},
 	listeners: {
 	    change: function(cb, val) {
-		var me = this.up('panel');
+		let view = this.up('panel');
 		if (!val) {
 		    return;
 		}
@@ -70,7 +70,7 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 		    default:
 			break;
 		}
-		var memoryfield = me.down('field[name=memory]');
+		let memoryfield = view.down('field[name=memory]');
 		memoryfield.setEmptyText(emptyText);
 		memoryfield.setDisabled(disable);
 	    },
diff --git a/www/manager6/qemu/SSHKey.js b/www/manager6/qemu/SSHKey.js
index ec030777..f38e5fab 100644
--- a/www/manager6/qemu/SSHKey.js
+++ b/www/manager6/qemu/SSHKey.js
@@ -34,11 +34,11 @@ Ext.define('PVE.qemu.SSHKeyInputPanel', {
 	    fieldLabel: 'test',
 	    listeners: {
 		change: function(btn, e, value) {
-		    var me = this.up('inputpanel');
+		    let view = this.up('inputpanel');
 		    e = e.event;
 		    Ext.Array.each(e.target.files, function(file) {
 			PVE.Utils.loadSSHKeyFromFile(file, function(res) {
-			    var keysField = me.down('#sshkeys');
+			    let keysField = view.down('#sshkeys');
 			    var old = keysField.getValue();
 			    keysField.setValue(old + res);
 			});
diff --git a/www/manager6/qemu/SerialEdit.js b/www/manager6/qemu/SerialEdit.js
index 21a7a839..6ce18ec2 100644
--- a/www/manager6/qemu/SerialEdit.js
+++ b/www/manager6/qemu/SerialEdit.js
@@ -37,8 +37,8 @@ Ext.define('PVE.qemu.SerialnputPanel', {
 		if (!this.rendered) {
 		    return true;
 		}
-		var me = this.up('panel');
-		if (me.vmconfig !== undefined && Ext.isDefined(me.vmconfig['serial' + id])) {
+		let view = this.up('panel');
+		if (view.vmconfig !== undefined && Ext.isDefined(view.vmconfig['serial' + id])) {
 			return "This device is already in use.";
 		}
 		return true;
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 186ddc9c..4336d634 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -89,15 +89,15 @@ Ext.define('PVE.panel.StoragePruneInputPanel', {
     },
 
     updateComponents: function() {
-	let panel = this;
+	let me = this;
 
-	let keepAll = panel.down('proxmoxcheckbox[name=keep-all]').getValue();
+	let keepAll = me.down('proxmoxcheckbox[name=keep-all]').getValue();
 	let anyValue = false;
-	panel.query('pmxPruneKeepField').forEach(field => {
+	me.query('pmxPruneKeepField').forEach(field => {
 	    anyValue = anyValue || field.getValue() !== null;
 	    field.setDisabled(keepAll);
 	});
-	panel.down('component[name=no-keeps-hint]').setHidden(anyValue || keepAll);
+	me.down('component[name=no-keeps-hint]').setHidden(anyValue || keepAll);
     },
 
     listeners: {
-- 
2.20.1






More information about the pve-devel mailing list