[pve-devel] [PATCH manager v3 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals
Daniel Kral
d.kral at proxmox.com
Wed Oct 23 14:37:17 CEST 2024
Signed-off-by: Daniel Kral <d.kral at proxmox.com>
---
www/manager6/qemu/CDEdit.js | 35 +++++++++++++++++---------------
www/manager6/qemu/CIDriveEdit.js | 20 ++++++++++--------
2 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 3cc16205..fd8e5233 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -5,9 +5,10 @@ Ext.define('PVE.qemu.CDInputPanel', {
insideWizard: false,
onGetValues: function(values) {
- var me = this;
+ let me = this;
- var confid = me.confid || values.controller + values.deviceid;
+ let params = {};
+ let confid = me.confid || values.controller + values.deviceid;
me.drive.media = 'cdrom';
if (values.mediaType === 'iso') {
@@ -18,15 +19,13 @@ Ext.define('PVE.qemu.CDInputPanel', {
me.drive.file = 'none';
}
- var params = {};
-
params[confid] = PVE.Parser.printQemuDrive(me.drive);
return params;
},
setVMConfig: function(vmconfig) {
- var me = this;
+ let me = this;
if (me.bussel) {
me.bussel.setVMConfig(vmconfig, 'cdrom');
@@ -34,9 +33,10 @@ Ext.define('PVE.qemu.CDInputPanel', {
},
setDrive: function(drive) {
- var me = this;
+ let me = this;
+
+ let values = {};
- var values = {};
if (drive.file === 'cdrom') {
values.mediaType = 'cdrom';
} else if (drive.file === 'none') {
@@ -52,17 +52,17 @@ Ext.define('PVE.qemu.CDInputPanel', {
},
setNodename: function(nodename) {
- var me = this;
+ let me = this;
me.isosel.setNodename(nodename);
},
initComponent: function() {
- var me = this;
+ let me = this;
me.drive = {};
- var items = [];
+ let items = [];
if (!me.confid) {
me.bussel = Ext.create('PVE.form.ControllerSelector', {
@@ -82,7 +82,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
if (!me.rendered) {
return;
}
- var cdImageField = me.down('pveIsoSelector');
+ let cdImageField = me.down('pveIsoSelector');
cdImageField.setDisabled(!value);
if (value) {
cdImageField.validate();
@@ -128,16 +128,16 @@ Ext.define('PVE.qemu.CDEdit', {
width: 400,
initComponent: function() {
- var me = this;
+ let me = this;
- var nodename = me.pveSelNode.data.node;
+ let nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
me.isCreate = !me.confid;
- var ipanel = Ext.create('PVE.qemu.CDInputPanel', {
+ let ipanel = Ext.create('PVE.qemu.CDInputPanel', {
confid: me.confid,
nodename: nodename,
});
@@ -152,14 +152,17 @@ Ext.define('PVE.qemu.CDEdit', {
me.load({
success: function(response, options) {
ipanel.setVMConfig(response.result.data);
+
if (me.confid) {
- var value = response.result.data[me.confid];
- var drive = PVE.Parser.parseQemuDrive(me.confid, value);
+ let value = response.result.data[me.confid];
+ let drive = PVE.Parser.parseQemuDrive(me.confid, value);
+
if (!drive) {
Ext.Msg.alert('Error', 'Unable to parse drive options');
me.close();
return;
}
+
ipanel.setDrive(drive);
}
},
diff --git a/www/manager6/qemu/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
index a9ca8bf1..a8f57963 100644
--- a/www/manager6/qemu/CIDriveEdit.js
+++ b/www/manager6/qemu/CIDriveEdit.js
@@ -7,29 +7,33 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
vmconfig: {}, // used to select usused disks
onGetValues: function(values) {
- var me = this;
+ let me = this;
+
+ let drive = {};
+ let params = {};
- var drive = {};
- var params = {};
drive.file = values.hdstorage + ":cloudinit";
drive.format = values.diskformat;
params[values.controller + values.deviceid] = PVE.Parser.printQemuDrive(drive);
+
return params;
},
setNodename: function(nodename) {
- var me = this;
+ let me = this;
+
me.down('#hdstorage').setNodename(nodename);
me.down('#hdimage').setStorage(undefined, nodename);
},
setVMConfig: function(config) {
- var me = this;
+ let me = this;
+
me.down('#drive').setVMConfig(config, 'cdrom');
},
initComponent: function() {
- var me = this;
+ let me = this;
me.drive = {};
@@ -61,9 +65,9 @@ Ext.define('PVE.qemu.CIDriveEdit', {
subject: gettext('CloudInit Drive'),
initComponent: function() {
- var me = this;
+ let me = this;
- var nodename = me.pveSelNode.data.node;
+ let nodename = me.pveSelNode.data.node;
if (!nodename) {
throw "no node name specified";
}
--
2.39.5
More information about the pve-devel
mailing list