From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v7 2/3] ui: vm create wizard: allow importing disks
Date: Tue, 8 Apr 2025 14:13:11 +0200 [thread overview]
Message-ID: <20250408121312.312526-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250408121312.312526-1-d.csapak@proxmox.com>
by adding a new 'import' button in the disk tab, which adds the same
input panel as the one we have when doing an 'Import Hard Disk' for an
existing VM.
partially fixes #2424
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/manager6/panel/MultiDiskEdit.js | 36 +++++++++++++++++++++++++----
www/manager6/qemu/MultiHDEdit.js | 5 +++-
2 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/www/manager6/panel/MultiDiskEdit.js b/www/manager6/panel/MultiDiskEdit.js
index ea1f974d..ffa2f234 100644
--- a/www/manager6/panel/MultiDiskEdit.js
+++ b/www/manager6/panel/MultiDiskEdit.js
@@ -1,6 +1,8 @@
Ext.define('PVE.panel.MultiDiskPanel', {
extend: 'Ext.panel.Panel',
+ mixins: ['Proxmox.Mixin.CBind'],
+
setNodename: function(nodename) {
this.items.each((panel) => panel.setNodename(nodename));
},
@@ -8,6 +10,8 @@ Ext.define('PVE.panel.MultiDiskPanel', {
border: false,
bodyBorder: false,
+ importDisk: false, // allow import panel
+
layout: 'card',
controller: {
@@ -16,25 +20,35 @@ Ext.define('PVE.panel.MultiDiskPanel', {
vmconfig: {},
onAdd: function() {
+ this.addDiskChecked(false);
+ },
+
+ onImport: function() {
+ this.addDiskChecked(true);
+ },
+
+ addDiskChecked: function(importDisk) {
let me = this;
me.lookup('addButton').setDisabled(true);
- me.addDisk();
+ me.lookup('addImportButton').setDisabled(true);
+ me.addDisk(importDisk);
let count = me.lookup('grid').getStore().getCount() + 1; // +1 is from ide2
me.lookup('addButton').setDisabled(count >= me.maxCount);
+ me.lookup('addImportButton').setDisabled(count >= me.maxCount);
},
getNextFreeDisk: function(vmconfig) {
throw "implement in subclass";
},
- addPanel: function(itemId, vmconfig, nextFreeDisk) {
+ addPanel: function(itemId, vmconfig, nextFreeDisk, importDisk) {
throw "implement in subclass";
},
// define in subclass
diskSorter: undefined,
- addDisk: function() {
+ addDisk: function(importDisk) {
let me = this;
let grid = me.lookup('grid');
let store = grid.getStore();
@@ -53,7 +67,7 @@ Ext.define('PVE.panel.MultiDiskPanel', {
itemId,
})[0];
- let panel = me.addPanel(itemId, vmconfig, nextFreeDisk);
+ let panel = me.addPanel(itemId, vmconfig, nextFreeDisk, importDisk);
panel.updateVMConfig(vmconfig);
// we need to setup a validitychange handler, so that we can show
@@ -171,6 +185,7 @@ Ext.define('PVE.panel.MultiDiskPanel', {
store.remove(record);
me.getView().remove(record.get('itemId'));
me.lookup('addButton').setDisabled(false);
+ me.lookup('addImportButton').setDisabled(false);
me.updateVMConfig();
me.checkValidity();
},
@@ -210,6 +225,7 @@ Ext.define('PVE.panel.MultiDiskPanel', {
dock: 'left',
border: false,
width: 130,
+ cbind: {}, // for nested cbinds
items: [
{
xtype: 'grid',
@@ -257,6 +273,18 @@ Ext.define('PVE.panel.MultiDiskPanel', {
iconCls: 'fa fa-plus-circle',
handler: 'onAdd',
},
+ {
+ xtype: 'button',
+ reference: 'addImportButton',
+ text: gettext('Import'),
+ iconCls: 'fa fa-cloud-download',
+ handler: 'onImport',
+ margin: '5 0 0 0',
+ cbind: {
+ disabled: '{!importDisk}',
+ hidden: '{!importDisk}',
+ },
+ },
{
// dummy field to control wizard validation
xtype: 'textfield',
diff --git a/www/manager6/qemu/MultiHDEdit.js b/www/manager6/qemu/MultiHDEdit.js
index 27884f3f..159236b6 100644
--- a/www/manager6/qemu/MultiHDEdit.js
+++ b/www/manager6/qemu/MultiHDEdit.js
@@ -4,6 +4,8 @@ Ext.define('PVE.qemu.MultiHDPanel', {
onlineHelp: 'qm_hard_disk',
+ importDisk: true,
+
controller: {
xclass: 'Ext.app.ViewController',
@@ -16,7 +18,7 @@ Ext.define('PVE.qemu.MultiHDPanel', {
return PVE.Utils.nextFreeDisk(clist, vmconfig);
},
- addPanel: function(itemId, vmconfig, nextFreeDisk) {
+ addPanel: function(itemId, vmconfig, nextFreeDisk, importDisk) {
let me = this;
return me.getView().add({
vmconfig,
@@ -30,6 +32,7 @@ Ext.define('PVE.qemu.MultiHDPanel', {
itemId,
isCreate: true,
insideWizard: true,
+ importDisk,
});
},
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-04-08 12:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 12:13 [pve-devel] [PATCH manager v7 0/3] allow importing vm disk images on the UI Dominik Csapak
2025-04-08 12:13 ` [pve-devel] [PATCH manager v7 1/3] ui: qemu hd edit: allow importing a disk from the import storage Dominik Csapak
2025-04-08 12:13 ` Dominik Csapak [this message]
2025-04-08 12:13 ` [pve-devel] [PATCH manager v7 3/3] ui: import storage content: allow importing of vm disk images Dominik Csapak
2025-04-08 15:34 ` Thomas Lamprecht
2025-04-09 7:10 ` Dominik Csapak
2025-04-10 11:39 ` Gilberto Ferreira via pve-devel
2025-04-10 12:04 ` Dominik Csapak via pve-devel
2025-04-10 12:13 ` Gilberto Ferreira via pve-devel
2025-04-10 12:25 ` Gilberto Ferreira via pve-devel
2025-04-08 15:44 ` [pve-devel] [PATCH manager v7 0/3] allow importing vm disk images on the UI Michael Köppl
2025-04-10 12:04 ` Lukas Wagner via pve-devel
[not found] ` <c7b3dfb5-89aa-4f42-927d-08475d17e7f0@proxmox.com>
2025-04-10 12:06 ` Dominik Csapak via pve-devel
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=20250408121312.312526-3-d.csapak@proxmox.com \
--to=d.csapak@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal