From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 612661FF164 for ; Wed, 23 Oct 2024 13:22:31 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8B1BB1C99A; Wed, 23 Oct 2024 13:23:02 +0200 (CEST) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Wed, 23 Oct 2024 13:22:41 +0200 Message-Id: <20241023112246.85637-2-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241023112246.85637-1-d.kral@proxmox.com> References: <20241023112246.85637-1-d.kral@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager v2 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Daniel Kral --- 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 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel