From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 44E50962E1 for ; Mon, 15 Apr 2024 14:13:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1CDF591C5 for ; Mon, 15 Apr 2024 14:12:59 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 15 Apr 2024 14:12:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5A6C1448ED for ; Mon, 15 Apr 2024 14:12:58 +0200 (CEST) Message-ID: <650d700c-2fad-4a37-9010-e0cc53aca05d@proxmox.com> Date: Mon, 15 Apr 2024 14:12:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Filip Schauer References: <20240131150317.128465-1-f.schauer@proxmox.com> <20240131150317.128465-3-f.schauer@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20240131150317.128465-3-f.schauer@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.071 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: Re: [pve-devel] [PATCH v3 manager 2/2] ui: lxc: add edit window for device passthrough 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: , X-List-Received-Date: Mon, 15 Apr 2024 12:13:29 -0000 Am 31.01.24 um 16:03 schrieb Filip Schauer: > diff --git a/www/manager6/lxc/DeviceEdit.js b/www/manager6/lxc/DeviceEdit.js > new file mode 100644 > index 00000000..445f8607 > --- /dev/null > +++ b/www/manager6/lxc/DeviceEdit.js > @@ -0,0 +1,190 @@ > +Ext.define('PVE.lxc.DeviceInputPanel', { > + extend: 'Proxmox.panel.InputPanel', > + > + autoComplete: false, > + > + controller: { > + xclass: 'Ext.app.ViewController', > + init: function(view) { > + let me = this; > + let vm = this.getViewModel(); > + vm.set('confid', view.confid); Nit: Is the confid in the viewModel (and therefore the whole view model) only used for the isCreate formula? That could also be directly passed in and bound via cbind instead. > + }, > + }, > + > + viewModel: { > + data: { > + confid: '', > + }, > + > + formulas: { > + isCreate: function(get) { > + return !get('confid'); > + }, > + }, > + }, > + > + setVMConfig: function(vmconfig) { > + let me = this; > + me.vmconfig = vmconfig; > + > + if (!me.confid) { Nit: Should this be guarded by isCreate instead? If for whatever reason setVMConfig() would be called a second time with a different config (not currently happenening AFAICT), I suppose it would make sense to pick the first free slot based on the new config again? > + PVE.Utils.forEachLxcDev((i) => { > + let name = "dev" + i.toString(); > + if (!Ext.isDefined(vmconfig[name])) { > + me.confid = name; > + me.down('field[name=devid]').setValue(i); > + return false; > + } > + return undefined; > + }); > + } > + }, > + (...) > + > + advancedColumn2: [ > + { > + xtype: 'textfield', > + name: 'mode', > + editable: true, > + fieldLabel: gettext('Access Mode'), > + emptyText: '0660', > + labelAlign: 'right', > + validator: function(value) { > + if (/^0[0-7]{3}$|^$/i.test(value)) { Should we require the leading zero here? Many users will be familiar with chown, where it is not required. > + return true; > + } > + > + return "Access mode has to be an octal number"; > + }, > + }, > + ], > +}); > + With that said: Reviewed-by: Fiona Ebner