From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Filip Schauer <f.schauer@proxmox.com>
Subject: Re: [pve-devel] [PATCH v3 manager 2/2] ui: lxc: add edit window for device passthrough
Date: Mon, 15 Apr 2024 14:12:57 +0200 [thread overview]
Message-ID: <650d700c-2fad-4a37-9010-e0cc53aca05d@proxmox.com> (raw)
In-Reply-To: <20240131150317.128465-3-f.schauer@proxmox.com>
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 <f.ebner@proxmox.com>
next prev parent reply other threads:[~2024-04-15 12:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 15:03 [pve-devel] [PATCH v3 manager 0/2] " Filip Schauer
2024-01-31 15:03 ` [pve-devel] [PATCH v3 manager 1/2] utils: clarify naming of LXC mount point utils Filip Schauer
2024-04-15 12:12 ` Fiona Ebner
2024-01-31 15:03 ` [pve-devel] [PATCH v3 manager 2/2] ui: lxc: add edit window for device passthrough Filip Schauer
2024-04-15 12:12 ` Fiona Ebner [this message]
2024-04-16 11:48 ` Filip Schauer
2024-04-16 12:10 ` [pve-devel] [PATCH v3 manager 0/2] " Filip Schauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=650d700c-2fad-4a37-9010-e0cc53aca05d@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=f.schauer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox