public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Leo Nunner <l.nunner@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 manager] gui: expose content-dirs property in storage edit/create
Date: Mon, 20 Mar 2023 20:25:07 +0100	[thread overview]
Message-ID: <78306086-18d5-aa58-4eb9-b126dd5865ee@proxmox.com> (raw)
In-Reply-To: <20230314131456.165418-3-l.nunner@proxmox.com>

Am 14/03/2023 um 14:14 schrieb Leo Nunner:
> Add a separate tab for the storage edit/create panels to set the
> recently introduced "content-dirs" property which overrides the
> default directory locations. Analogous to the API implementation,
> the tab was added for Directory, CIFS and NFS storages.
> 
> Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
> ---
>  www/manager6/storage/CIFSEdit.js |  8 +++
>  www/manager6/storage/DirEdit.js  | 85 ++++++++++++++++++++++++++++++++
>  www/manager6/storage/NFSEdit.js  |  8 +++
>  3 files changed, 101 insertions(+)
> 

> +Ext.define('PVE.panel.ContentDirsPanel', {
> +    extend: 'Proxmox.panel.InputPanel',

this shouldn't be squished into DirEdit, but rather live in its own file - e.g. in
panel/

> +    xtype: 'pveContentDirsTab',
> +
> +    onGetValues: function(form) {

while form isn't wrong, it has IMO merits to keep the more widely used
`values` as parameter name here.

> +	let str = PVE.Parser.printPropertyString(form);
> +	let values = { "content-dirs": str };
> +	return values;

could be as short as:

onGetValues: values => ({ "content-dirs", PVE.Parser.printPropertyString(values) }),

> +    },
> +
> +    onSetValues: function(values) {
> +	return values?.["content-dirs"];
> +    },

could be:

onSetValues: values => values?.["content-dirs"],

without loosing really any readability

> +
> +    initComponent: function() {
> +	let me = this;
> +
> +	me.column1 = [
> +	    {
> +		xtype: 'textfield',
> +		name: 'images',
> +		fieldLabel: gettext('Disk image'),

We normally use Title Case for field labels.

> +		allowBlank: true,
> +		emptyText: "images",

It would UX do good if you define a vtype (see Toolkit.js in manager or widget toolkit)
for the regex used by the backend to help users catching bogus entries early.

Above two (casing & vtype) applies for the remaining fields here.


Note also that having things like disks or the like editable for existing storages
can break things fast. I'd maybe be open for having snippets, ISOs and CT templates
editable, and even then show a warning hint that existing guest might be affected by
the change (i.e., not start anymore). FYI: pmxDisplayEditField is designed for such
mixed create/edit -> editable/display-only use-cases.





  reply	other threads:[~2023-03-20 19:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 13:14 [pve-devel] [PATCH v2 storage manager docs] Expose content-dirs through GUI + use relative paths Leo Nunner
2023-03-14 13:14 ` [pve-devel] [PATCH v2 storage] config: use relative paths for content overrides Leo Nunner
2023-03-20 14:26   ` [pve-devel] applied: " Thomas Lamprecht
2023-03-14 13:14 ` [pve-devel] [PATCH v2 manager] gui: expose content-dirs property in storage edit/create Leo Nunner
2023-03-20 19:25   ` Thomas Lamprecht [this message]
2023-03-14 13:14 ` [pve-devel] [PATCH v2 docs] config: remove reference to preceeding / from content-dirs Leo Nunner
2023-03-20 19:10   ` [pve-devel] applied: " Thomas Lamprecht

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=78306086-18d5-aa58-4eb9-b126dd5865ee@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=l.nunner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal