[pve-devel] [PATCH manager 3/3] code cleanup: convert var to let/const

Matthias Heiserer m.heiserer at proxmox.com
Fri Dec 2 14:50:18 CET 2022


Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
---
 www/manager6/panel/GuestStatusView.js    | 16 ++++++++--------
 www/manager6/panel/GuestSummary.js       | 16 ++++++++--------
 www/manager6/panel/TemplateStatusView.js |  6 +++---
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/www/manager6/panel/GuestStatusView.js b/www/manager6/panel/GuestStatusView.js
index d38b9631..f1002740 100644
--- a/www/manager6/panel/GuestStatusView.js
+++ b/www/manager6/panel/GuestStatusView.js
@@ -4,7 +4,7 @@ Ext.define('PVE.panel.GuestStatusView', {
     mixins: ['Proxmox.Mixin.CBind'],
 
     cbindData: function(initialConfig) {
-	var me = this;
+	const me = this;
 	return {
 	    isQemu: me.pveSelNode.data.type === 'qemu',
 	    isLxc: me.pveSelNode.data.type === 'lxc',
@@ -40,9 +40,9 @@ Ext.define('PVE.panel.GuestStatusView', {
 	    printBar: false,
 	    multiField: true,
 	    renderer: function(record) {
-		var me = this;
-		var text = record.data.status;
-		var qmpstatus = record.data.qmpstatus;
+		const me = this;
+		let text = record.data.status;
+		const qmpstatus = record.data.qmpstatus;
 		if (qmpstatus && qmpstatus !== record.data.status) {
 		    text += ' (' + qmpstatus + ')';
 		}
@@ -126,7 +126,7 @@ Ext.define('PVE.panel.GuestStatusView', {
 	    maxField: 'maxdisk',
 	    printBar: false,
 	    renderer: function(used, max) {
-		var me = this;
+		const me = this;
 		me.setPrintBar(used > 0);
 		if (used === 0) {
 		    return Proxmox.Utils.render_size(max);
@@ -152,10 +152,10 @@ Ext.define('PVE.panel.GuestStatusView', {
     ],
 
     updateTitle: function() {
-	var me = this;
-	var uptime = me.getRecordValue('uptime');
+	const me = this;
+	const uptime = me.getRecordValue('uptime');
 
-	var text = "";
+	let text = "";
 	if (Number(uptime) > 0) {
 	    text = " (" + gettext('Uptime') + ': ' + Proxmox.Utils.format_duration_long(uptime)
 		+ ')';
diff --git a/www/manager6/panel/GuestSummary.js b/www/manager6/panel/GuestSummary.js
index d6655393..694cf324 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -6,14 +6,14 @@ Ext.define('PVE.guest.Summary', {
     bodyPadding: 5,
 
     initComponent: function() {
-        var me = this;
+        const me = this;
 
-	var nodename = me.pveSelNode.data.node;
+	const nodename = me.pveSelNode.data.node;
 	if (!nodename) {
 	    throw "no node name specified";
 	}
 
-	var vmid = me.pveSelNode.data.vmid;
+	const vmid = me.pveSelNode.data.vmid;
 	if (!vmid) {
 	    throw "no VM ID specified";
 	}
@@ -26,9 +26,9 @@ Ext.define('PVE.guest.Summary', {
 	    throw "no status storage specified";
 	}
 
-	var type = me.pveSelNode.data.type;
-	var template = !!me.pveSelNode.data.template;
-	var rstore = me.statusStore;
+	const type = me.pveSelNode.data.type;
+	const template = !!me.pveSelNode.data.template;
+	const rstore = me.statusStore;
 
 	const applyLogos = function(controller) {
 	    const updateView = (response) => {
@@ -51,7 +51,7 @@ Ext.define('PVE.guest.Summary', {
 	    });
 	};
 
-	var items = [
+	let items = [
 	    {
 		xtype: template ? 'pveTemplateStatusView' : 'pveGuestStatusView',
 		flex: 1,
@@ -70,7 +70,7 @@ Ext.define('PVE.guest.Summary', {
 	    },
 	];
 
-	var rrdstore;
+	let rrdstore;
 	if (!template) {
 	    // in non-template mode put the two panels always together
 	    items = [
diff --git a/www/manager6/panel/TemplateStatusView.js b/www/manager6/panel/TemplateStatusView.js
index 5543f4fe..bacc5410 100644
--- a/www/manager6/panel/TemplateStatusView.js
+++ b/www/manager6/panel/TemplateStatusView.js
@@ -4,7 +4,7 @@ Ext.define('PVE.panel.TemplateStatusView', {
     mixins: ['Proxmox.Mixin.CBind'],
 
     cbindData: function(initialConfig) {
-	var me = this;
+	const me = this;
 	return {
 	    isQemu: me.pveSelNode.data.type === 'qemu',
 	};
@@ -103,9 +103,9 @@ Ext.define('PVE.panel.TemplateStatusView', {
     ],
 
     initComponent: function() {
-	var me = this;
+	const me = this;
 
-	var name = me.pveSelNode.data.name;
+	const name = me.pveSelNode.data.name;
 	if (!name) {
 	    throw "no name specified";
 	}
-- 
2.30.2






More information about the pve-devel mailing list