public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Leo Nunner <l.nunner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] gui: expose content-dirs property in storage edit/create
Date: Thu,  2 Feb 2023 12:32:40 +0100	[thread overview]
Message-ID: <20230202113240.81365-1-l.nunner@proxmox.com> (raw)

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>
---
RFC: something I noticed is that we actually return the parsed config
for "content-dirs" on GET /storage/{storage}. Should we maybe change
that so that it returns a property string instead, for consistency
reasons?

 www/manager6/storage/CIFSEdit.js |  8 +++
 www/manager6/storage/DirEdit.js  | 85 ++++++++++++++++++++++++++++++++
 www/manager6/storage/NFSEdit.js  |  8 +++
 3 files changed, 101 insertions(+)

diff --git a/www/manager6/storage/CIFSEdit.js b/www/manager6/storage/CIFSEdit.js
index 71415401..c909ccf2 100644
--- a/www/manager6/storage/CIFSEdit.js
+++ b/www/manager6/storage/CIFSEdit.js
@@ -218,6 +218,14 @@ Ext.define('PVE.storage.CIFSInputPanel', {
 	    },
 	];
 
+	me.extraTabs = [
+	    {
+		xtype: 'pveContentDirsTab',
+		title: gettext("Content Directories"),
+		onlineHelp: me.onlineHelp,
+	    },
+	];
+
 	me.callParent();
     },
 });
diff --git a/www/manager6/storage/DirEdit.js b/www/manager6/storage/DirEdit.js
index 7e9ec44d..3d036589 100644
--- a/www/manager6/storage/DirEdit.js
+++ b/www/manager6/storage/DirEdit.js
@@ -33,6 +33,91 @@ Ext.define('PVE.storage.DirInputPanel', {
 	    },
 	];
 
+	me.extraTabs = [
+	    {
+		xtype: 'pveContentDirsTab',
+		title: gettext("Content Directories"),
+		onlineHelp: me.onlineHelp,
+	    },
+	];
+
+	me.callParent();
+    },
+});
+
+Ext.define('PVE.panel.ContentDirsPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pveContentDirsTab',
+
+    onGetValues: function(form) {
+	let str = PVE.Parser.printPropertyString(form);
+	let values = { "content-dirs": str };
+	return values;
+    },
+
+    onSetValues: function(values) {
+	return values?.["content-dirs"];
+    },
+
+    initComponent: function() {
+	let me = this;
+
+	me.column1 = [
+	    {
+		xtype: 'textfield',
+		name: 'images',
+		fieldLabel: gettext('Disk image'),
+		allowBlank: true,
+		emptyText: "/images/",
+	    },
+	    {
+		xtype: 'textfield',
+		name: 'iso',
+		fieldLabel: gettext('ISO image'),
+		allowBlank: true,
+		emptyText: "/template/iso/",
+	    },
+	    {
+		xtype: 'textfield',
+		name: 'vztmpl',
+		fieldLabel: gettext('CT template'),
+		allowBlank: true,
+		emptyText: "/template/cache/",
+	    },
+	];
+
+	me.column2 = [
+	    {
+		xtype: 'textfield',
+		name: 'backup',
+		fieldLabel: gettext('Backup files'),
+		allowBlank: true,
+		emptyText: "/dump/",
+	    },
+	    {
+		xtype: 'textfield',
+		name: 'rootdir',
+		fieldLabel: gettext('Container'),
+		allowBlank: true,
+		emptyText: "/private/",
+	    },
+	    {
+		xtype: 'textfield',
+		name: 'snippets',
+		fieldLabel: gettext('Snippets'),
+		allowBlank: true,
+		emptyText: "/snippets/",
+	    },
+	];
+
+	me.columnB = [
+	    {
+		xtype: 'displayfield',
+		userCls: 'pmx-hint',
+		value: gettext('Paths are relative to the mountpoint of the storage'),
+	    },
+	];
+
 	me.callParent();
     },
 });
diff --git a/www/manager6/storage/NFSEdit.js b/www/manager6/storage/NFSEdit.js
index 202c7de0..606e1c02 100644
--- a/www/manager6/storage/NFSEdit.js
+++ b/www/manager6/storage/NFSEdit.js
@@ -160,6 +160,14 @@ Ext.define('PVE.storage.NFSInputPanel', {
 	    },
 	];
 
+	me.extraTabs = [
+	    {
+		xtype: 'pveContentDirsTab',
+		title: gettext("Content Directories"),
+		onlineHelp: me.onlineHelp,
+	    },
+	];
+
 	me.callParent();
     },
 });
-- 
2.30.2





             reply	other threads:[~2023-02-02 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 11:32 Leo Nunner [this message]
2023-06-07 13:32 Leo Nunner
2023-06-07 13:34 ` Leo Nunner

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=20230202113240.81365-1-l.nunner@proxmox.com \
    --to=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