From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager v3] ui: storage: add is_mountpoint checkbox to dir/btrfs storage edit
Date: Tue, 25 Mar 2025 16:20:58 +0100 [thread overview]
Message-ID: <20250325152058.100499-1-h.laimer@proxmox.com> (raw)
This came up in support, and there is no reason to not have it in
the UI, while having it in the API.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
v2:
- use Aaron's improved help text
v3, thanks @Fabian and @Fiona:
- handle if a path is set correctly
- move to BaseStorage, so we don't have the same code in two places
www/manager6/storage/Base.js | 44 ++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index c8c735f3..813f961b 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -4,6 +4,13 @@ Ext.define('PVE.panel.StorageBase', {
type: '',
+ viewModel: {
+ data: {
+ isMpReadOnly: false,
+ isMpChecked: false,
+ },
+ },
+
onGetValues: function(values) {
let me = this;
@@ -19,6 +26,16 @@ Ext.define('PVE.panel.StorageBase', {
return values;
},
+ setValues: function(values) {
+ let isMp = values.is_mountpoint;
+ let isMpSet = !!isMp && isMp !== '0';
+ let isMpIsPath = isMpSet && isMp !== '1';
+ this.viewModel.set('isMpReadOnly', isMpIsPath);
+ this.viewModel.set('isMpChecked', isMpSet);
+
+ this.callParent([values]);
+ },
+
initComponent: function() {
let me = this;
@@ -73,6 +90,33 @@ Ext.define('PVE.panel.StorageBase', {
}
}
+ const hasIsMountpointStorageTypes = ['dir', 'btrfs'];
+
+ if (hasIsMountpointStorageTypes.includes(me.type)) {
+ const isMountpointBox = {
+ xtype: 'proxmoxcheckbox',
+ name: 'is_mountpoint',
+ uncheckedValue: 0,
+ fieldLabel: gettext('Mountpoint'),
+ bind: {
+ disabled: '{isMpReadOnly}',
+ value: '{isMpChecked}',
+ },
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Enable if something is mounted at this path. Storage is considered offline as long as nothing is mounted.'),
+ },
+ };
+
+ me.advancedColumn1 = me.advancedColumn1 || [];
+ me.advancedColumn2 = me.advancedColumn2 || [];
+ if (me.advancedColumn2.length < me.advancedColumn1.length) {
+ me.advancedColumn2.unshift(isMountpointBox);
+ } else {
+ me.advancedColumn1.unshift(isMountpointBox);
+ }
+ }
+
me.callParent();
},
});
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2025-03-25 15:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250325152058.100499-1-h.laimer@proxmox.com \
--to=h.laimer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.