public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Markus Frank <m.frank@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v1 3/3] ui: window: add diskformat option to the restore window
Date: Tue,  4 Feb 2025 17:13:40 +0100	[thread overview]
Message-ID: <20250204161340.351956-3-m.frank@proxmox.com> (raw)
In-Reply-To: <20250204161340.351956-1-m.frank@proxmox.com>

This is done by changing the StorageSelector to a DiskStorageSelector
and using the hideFormatWhenStorageEmpty option to hide the format
selector when no storage is selected, as the format selector would show
the default value qcow2 in a disabled state, which could confuse users.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 www/manager6/window/Restore.js | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js
index 6efe1313..393a6b28 100644
--- a/www/manager6/window/Restore.js
+++ b/www/manager6/window/Restore.js
@@ -44,8 +44,11 @@ Ext.define('PVE.window.Restore', {
 	    if (values['live-restore']) {
 		params['live-restore'] = 1;
 	    }
-	    if (values.storage) {
-		params.storage = values.storage;
+	    if (values.hdstorage) {
+		params.storage = values.hdstorage;
+	    }
+	    if (values.diskformat) {
+		params.diskformat = values.diskformat;
 	    }
 
 	    ['bwlimit', 'cores', 'name', 'memory', 'sockets'].forEach(opt => {
@@ -141,9 +144,10 @@ Ext.define('PVE.window.Restore', {
 			    view.lookupReference(`${key}Field`).setEmptyText(value);
 			}
 		    });
-
+		    let diskformat = view.down('pveDiskFormatSelector[name=diskformat]');
+		    diskformat.setVisible(false);
 		    if (!allStoragesAvailable) {
-			let storagesel = view.down('pveStorageSelector[name=storage]');
+			let storagesel = view.down('pveStorageSelector[name=hdstorage]');
 			storagesel.allowBlank = false;
 			storagesel.setEmptyText('');
 		    }
@@ -165,12 +169,14 @@ Ext.define('PVE.window.Restore', {
 	    throw "no vmtype specified";
 	}
 
-	let storagesel = Ext.create('PVE.form.StorageSelector', {
+	let storagesel = Ext.create('PVE.form.DiskStorageSelector', {
 	    nodename: me.nodename,
 	    name: 'storage',
 	    value: '',
 	    fieldLabel: gettext('Storage'),
 	    storageContent: me.vmtype === 'lxc' ? 'rootdir' : 'images',
+	    hideSize: true,
+	    hideFormatWhenStorageEmpty: true,
 	    // when restoring a container without specifying a storage, the backend defaults
 	    // to 'local', which is unintuitive and 'rootdir' might not even be allowed on it
 	    allowBlank: me.vmtype !== 'lxc',
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-02-04 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 16:13 [pve-devel] [PATCH qemu-server v1 1/3] fix #4888: qmrestore: add diskformat option Markus Frank
2025-02-04 16:13 ` [pve-devel] [PATCH manager v1 2/3] ui: form: add hideFormatWhenStorageEmpty option to DiskStorageSelector Markus Frank
2025-02-04 16:13 ` Markus Frank [this message]
2025-02-04 16:21 ` [pve-devel] [PATCH qemu-server v1 1/3] fix #4888: qmrestore: add diskformat option Fiona Ebner
2025-02-04 16:39   ` Fiona Ebner
2025-02-04 16:44     ` Markus Frank
2025-02-04 16:53       ` Fiona Ebner

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=20250204161340.351956-3-m.frank@proxmox.com \
    --to=m.frank@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